Index: npl/java/openjdk/openjdk.SlackBuild.orig
===================================================================
--- npl/java/openjdk/openjdk.SlackBuild.orig	(revision 981dbbc6c900fb75ec9e5eaf6305054362a41911)
+++ npl/java/openjdk/openjdk.SlackBuild.orig	(revision 981dbbc6c900fb75ec9e5eaf6305054362a41911)
@@ -0,0 +1,379 @@
+#!/bin/sh
+
+# Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017  Eric Hameleers, Eindhoven, The Netherlands
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
+#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+PKGNAM1=openjdk
+PKGNAM2=openjre
+JAVAVER=8u151
+JAVABLD=b12
+ICEDTEA=3.6.0
+
+VERSION="${JAVAVER}_${JAVABLD}"
+BUILD=${BUILD:-1}
+TAG=${TAG:-"alien"}
+
+NUMJOBS=${NUMJOBS:--j6}
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG1=$TMP/package-$PKGNAM1
+PKG2=$TMP/package-$PKGNAM2
+
+# If BOOTSTRAP is set to "YES" then we bootstrap the build using a
+# pre-installed version of OpenJDK7 to build OpenJDK8.
+# Note: OpenJDK8 can no longer be bootstrapped using GCC java compiler (gcj) .
+BOOTSTRAP=${BOOTSTRAP:-"YES"}
+
+# If you want debug symbols in your JVM library, set DEBUGBUILD to "YES";
+# this would inflate the libjvm.so file from 13 to 160 MB (estimate):
+DEBUGBUILD=${DEBUGBUILD:-"NO"}
+
+# Sources the script requires. Note that the Makefile contains SHA256SUM values
+# for all of these tarballs; if the tarball does not verify then it will be
+# downloaded again:
+
+SRC_CACAO=cacao_icedtea-${ICEDTEA}.tar.gz
+SRC_JAMVM=jamvm_icedtea-${ICEDTEA}.tar.gz
+SRC_CORBA=corba_icedtea-${ICEDTEA}.tar.xz
+SRC_HOTSPOT=hotspot_icedtea-${ICEDTEA}.tar.xz
+SRC_JAXP=jaxp_icedtea-${ICEDTEA}.tar.xz
+SRC_JAXWS=jaxws_icedtea-${ICEDTEA}.tar.xz
+SRC_JDK=jdk_icedtea-${ICEDTEA}.tar.xz
+SRC_LANGTOOLS=langtools_icedtea-${ICEDTEA}.tar.xz
+SRC_NASHORN=nashorn_icedtea-${ICEDTEA}.tar.xz
+SRC_OPENJDK=openjdk_icedtea-${ICEDTEA}.tar.xz
+
+# Automatically determine the architecture we're building on:
+MARCH=$( uname -m )
+if [ -z "$ARCH" ]; then
+  case "$MARCH" in
+    i?86)    export ARCH=i486 ;;
+    armv7hl) export ARCH=$MARCH ;;
+    arm*)    export ARCH=arm ;;
+    # Unless $ARCH is already set, use uname -m for all other archs:
+    *)       export ARCH=$MARCH ;;
+  esac
+fi
+
+if [ "$ARCH" = "i486" ]; then
+  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+  LIBDIRSUFFIX=""
+  LIB_ARCH=i386
+  ARCH_OPTS=" --disable-jamvm "
+elif [ "$ARCH" = "i686" ]; then
+  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+  LIBDIRSUFFIX=""
+  LIB_ARCH=i386
+  ARCH_OPTS=" --disable-jamvm "
+elif [ "$ARCH" = "x86_64" ]; then
+  SLKCFLAGS="-O2 -fPIC"
+  LIBDIRSUFFIX="64"
+  LIB_ARCH=amd64
+  ARCH_OPTS=" --disable-jamvm "
+elif [ "$ARCH" = "arm" ]; then
+  SLKCFLAGS="-O2"
+  LIBDIRSUFFIX=""
+  LIB_ARCH=arm
+  ARCH_OPTS="--enable-jamvm --with-jamvm-src-zip=$CWD/sources/${SRC_JAMVM}"
+elif [ "$ARCH" = "armv7hl" ]; then
+  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
+  LIBDIRSUFFIX=""
+  LIB_ARCH=arm
+  ARCH_OPTS="--enable-jamvm --with-jamvm-src-zip=$CWD/sources/${SRC_JAMVM}"
+else
+  SLKCFLAGS="-O2"
+  LIBDIRSUFFIX=""
+  LIB_ARCH=$ARCH
+  ARCH_OPTS=" --disable-jamvm "
+fi
+
+case "$ARCH" in
+    arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
+    *)    TARGET=$ARCH-slackware-linux ;;
+esac
+
+rm -rf $PKG1 $PKG2
+mkdir -p $TMP $PKG1 $PKG2
+cd $TMP
+rm -rf icedtea-$ICEDTEA
+tar xvf $CWD/sources/icedtea-$ICEDTEA.tar.?z || exit 1
+cd icedtea-$ICEDTEA || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# First check: are our sources complying with our SlackBuild?
+JDKU=$(cat Makefile.in | grep ^JDK_UPDATE_VERSION | tr -d ' ' | cut -f2 -d=)
+JDKB=$(cat Makefile.in | grep ^BUILD_VERSION | tr -d ' ' | cut -f2 -d=)
+echo "** This SlackBuild creates a package for Java $JAVAVER using OpenJDK build $JAVABLD"
+echo "** The script uses icedtea-$ICEDTEA as a build framework."
+echo "** Icedtea will (download and) build Java update $JDKU using OpenJDK build $JDKB"
+echo "** If you see a mismatch here, then you have 5 seconds to abort this script (press Ctrl-C) and fix it."
+#sleep 5
+
+# We start with creating a proper build environment.
+
+# Prevent an error which aborts the build:
+mkdir -p bootstrap/boot/jre/lib
+
+unset CLASSPATH
+unset JAVA_HOME
+unset MAKEFLAGS
+
+if [ "$BOOTSTRAP" = "YES" -o "$BOOTSTRAP" = "yes" ]; then
+  # Use gcc's java compiler:
+  export JVMDIR=/usr/lib${LIBDIRSUFFIX}/jvm
+  export ALT_BOOTDIR=/usr/lib${LIBDIRSUFFIX}/jvm
+  export ECJJAR=/usr/share/java/ecj.jar
+  export RTJAR=$TMP/icedtea-$ICEDTEA/bootstrap/boot/jre/lib/rt.jar
+  ! echo $PATH | grep -q jvm/bin && export PATH=/usr/lib${LIBDIRSUFFIX}/jvm/bin:$PATH
+  EXTRA_OPTS="--enable-bootstrap --with-gcj=/usr/bin/gcj"
+  # Bootstrap without cacao/jamvm:
+  ARCH_OPTS=""
+else
+  # Use a pre-installed OpenJDK:
+  export JVMDIR=/usr/lib${LIBDIRSUFFIX}/java
+  EXTRA_OPTS="--disable-bootstrap"
+fi
+
+export ANT_HOME=/usr/share/ant
+export ALT_FREETYPE_LIB_PATH=/usr/lib${LIBDIRSUFFIX}
+export ALT_PARALLEL_COMPILE_JOBS="${NUMJOBS/-j}"
+export BUILD_NUMBER=$JAVABLD
+export HOTSPOT_BUILD_JOBS="${ALT_PARALLEL_COMPILE_JOBS}"
+export LANG=C
+export OS_VARIANT_NAME="Slackware"
+export OS_VARIANT_VERSION=$(cat /etc/slackware-version | cut -f2 -d' ')
+
+cp $CWD/patches/*.patch $TMP/icedtea-$ICEDTEA/patches/
+#export DISTRIBUTION_BOOT_PATCHES="patches/openjdk.arm_fixes.patch"
+export DISTRIBUTION_BOOT_PATCHES=""
+export DISTRIBUTION_PATCHES="patches/nonreparenting_wm.patch"
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+  --with-abs-install-dir=/usr/lib${LIBDIRSUFFIX}/java \
+  --with-pkgversion=Slackware \
+  --with-parallel-jobs=${HOTSPOT_BUILD_JOBS} \
+  --with-corba-src-zip=$CWD/sources/${SRC_CORBA} \
+  --with-hotspot-src-zip=$CWD/sources/${SRC_HOTSPOT} \
+  --with-jaxp-src-zip=$CWD/sources/${SRC_JAXP} \
+  --with-jaxws-src-zip=$CWD/sources/${SRC_JAXWS} \
+  --with-jdk-src-zip=$CWD/sources/${SRC_JDK} \
+  --with-langtools-src-zip=$CWD/sources/${SRC_LANGTOOLS} \
+  --with-nashorn-src-zip=$CWD/sources/${SRC_NASHORN} \
+  --with-openjdk-src-zip=$CWD/sources/${SRC_OPENJDK} \
+  --with-jdk-home=${JVMDIR} \
+  --disable-docs \
+  --disable-jdk-tests \
+  --disable-langtools-tests \
+  --disable-precompiled-headers \
+  --disable-system-gif \
+  --disable-system-jpeg \
+  --disable-system-kerberos \
+  --disable-system-lcms \
+  --disable-system-pcsc \
+  --disable-system-png \
+  --disable-system-sctp \
+  --disable-system-zlib \
+  --enable-headless \
+  --enable-nss \
+  $ARCH_OPTS \
+  $EXTRA_OPTS \
+  --build=$TARGET
+  #--with-javac=${JVMDIR}/bin/javac \
+
+# In bootstrap build on Slackware 14, avoid a DSO linking error:
+sed -i -e "s/-o native-ecj/-lgcj -o native-ecj/" Makefile
+
+make V=1 || exit 1
+
+# Move the generated jre and sdk images to the respective packages:
+mkdir -p $PKG1/usr/lib${LIBDIRSUFFIX} $PKG2/usr/lib${LIBDIRSUFFIX}/java
+cp -a openjdk.build/images/j2sdk-image \
+  $PKG1/usr/lib${LIBDIRSUFFIX}/java
+cp -a openjdk.build/images/j2re-image \
+  $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre
+
+# Fix a file permission issue,
+# see also http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437
+find $PKG2/usr/lib${LIBDIRSUFFIX}/java -iname "*.jar" -exec chmod 644 {} \;
+find $PKG1/usr/lib${LIBDIRSUFFIX}/java -iname "*.jar" -exec chmod 644 {} \;
+chmod 644 $PKG1/usr/lib${LIBDIRSUFFIX}/java/lib/ct.sym
+
+if [ "$DEBUGBUILD" = "NO" ]; then
+  # Strip debug symbols from the libjvm.so but leave the symbol tables alone:
+  find $PKG1 -name libjvm.so -exec strip --strip-debug {} \;
+  find $PKG2 -name libjvm.so -exec strip --strip-debug {} \;
+fi
+
+# Generate a cacerts file from the certificates installed through our
+# ca-certificates package - the "cacerts" in the OpenJDK sources is empty.
+# This will only work if we already have a proper JDK/JRE installed:
+# if which keytool 1>/dev/null 2>&1 ; then
+#   mkdir certgen
+#   ( cd certgen
+#     cp $CWD/scripts/generate-cacerts.pl .
+#     for cert in /usr/share/ca-certificates/*/*.crt; do
+#       openssl x509 -text -in "${cert}" >> all.crt
+#     done
+#     perl generate-cacerts.pl keytool all.crt
+#     install -p -m0644 cacerts $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security
+#     install -p -m0644 cacerts $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security
+#   )
+# else
+#   echo "** Not installing a proper cacerts file !"
+#   echo "** Missing keytool program (do you really have a Java installed?)"
+# fi
+
+# Symlinks are present in Slackware historically:
+( cd $PKG1/usr/lib${LIBDIRSUFFIX}
+  ln -sf java jdk${VERSION}
+) || exit 1
+( cd $PKG2/usr/lib${LIBDIRSUFFIX}/java
+  ln -sf jre jre${VERSION}
+) || exit 1
+
+# Add the profile scripts:
+mkdir -p $PKG1/etc/profile.d $PKG2/etc/profile.d
+for file in $(ls $CWD/profile.d/openjdk*) ; do
+  cat $file | sed -e "s#lib/java#lib${LIBDIRSUFFIX}/java#" \
+    > $PKG1/etc/profile.d/$(basename $file)
+done
+for file in $(ls $CWD/profile.d/openjre*) ; do
+  cat $file | sed -e "s#lib/java#lib${LIBDIRSUFFIX}/java#" \
+    > $PKG2/etc/profile.d/$(basename $file)
+done
+chmod 755 $PKG1/etc/profile.d/* $PKG2/etc/profile.d/*
+
+# Add menu entries and icons:
+for i in 16 24 32 48 ; do
+  mkdir -p ${PKG1}/usr/share/icons/hicolor/${i}x${i}/apps
+  install -m644 openjdk/jdk/src/solaris/classes/sun/awt/X11/java-icon${i}.png \
+  ${PKG1}/usr/share/icons/hicolor/${i}x${i}/apps/java.png
+  mkdir -p ${PKG2}/usr/share/icons/hicolor/${i}x${i}/apps
+  install -m644 openjdk/jdk/src/solaris/classes/sun/awt/X11/java-icon${i}.png \
+  ${PKG2}/usr/share/icons/hicolor/${i}x${i}/apps/java.png
+done
+mkdir -p ${PKG1}/usr/share/applications ${PKG2}/usr/share/applications
+for DTFILE in jconsole policytool ; do
+  install -m644 ${DTFILE}.desktop ${PKG1}/usr/share/applications/
+  install -m644 ${DTFILE}.desktop ${PKG2}/usr/share/applications/
+done
+# We do not create symlinks for binaries in /usr/bin , instead we add the
+# Java directory to the $PATH :
+for FILE in ${PKG1}/usr/share/applications/*.desktop \
+ ${PKG2}/usr/share/applications/*.desktop ; do
+  sed -i -e "s,^Exec=/usr/bin/,Exec=," -e "s,^Exec=_BINDIR_/,Exec=," \
+    -e "s,^Exec=/usr/local/bin/,Exec=," $FILE
+done
+
+# User-modifiable configuration files go to /etc :
+mkdir -p $PKG1/etc/java $PKG2/etc/java
+mv $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/${LIB_ARCH}/jvm.cfg $PKG1/etc/java/jvm.cfg.new
+ln -sf /etc/java/jvm.cfg $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/${LIB_ARCH}/jvm.cfg
+mv $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.policy $PKG1/etc/java/java.policy.new
+ln -sf /etc/java/java.policy $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.policy
+mv $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.security $PKG1/etc/java/java.security.new
+ln -sf /etc/java/java.security $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.security
+cat $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/nss.cfg | sed -e 's/seamonkey-.*$/seamonkey/' > $PKG1/etc/java/nss.cfg.new
+ln -sf /etc/java/nss.cfg $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/nss.cfg
+# And the jre package:
+mv $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/${LIB_ARCH}/jvm.cfg $PKG2/etc/java/jvm.cfg.new
+ln -sf /etc/java/jvm.cfg $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/${LIB_ARCH}/jvm.cfg
+mv $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.policy $PKG2/etc/java/java.policy.new
+ln -sf /etc/java/java.policy $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.policy
+mv $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.security $PKG2/etc/java/java.security.new
+ln -sf /etc/java/java.security $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/java.security
+# Add jdk's nss.cfg file to the jre package (some applications crash otherwise):
+cat $PKG1/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/nss.cfg | sed -e 's/seamonkey-.*$/seamonkey/' > $PKG2/etc/java/nss.cfg.new
+ln -sf /etc/java/nss.cfg $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/lib/security/nss.cfg
+
+# NOTE:
+# The openjdk does not build a mozilla plugin: install icedtea-web instead.
+
+( cd $PKG1/usr/lib${LIBDIRSUFFIX}
+  ln -sf ./java/jre/lib/${LIB_ARCH}/server/libjvm.so .
+)
+
+( cd $PKG2/usr/lib${LIBDIRSUFFIX}
+  ln -sf ./java/jre/lib/${LIB_ARCH}/server/libjvm.so .
+)
+
+# Add package description and deal with the .new files:
+mkdir -p $PKG1/install $PKG2/install
+cat $CWD/slack-desc.jdk > $PKG1/install/slack-desc
+zcat $CWD/doinst.sh.gz > $PKG1/install/doinst.sh
+cat $CWD/slack-desc.jre > $PKG2/install/slack-desc
+zcat $CWD/doinst.sh.gz  > $PKG2/install/doinst.sh
+
+# Add documentation files:
+mkdir -p $PKG1/usr/doc/$PKGNAM1-$VERSION/icedtea
+mkdir -p $PKG2/usr/doc/$PKGNAM2-$VERSION/icedtea
+( cd openjdk
+  cp -a \
+    ASSEMBLY_EXCEPTION LICENSE README* THIRD_PARTY_README \
+    $PKG1/usr/doc/$PKGNAM1-$VERSION
+  cp -a \
+    ASSEMBLY_EXCEPTION LICENSE README* THIRD_PARTY_README \
+    $PKG2/usr/doc/$PKGNAM2-$VERSION
+)
+cp -a \
+  AUTHORS COPYING HACKING INSTALL NEWS README* THANKYOU \
+  $PKG1/usr/doc/$PKGNAM1-$VERSION/icedtea
+cp -a \
+  AUTHORS COPYING HACKING INSTALL NEWS README* THANKYOU \
+  $PKG2/usr/doc/$PKGNAM2-$VERSION/icedtea
+
+# Compress manual pages:
+find $PKG1/usr/lib${LIBDIRSUFFIX}/java/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG1/usr/lib${LIBDIRSUFFIX}/java/man -type l ) ; do
+  ln -s $( readlink $i ).gz $i.gz
+  rm $i
+done
+find $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG2/usr/lib${LIBDIRSUFFIX}/java/jre/man -type l ) ; do
+  ln -s $( readlink $i ).gz $i.gz
+  rm $i
+done
+
+# If there's a ChangeLog, installing at least part of the recent history
+# is useful, but don't let it get totally out of control:
+if [ -r ChangeLog ]; then
+  for DOCSDIR in $(echo $PKG1/usr/doc/${PKGNAM1}-$VERSION) \
+    $(echo $PKG2/usr/doc/${PKGNAM2}-$VERSION)
+  do
+    cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
+    touch -r ChangeLog $DOCSDIR/ChangeLog
+  done
+fi
+
+# Finally, create the two packages:
+cd $PKG1
+/sbin/makepkg -l y -c n $TMP/$PKGNAM1-$(echo $VERSION | tr - _)-$ARCH-$BUILD$TAG.txz
+cd $PKG2
+/sbin/makepkg -l y -c n $TMP/$PKGNAM2-$(echo $VERSION | tr - _)-$ARCH-$BUILD$TAG.txz
