Index: npl/system/openssl/openssl.SlackBuild.orig
===================================================================
--- npl/system/openssl/openssl.SlackBuild.orig	(revision c5c522c7ca74a4c1725ca5e3fe0bdcadff80e49a)
+++ npl/system/openssl/openssl.SlackBuild.orig	(revision 9670dd03517712bd8158cac4177337a4707f4e15)
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright 2000 BSDi, Inc. Concord, CA, USA
 # Copyright 2001, 2002 Slackware Linux, Inc.  Concord, CA, USA
-# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014  Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2018  Patrick J. Volkerding, Sebeka, MN, USA
 # All rights reserved.
 #
@@ -23,11 +23,11 @@
 #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-
 # Set initial variables:
-CWD=$(pwd)
+cd $(dirname $0) ; CWD=$(pwd)
 TMP=${TMP:-/tmp}
 
+PKGNAM=openssl
 VERSION=${VERSION:-$(echo openssl-*.tar.gz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
 
 # Automatically determine the architecture we're building on:
@@ -46,7 +46,15 @@
 NAME2=openssl-solibs-$VERSION-$ARCH-$BUILD
 
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+  echo "${NAME1}.txz"
+  echo "${NAME2}.txz"
+  exit 0
+fi
+
 # Parallel build doesn't link properly.
 #NUMJOBS=${NUMJOBS:--j6}
-NUMJOBS=-j1
 
 # So that ls has the right field counts for parsing...
@@ -63,8 +71,13 @@
 
 # Use .so.1, not .so.1.0.0:
-zcat $CWD/openssl.soname.diff.gz | patch -p1 --backup --verbose --suffix=.orig || exit 1
+sed -i "s/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB.1/g" Makefile.shared
+
 if [ "$ARCH" = "i586" ]; then
   # Build with -march=i586 -mtune=i686:
-  zcat $CWD/openssl.optsx86.diff.gz | patch -p1 --backup --verbose --suffix=.orig || exit 1
+  sed -i "/linux-elf/s/fomit-frame-pointer/fomit-frame-pointer -march=i586 -mtune=i686/g" Configure
+  LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+  # Build with -march=i686 -mtune=i686:
+  sed -i "/linux-elf/s/fomit-frame-pointer/fomit-frame-pointer -march=i686 -mtune=i686/g" Configure
   LIBDIRSUFFIX=""
 elif [ "$ARCH" = "x86_64" ]; then
@@ -77,7 +90,7 @@
 # what they were compiled against, whether or not the ABI has changed.
 #
-# So, we will use the OPENSSL_VERSION_NUMBER from openssl-1.0.1c unless ABI
+# So, we will use the OPENSSL_VERSION_NUMBER from openssl-1.0.2e unless ABI
 # breakage forces it to change.  Yes, we're finally using this old trick.  :)
-sed -i "s/#define OPENSSL_VERSION_NUMBER.*/\/* Use 0x1000103fL (1.0.1c) below to avoid pointlessly breaking the ABI *\/\n#define OPENSSL_VERSION_NUMBER 0x1000103fL/g" crypto/opensslv.h || exit 1
+sed -i "s/#define OPENSSL_VERSION_NUMBER.*/\/* Use 0x1000205fL (1.0.2e) below to avoid pointlessly breaking the ABI *\/\n#define OPENSSL_VERSION_NUMBER 0x1000205fL/g" crypto/opensslv.h || exit 1
 
 chown -R root:root .
@@ -98,19 +111,28 @@
 # These are the known patent issues with OpenSSL:
 # name   #         expires
-# MDC-2: 4,908,861  2007-03-13, included.  :-)
+# MDC-2: 4,908,861  2007-03-13, not included.
 # IDEA:  5,214,703  2010-05-25, not included.
 # RC5:   5,724,428  2015-03-03, not included.
+#
+# Although all of the above are expired, it's still probably
+# not a good idea to include them as there are better
+# algorithms to use.
 
 ./config \
  --prefix=/usr \
  --openssldir=/etc/ssl \
+ no-mdc2 \
  no-idea \
  no-rc5 \
  no-sse2 \
+ no-ssl2 \
+ no-weak-ssl-ciphers \
  shared
 
-make $NUMJOBS depend || make -j1  depend || exit 1
-
-make $NUMJOBS || make -j 1 || exit 1
+make $NUMJOBS depend || make depend || exit 1
+
+make $NUMJOBS || make || exit 1
+
+make test -j1 || exit 1
 
 make install INSTALL_PREFIX=$PKG1 || exit 1
@@ -144,7 +166,36 @@
 
 mv $PKG1/etc/ssl/man $PKG1/usr
-( cd $PKG1/usr/man/man1 ; mv passwd.1 ssl_passwd.1 )
-( cd $PKG1/usr/man/man3 ; mv rand.3 ssl_rand.3 )
-( cd $PKG1/usr/man/man3 ; mv err.3 ssl_err.3 )
+# Fix manpage name collisions, and relink anything that linked to the old name:
+( cd $PKG1/usr/man/man1
+  mv passwd.1 ssl_passwd.1
+  for file in *.1 ; do
+    if [ -L $file ]; then
+      if [ "$(readlink $file)" = "passwd.1" ]; then
+        rm -f $file
+        ln -sf ssl_passwd.1 $file
+      fi
+    fi
+  done )
+( cd $PKG1/usr/man/man3
+  mv rand.3 ssl_rand.3
+  for file in *.3 ; do
+    if [ -L $file ]; then
+      if [ "$(readlink $file)" = "rand.3" ]; then
+        rm -f $file
+        ln -sf ssl_rand.3 $file
+      fi
+    fi
+  done )
+( cd $PKG1/usr/man/man3
+  mv err.3 ssl_err.3
+  for file in *.3 ; do
+    if [ -L $file ]; then
+      if [ "$(readlink $file)" = "err.3" ]; then
+        rm -f $file
+        ln -sf ssl_err.3 $file
+      fi
+    fi
+  done )
+
 # Compress and symlink the man pages:
 if [ -d $PKG1/usr/man ]; then
