java-scratchspace/openjdk7-boot/Pkgfile

198 lines
7.2 KiB
Plaintext

# Description: OpenJDK 7, bootstrap build for building OpenJDK 8
# URL: https://openjdk.java.net/projects/jdk7
# Maintainer:
# Depends on: alsa-lib cups fontconfig freetype giflib gtk krb5 lcms2 libjpeg-turbo libpng libxslt nss unzip xorg-libxt xorg-libxtst xorg-libxinerama zip
name=openjdk7-boot
version=7u281-b01
icedtea_version=2.6.24
ant_version=1.9.14
boot_version=20190705
release=1
source=(http://icedtea.wildebeest.org/download/source/icedtea-$icedtea_version.tar.xz
https://crux.ster.zone/downloads/java/corba-$version.tar.bz2
https://crux.ster.zone/downloads/java/hotspot-$version.tar.bz2
https://crux.ster.zone/downloads/java/jaxp-$version.tar.bz2
https://crux.ster.zone/downloads/java/jaxws-$version.tar.bz2
https://crux.ster.zone/downloads/java/jdk-$version.tar.bz2
https://crux.ster.zone/downloads/java/langtools-$version.tar.bz2
https://crux.ster.zone/downloads/java/openjdk-$version.tar.bz2
https://crux.ster.zone/distfiles/openjdk6-boot-20180616-bin.tar.xz
https://archive.apache.org/dist/ant/binaries/apache-ant-$ant_version-bin.tar.bz2
fix-sysctl-include.patch jdk-use-sys_xattr_header.patch)
unpack_source() {
for file in ${source[@]}; do
case ${file##*/} in
icedtea-$icedtea_version.tar.xz|\
apache-ant-$ant_version-bin.tar.bz2|\
openjdk6-boot-20180616-bin.tar.xz)
bsdtar -p -o -C $SRC -xf $(get_filename $file) ;;
*)
cp $(get_filename $file) $SRC ;;
esac
done
}
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 -fcommon"
export EXTRA_CFLAGS="$CFLAGS -fabi-version=10 -std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow -fcommon"
OLD_PATH=$PATH
unset JAVA_HOME
export JAVA_HOME=$SRC/openjdk6-boot
export PATH=$JAVA_HOME/bin:$SRC/apache-ant-$ant_version/bin:$OLD_PATH
# Fix checking for attr/xattr.h header from old attr package. Use system header since
# they are looking to use the syscall wrappers anyways and those are part of libc.
sed -i -e 's,attr/xattr,sys/xattr,' $SRC/icedtea-$icedtea_version/configure
mv $SRC/jdk-use-sys_xattr_header.patch $SRC/icedtea-$icedtea_version/patches
mv $SRC/fix-sysctl-include.patch $SRC/icedtea-$icedtea_version/patches
export DISTRIBUTION_PATCHES="patches/jdk-use-sys_xattr_header.patch patches/fix-sysctl-include.patch"
mkdir $SRC/build-boot
cd $SRC/build-boot
LC_ALL=C \
ALT_UNIXCOMMAND_PATH="" \
CONFIG_SHELL=/bin/bash \
../icedtea-$icedtea_version/configure \
--prefix=$SRC/build-boot/openjdk.build/j2sdk-image \
--disable-bootstrap \
--disable-docs \
--disable-downloading \
--disable-hotspot-tests \
--disable-jdk-tests \
--disable-langtools-tests \
--disable-system-pcsc \
--disable-system-sctp \
--disable-systemtap-tests \
--disable-tests \
--enable-system-cups \
--enable-system-fontconfig \
--enable-system-gif \
--enable-system-gio \
--enable-system-gtk \
--enable-system-jpeg \
--enable-system-kerberos \
--enable-system-lcms \
--enable-system-png \
--enable-system-zlib \
--enable-non-nss-curves \
--enable-nss \
--with-corba-src-zip=$SRC/corba-$version.tar.bz2 \
--with-hotspot-src-zip=$SRC/hotspot-$version.tar.bz2 \
--with-jaxp-src-zip=$SRC/jaxp-$version.tar.bz2 \
--with-jaxws-src-zip=$SRC/jaxws-$version.tar.bz2 \
--with-jdk-src-zip=$SRC/jdk-$version.tar.bz2 \
--with-langtools-src-zip=$SRC/langtools-$version.tar.bz2 \
--with-openjdk-src-zip=$SRC/openjdk-$version.tar.bz2 \
--with-pkgversion=CRUX \
--with-jdk-home=$JAVA_HOME \
--with-cacerts-file=/etc/ssl/cert.pem \
--with-tzdata-dir=/usr/share/zoneinfo \
--without-rhino
#--with-openjdk-checksum=e14e3af1067dccd769b04c8058094b52e40719fd75e86e12dcf3124137895433 \
#--with-hotspot-checksum=3a8e437eb08a54d127b146db368c3b7e7a25d396c12f3fcfa2d4f3746218e120 \
#--with-corba-checksum=39ee6427b4149047b3211b832011bff483f7c28afce239977490ae4d8cf309bf \
#--with-jaxp-checksum=9643c6e8689a80819bea8c5e6d663bbdadd7d6b8736bbc15258332f8ce308f1f \
#--with-jaxws-checksum=2998e55c634f28d1a4113d3bf98d7844c501927fba6b3cdf5f72a924502907b5 \
#--with-jdk-checksum=4db278a3c8ec480b2ce5e68d2675f64090bb12050c4ab87b223bc39cd9a32d4f \
#--with-langtools-checksum=b0ca1c8866682872d24b3ff55c97ddb1780a28d421fb961264014d3402773c1e \
LC_ALL=C \
ALT_UNIXCOMMAND_PATH="" \
make
# Rebuild with our new openjdk7
export JAVA_HOME=$SRC/build-boot/openjdk.build/j2sdk-image
export PATH=$JAVA_HOME/bin:$SRC/apache-ant-$ant_version/bin:$OLD_PATH \
mkdir $SRC/build
cd $SRC/build
#--enable-sunec
#--enable-non-nss-curves
LC_ALL=C \
ALT_UNIXCOMMAND_PATH="" \
CONFIG_SHELL=/bin/bash \
../icedtea-$icedtea_version/configure \
--prefix=/$name \
--disable-bootstrap \
--disable-docs \
--disable-downloading \
--disable-hotspot-tests \
--disable-jdk-tests \
--disable-langtools-tests \
--disable-system-pcsc \
--disable-system-sctp \
--disable-systemtap-tests \
--disable-tests \
--enable-non-nss-curves \
--enable-nss \
--enable-system-cups \
--enable-system-fontconfig \
--enable-system-gif \
--enable-system-gio \
--enable-system-gtk \
--enable-system-jpeg \
--enable-system-kerberos \
--enable-system-lcms \
--enable-system-png \
--enable-system-zlib \
--with-corba-src-zip=$SRC/corba-$version.tar.bz2 \
--with-hotspot-src-zip=$SRC/hotspot-$version.tar.bz2 \
--with-jaxp-src-zip=$SRC/jaxp-$version.tar.bz2 \
--with-jaxws-src-zip=$SRC/jaxws-$version.tar.bz2 \
--with-jdk-src-zip=$SRC/jdk-$version.tar.bz2 \
--with-langtools-src-zip=$SRC/langtools-$version.tar.bz2 \
--with-openjdk-src-zip=$SRC/openjdk-$version.tar.bz2 \
--with-pkgversion=CRUX \
--with-jdk-home=$JAVA_HOME \
--with-cacerts-file=/etc/ssl/cert.pem \
--with-tzdata-dir=/usr/share/zoneinfo \
--without-rhino
LC_ALL=C \
ALT_UNIXCOMMAND_PATH="" \
make
# Copy the sdk image first before pruning it, saving original for later inspection/comparison.
mkdir -p $PKG/$name
cp -r openjdk.build/j2sdk-image/* $PKG/$name
# Remove unneeded files
rm -f $PKG/$name/src.zip
rm -rf $PKG/$name/{demo,man,sample,jre/lib/{images,zi}}
rm -f $PKG/$name/{,jre/}/THIRD_PARTY_README
find $PKG/$name \( \
-name '*.ja' -o \
-name '*.txt' -o \
-name '*.old' -o \
-name '*.properties' -o \
-name '*.template' -o \
-name 'fontconfig.*' -o \
-name 'ASSEMBLY_EXCEPTION' -o \
-name 'LICENSE' -o \
-name 'THIRD_PARTY_README' \) \
-delete
# Deduplicate
rm $PKG/$name/jre/lib/amd64/jli/libjli.so
ln -sr $PKG/$name/lib/amd64/jli/libjli.so \
$PKG/$name/jre/lib/amd64/libjli.so
for f in $PKG/$name/jre/bin/* ; do
if [ -f $PKG/$name/bin/${f##*/} ]; then
rm $f
ln -sr $PKG/$name/bin/${f##*/} $f
fi
done
# Link to CRUX ca-certificates
rm -r $PKG/$name/jre/lib/security/cacerts
ln -s /etc/ssl/cert.pem $PKG/$name/jre/lib/security/cacerts
}