From 236f450409a499996b9dba5e0d5d924a6a3f2053 Mon Sep 17 00:00:00 2001
From: John Vogel <jvogel4@stny.rr.com>
Date: Fri, 5 Jul 2019 16:27:11 -0400
Subject: [PATCH] openjdk8: update boot jdk, cleanup

Also import fixes from boot jdk ports
---
 openjdk8/.footprint |  4 ----
 openjdk8/.signature |  8 ++++----
 openjdk8/Pkgfile    | 35 ++++++++++++++++++++++-------------
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/openjdk8/.footprint b/openjdk8/.footprint
index 252acb592..11d4aa5e5 100644
--- a/openjdk8/.footprint
+++ b/openjdk8/.footprint
@@ -5,8 +5,6 @@ drwxr-xr-x	root/root	usr/
 drwxr-xr-x	root/root	usr/lib/
 drwxr-xr-x	root/root	usr/lib/java/
 drwxr-xr-x	root/root	usr/lib/java/openjdk8/
--r--r--r--	root/root	usr/lib/java/openjdk8/ASSEMBLY_EXCEPTION
--r--r--r--	root/root	usr/lib/java/openjdk8/LICENSE
 drwxr-xr-x	root/root	usr/lib/java/openjdk8/bin/
 -rwxr-xr-x	root/root	usr/lib/java/openjdk8/bin/appletviewer
 -rwxr-xr-x	root/root	usr/lib/java/openjdk8/bin/clhsdb
@@ -62,8 +60,6 @@ drwxr-xr-x	root/root	usr/lib/java/openjdk8/include/linux/
 -rw-r--r--	root/root	usr/lib/java/openjdk8/include/linux/jawt_md.h
 -rw-r--r--	root/root	usr/lib/java/openjdk8/include/linux/jni_md.h
 drwxr-xr-x	root/root	usr/lib/java/openjdk8/jre/
--r--r--r--	root/root	usr/lib/java/openjdk8/jre/ASSEMBLY_EXCEPTION
--r--r--r--	root/root	usr/lib/java/openjdk8/jre/LICENSE
 drwxr-xr-x	root/root	usr/lib/java/openjdk8/jre/bin/
 lrwxrwxrwx	root/root	usr/lib/java/openjdk8/jre/bin/clhsdb -> ../../bin/clhsdb
 lrwxrwxrwx	root/root	usr/lib/java/openjdk8/jre/bin/hsdb -> ../../bin/hsdb
diff --git a/openjdk8/.signature b/openjdk8/.signature
index cf670aa47..8e4bfc6cb 100644
--- a/openjdk8/.signature
+++ b/openjdk8/.signature
@@ -1,7 +1,7 @@
 untrusted comment: verify with /etc/ports/contrib.pub
-RWSagIOpLGJF32AoW89VK8nwis803WfWG3d+1RLHyx48/yW0HnZSd4SwIxAIoDLzMQ47XHER7CLaSBWd4+VN8VkZR/Gk75lqcgo=
-SHA256 (Pkgfile) = 6b97c63387f27c07e97538c92542692ac8b8f86b8634e395ae058719974d3a4e
-SHA256 (.footprint) = 6c181722f2005db2354b1f677f5afe38ee77b078bf803fec87fd4d9d9f86f63d
+RWSagIOpLGJF305CrABA66JpW8MaXmMfHbbZDy19BUyEw0o/j5ncKoS6Xf4CQS3Wn3D2eA0I/2wPAtQWMXzz/BucWh5flL/REwI=
+SHA256 (Pkgfile) = 87f145d8355cd2b1a8b1a3211893be67c763dfd7057a4e0ee7bc0749010902fa
+SHA256 (.footprint) = e8f53be1e479ce58abea6ca998284c93157bbdc81fe6a659a80e181f8d9679dd
 SHA256 (icedtea-3.12.0.tar.xz) = 121dd400d6cc40803b634b42968de2842e9ac0adc7808a91c45bfd30d8223338
 SHA256 (corba-8u212-b04.tar.xz) = 5ce6b01dd0b1608d6cf293eec3a51c2b0ad6567cc8b0ff8e7834016603bab9e8
 SHA256 (hotspot-8u212-b04.tar.xz) = 073ebc2f2e0301e0f2c17bb0e9d7340a0ed1f003c9706109f25ecefeeedc67f6
@@ -13,4 +13,4 @@ SHA256 (nashorn-8u212-b04.tar.xz) = 434fa40c57ab1c6416b65aecc187cbf9b16cf1d90e5e
 SHA256 (openjdk-8u212-b04.tar.xz) = b19b2f33dc9d8e1619cc59b4e3ffe7129698016f468f8759e81d04583c692e0c
 SHA256 (certdata-f84b1b428d42.txt) = 61eaa79ac46d923f2f74dfe401189424e96fa8736102b47ba2cdb4ea19af2cc8
 SHA256 (mozilla-rootcerts-2018Q3.sh) = 45bf640ca551ecbb5e7a9c3121f67c3d9fd256b0f58916b7d5a5a40d5bee98ba
-SHA256 (openjdk8-boot-20190531-bin.tar.xz) = a1d2a2fd89f83d45d3dcd92f2e4472bc8bd58a9faf08026d0c6a57bf7dd141a9
+SHA256 (openjdk8-boot-20190705-bin.tar.xz) = 0826a7fb31b0b6af00881ec9b01eed0f179896c3967d1a4648e6096cf6a7c608
diff --git a/openjdk8/Pkgfile b/openjdk8/Pkgfile
index 6563319c7..af03fb5d6 100644
--- a/openjdk8/Pkgfile
+++ b/openjdk8/Pkgfile
@@ -6,10 +6,10 @@
 name=openjdk8
 version=8u212-b04
 icedtea_version=3.12.0
-boot_version=20190531
+boot_version=20190705
 pkgsrc_quarter=2018Q3
 certdata_rev=f84b1b428d42
-release=1
+release=2
 source=(http://icedtea.wildebeest.org/download/source/icedtea-$icedtea_version.tar.xz
 	https://stygian.me/crux/distfiles/$name/corba-$version.tar.xz
 	https://stygian.me/crux/distfiles/$name/hotspot-$version.tar.xz
@@ -37,6 +37,11 @@ unpack_source() {
 }
 
 build() {
+	# Most of these flags were snarfed directly from Alpine Linux APKBUILD for openjdk7, added -fabi-version.
+	# Fixes build failures due to suspected gcc8 changes for default std and abi.
+	export EXTRA_CPP_FLAGS="$CXXFLAGS -fabi-version=10 -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
+	export EXTRA_CFLAGS="$CFLAGS -fabi-version=10 -std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
+
 	# Make sure we do not have ccache masquerade directory in PATH.
 	# Use --enable-ccache instead of providing a wrapped compiler.
 	# NOTE: the check for usr/bin/ccache may be too specific, since it rules out
@@ -90,6 +95,7 @@ build() {
 	LC_ALL=C \
 	make
 
+	# Copy the sdk image first before pruning it, saving original for later inspection/comparison.
 	install -d -m 0755 $PKG/usr/lib/java/$name
 	cp -a openjdk.build/images/j2sdk-image/* $PKG/usr/lib/java/$name
 
@@ -98,25 +104,28 @@ build() {
 	echo "/usr/lib/java/$name/jre/lib/amd64/jli" >> $PKG/etc/revdep.d/$name
 	echo "/usr/lib/java/$name/jre/lib/amd64/server" >> $PKG/etc/revdep.d/$name
 
-	# remove unneeded files
+	# Remove unneeded files
 	rm -f $PKG/usr/lib/java/$name/src.zip
-	rm -rf $PKG/usr/lib/java/$name/{demo,sample}
-	rm -f $PKG/usr/lib/java/$name/man/ja
-	rm -rf $PKG/usr/lib/java/$name/man/ja_JP.UTF-8
+	rm -rf $PKG/usr/lib/java/$name/{demo,man/ja*,sample}
 	rm -f $PKG/usr/lib/java/$name/{,jre/}THIRD_PARTY_README
-	find $PKG/usr/lib/java/$name -name '*.ja' -delete
+	find $PKG/usr/lib/java/$name \( \
+		-name '*.ja' -o \
+		-name 'ASSEMBLY_EXCEPTION' -o \
+		-name 'LICENSE' -o \
+		-name 'THIRD_PARTY_README' \) \
+		-delete
 
-	# deduplicate
+	# Deduplicate
 	rm $PKG/usr/lib/java/$name/jre/lib/amd64/libjawt.so
-	ln -s ../../../lib/amd64/libjawt.so \
+	ln -sr $PKG/usr/lib/java/$name/lib/amd64/libjawt.so \
 		$PKG/usr/lib/java/$name/jre/lib/amd64/libjawt.so
 	rm $PKG/usr/lib/java/$name/jre/lib/amd64/jli/libjli.so
-	ln -s ../../../../lib/amd64/jli/libjli.so \
+	ln -sr $PKG/usr/lib/java/$name/lib/amd64/jli/libjli.so \
 		$PKG/usr/lib/java/$name/jre/lib/amd64/jli/libjli.so
 	for f in $PKG/usr/lib/java/$name/jre/bin/* ; do
 		if [ -f $PKG/usr/lib/java/$name/bin/${f##*/} ]; then
 			rm $f
-			ln -s ../../bin/${f##*/} $f
+			ln -sr $PKG/usr/lib/java/$name/bin/${f##*/} $f
 		fi
 	done
 
@@ -139,8 +148,8 @@ build() {
 	export JAVA_HOME=$PKG/usr/lib/java/$name
 	export PATH=$JAVA_HOME/bin:$OLD_PATH
 
-	# generate java's cacerts
-	# big thanks to pkgsrc's mozilla-rootcerts and openjdk pkg's for this part
+	# Generate java's cacerts.
+	# Big thanks to pkgsrc's mozilla-rootcerts and openjdk pkg's for this part.
 	rm -f $PKG/usr/lib/java/$name/jre/lib/security/cacerts
 	mkdir $SRC/cacerts
 	cd $SRC/cacerts