summaryrefslogtreecommitdiff
path: root/openjdk8/Pkgfile
blob: 4adf5ad52138400d5536d64fa205623ed89b2d59 (plain)
    1 # Description: OpenJDK 8 built using IcedTea build harness
    2 # URL:         http://icedtea.classpath.org http://openjdk.java.net
    3 # Maintainer:  John Vogel, jvogel4 at stny dot rr dot com
    4 # Depends on:  alsa-lib cups fontconfig freetype giflib gtk krb5 lcms2 libjpeg-turbo libpng libxslt nss unzip xorg-libxt xorg-libxtst xorg-libxinerama zip
    5 
    6 name=openjdk8
    7 version=8u222-b10
    8 icedtea_version=3.13.0
    9 boot_version=20190719
   10 pkgsrc_quarter=2018Q3
   11 certdata_rev=f84b1b428d42
   12 release=1
   13 source=(http://icedtea.wildebeest.org/download/source/icedtea-$icedtea_version.tar.xz
   14 	https://stygian.me/crux/distfiles/$name/corba-$version.tar.xz
   15 	https://stygian.me/crux/distfiles/$name/hotspot-$version.tar.xz
   16 	https://stygian.me/crux/distfiles/$name/jaxp-$version.tar.xz
   17 	https://stygian.me/crux/distfiles/$name/jaxws-$version.tar.xz
   18 	https://stygian.me/crux/distfiles/$name/jdk-$version.tar.xz
   19 	https://stygian.me/crux/distfiles/$name/langtools-$version.tar.xz
   20 	https://stygian.me/crux/distfiles/$name/nashorn-$version.tar.xz
   21 	https://stygian.me/crux/distfiles/$name/openjdk-$version.tar.xz
   22 	https://stygian.me/crux/distfiles/certdata-$certdata_rev.txt
   23 	https://stygian.me/crux/distfiles/mozilla-rootcerts-$pkgsrc_quarter.sh
   24 	https://stygian.me/crux/distfiles/$name-boot-$boot_version-bin.tar.xz)
   25 	# See README for links to originally named files and rationale of renaming/versioning/mirroring.
   26 
   27 unpack_source() {
   28 	for file in ${source[@]}; do
   29 		case ${file##*/} in
   30 			icedtea-$icedtea_version.tar.xz|\
   31 			$name-boot-$boot_version-bin.tar.xz)
   32 				bsdtar -p -o -C $SRC -xf $(get_filename $file) ;;
   33 			*)
   34 				cp $(get_filename $file) $SRC ;;
   35 		esac
   36 	done
   37 }
   38 
   39 build() {
   40 	# Most of these flags were snarfed directly from Alpine Linux APKBUILD for openjdk7, added -fabi-version.
   41 	# Fixes build failures due to suspected gcc8 changes for default std and abi.
   42 	export EXTRA_CPP_FLAGS="$CXXFLAGS -fabi-version=10 -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
   43 	export EXTRA_CFLAGS="$CFLAGS -fabi-version=10 -std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
   44 
   45 	# Make sure we do not have ccache masquerade directory in PATH.
   46 	# Use --enable-ccache instead of providing a wrapped compiler.
   47 	# NOTE: the check for usr/bin/ccache may be too specific, since it rules out
   48 	#       local or opt installs.
   49 	if [ -e '/usr/bin/ccache' ]; then
   50 		EXTRA_OPTIONS='--enable-ccache'
   51 		PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')
   52 	fi
   53 
   54 	OLD_PATH=$PATH
   55 	export JAVA_HOME=$SRC/$name-boot
   56 	export PATH=$JAVA_HOME/bin:$OLD_PATH
   57 
   58 	mkdir $SRC/build
   59 	cd $SRC/build
   60 
   61 	LC_ALL=C \
   62 	CONFIG_SHELL=/bin/bash \
   63 	../icedtea-$icedtea_version/configure ${EXTRA_OPTIONS} \
   64 		--prefix=/usr/lib/java/$name \
   65 		--disable-docs \
   66 		--disable-downloading \
   67 		--disable-hotspot-tests \
   68 		--disable-jdk-tests \
   69 		--disable-langtools-tests \
   70 		--disable-precompiled-headers \
   71 		--disable-system-pcsc \
   72 		--disable-system-sctp \
   73 		--disable-systemtap-tests \
   74 		--disable-tests \
   75 		--enable-improved-font-rendering \
   76 		--enable-non-nss-curves \
   77 		--enable-nss \
   78 		--enable-sunec \
   79 		--enable-system-jpeg \
   80 		--enable-system-kerberos \
   81 		--enable-system-lcms \
   82 		--enable-system-png \
   83 		--enable-system-zlib \
   84 		--with-corba-src-zip=$SRC/corba-$version.tar.xz \
   85 		--with-hotspot-src-zip=$SRC/hotspot-$version.tar.xz \
   86 		--with-jaxp-src-zip=$SRC/jaxp-$version.tar.xz \
   87 		--with-jaxws-src-zip=$SRC/jaxws-$version.tar.xz \
   88 		--with-jdk-src-zip=$SRC/jdk-$version.tar.xz \
   89 		--with-langtools-src-zip=$SRC/langtools-$version.tar.xz \
   90 		--with-nashorn-src-zip=$SRC/nashorn-$version.tar.xz \
   91 		--with-openjdk-src-zip=$SRC/openjdk-$version.tar.xz \
   92 		--with-pkgversion=CRUX \
   93 		--with-jdk-home=$JAVA_HOME
   94 
   95 	LC_ALL=C \
   96 	make
   97 
   98 	# Copy the sdk image first before pruning it, saving original for later inspection/comparison.
   99 	install -d -m 0755 $PKG/usr/lib/java/$name
  100 	cp -a openjdk.build/images/j2sdk-image/* $PKG/usr/lib/java/$name
  101 
  102 	install -d -m 0755 $PKG/etc/revdep.d
  103 	echo "/usr/lib/java/$name/jre/lib/amd64" > $PKG/etc/revdep.d/$name
  104 	echo "/usr/lib/java/$name/jre/lib/amd64/jli" >> $PKG/etc/revdep.d/$name
  105 	echo "/usr/lib/java/$name/jre/lib/amd64/server" >> $PKG/etc/revdep.d/$name
  106 
  107 	# Remove unneeded files
  108 	rm -f $PKG/usr/lib/java/$name/src.zip
  109 	rm -rf $PKG/usr/lib/java/$name/{demo,man/ja*,sample}
  110 	rm -f $PKG/usr/lib/java/$name/{,jre/}THIRD_PARTY_README
  111 	find $PKG/usr/lib/java/$name \( \
  112 		-name '*.ja' -o \
  113 		-name 'ASSEMBLY_EXCEPTION' -o \
  114 		-name 'LICENSE' -o \
  115 		-name 'THIRD_PARTY_README' \) \
  116 		-delete
  117 
  118 	# Deduplicate
  119 	rm $PKG/usr/lib/java/$name/jre/lib/amd64/libjawt.so
  120 	ln -sr $PKG/usr/lib/java/$name/lib/amd64/libjawt.so \
  121 		$PKG/usr/lib/java/$name/jre/lib/amd64/libjawt.so
  122 	rm $PKG/usr/lib/java/$name/jre/lib/amd64/jli/libjli.so
  123 	ln -sr $PKG/usr/lib/java/$name/lib/amd64/jli/libjli.so \
  124 		$PKG/usr/lib/java/$name/jre/lib/amd64/jli/libjli.so
  125 	for f in $PKG/usr/lib/java/$name/jre/bin/* ; do
  126 		if [ -f $PKG/usr/lib/java/$name/bin/${f##*/} ]; then
  127 			rm $f
  128 			ln -sr $PKG/usr/lib/java/$name/bin/${f##*/} $f
  129 		fi
  130 	done
  131 
  132 	sed -e "/# cd \/etc\/openssl\/certs/s//# cd \/usr\/share\/$name\/certs/" \
  133 		-e '/@AWK@/s,,/usr/bin/awk,' \
  134 		-e "/@DATADIR@/s,,/usr/share/$name," \
  135 		-e '/@ECHO@/s,,/bin/echo,' \
  136 		-e '/@EXPR@/s,,/usr/bin/expr,' \
  137 		-e '/@LN@/s,,/bin/ln,' \
  138 		-e '/@LS@/s,,/bin/ls,' \
  139 		-e '/@MKDIR@/s,,/bin/mkdir,' \
  140 		-e '/@OPENSSL@/s,,/usr/bin/openssl,' \
  141 		-e '/@PREFIX@/s,,/usr,' \
  142 		-e "/@SSLDIR@/s,,/usr/share/$name," \
  143 		-e '/@RM@/s,,/bin/rm,' \
  144 		-e 's,self extract,self -f $certfile extract,' \
  145 		-e 's,self rehash,self -f $certfile rehash,' \
  146 		$SRC/mozilla-rootcerts-$pkgsrc_quarter.sh > $SRC/mozilla-rootcerts
  147 
  148 	export JAVA_HOME=$PKG/usr/lib/java/$name
  149 	export PATH=$JAVA_HOME/bin:$OLD_PATH
  150 
  151 	# Generate java's cacerts.
  152 	# Big thanks to pkgsrc's mozilla-rootcerts and openjdk pkg's for this part.
  153 	rm -f $PKG/usr/lib/java/$name/jre/lib/security/cacerts
  154 	mkdir $SRC/cacerts
  155 	cd $SRC/cacerts
  156 	sh $SRC/mozilla-rootcerts -f $SRC/certdata-$certdata_rev.txt extract
  157 	for cert in *.pem; do
  158 		keytool \
  159 			-noprompt \
  160 			-importcert \
  161 			-keystore $PKG/usr/lib/java/$name/jre/lib/security/cacerts \
  162 			-alias $(echo $cert | sed 's,.*/\([^/]*\)\.pem,\1,') \
  163 			-file $cert \
  164 			-storepass changeit
  165 	done
  166 }

Generated by cgit