java-scratchspace/openjdk6-boot/Pkgfile

163 lines
5.1 KiB
Plaintext

# Description: OpenJDK 6, bootstrap build for building OpenJDK 7
# URL: http://openjdk.java.net/projects/jdk6
# Maintainer: John Vogel, jvogel4 at stny dot rr dot com
# Depends on: alsa-lib cups freetype giflib java-init krb5 lcms2 libjpeg-turbo libpng libxslt nss xorg-libxcomposite xorg-libxinerama xorg-libxrender xorg-libxtst xorg-libxt
name=openjdk6-boot
version=20190705
openjdk_version=b41
openjdk_date=04_jan_2017
icedtea_version=1.13.13
release=1
source=(http://icedtea.wildebeest.org/download/source/icedtea6-$icedtea_version.tar.gz
https://crux.ster.zone/distfiles/openjdk-6-src-b41-04_jan_2017.tar.xz
fix-sysctl-include.patch icedtea6-all-source-level-1_6.patch
fix-freetype-version-detect.patch)
unpack_source() {
for file in ${source[@]}; do
case ${file##*/} in
icedtea6-$icedtea_version.tar.gz|\
openjdk-6-src-b41-04_jan_2017.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 CXXFLAGS+=' -fabi-version=10 -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow -fcommon -fpermissive -Wmaybe-uninitialized'
export CFLAGS+=' -fabi-version=10 -std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow -fcommon -fpermissive -Wmaybe-uninitialized'
export CPPFLAGS="$CFLAGS"
OLD_PATH=$PATH
export JAVA_HOME=$SRC/openjdk6-boot
export PATH=$JAVA_HOME/bin:$OLD_PATH
# Fix ups for java-init tools, which don't handle ambiguity well.
cp $SRC/icedtea6-all-source-level-1_6.patch $SRC/icedtea6-$icedtea_version/patches/
# Fix freetype version detection.
cp $SRC/fix-freetype-version-detect.patch $SRC/icedtea6-$icedtea_version/patches/
cp $SRC/fix-sysctl-include.patch $SRC/icedtea6-$icedtea_version/patches/
export DISTRIBUTION_PATCHES="patches/icedtea6-all-source-level-1_6.patch patches/fix-freetype-version-detect.patch patches/fix-sysctl-include.patch"
mkdir $SRC/build-boot
cd $SRC/build-boot
LC_ALL=C \
ALT_UNIXCOMMAND_PATH="" \
JAVAC=$JAVA_HOME/bin/ecj \
CONFIG_SHELL=/bin/bash \
../icedtea6-$icedtea_version/configure \
--prefix=$SRC/build-boot/openjdk.build/j2sdk-image \
--disable-docs \
--disable-downloading \
--disable-systemtap \
--disable-tests \
--disable-hotspot-tests \
--disable-langtools-tests \
--disable-jdk-tests \
--enable-system-kerberos \
--enable-system-gif \
--enable-system-jpeg \
--enable-system-png \
--enable-system-zlib \
--enable-nss \
--enable-non-nss-curves \
--with-openjdk-src-zip=$SRC/openjdk-6-src-b41-04_jan_2017.tar.xz \
--with-pkgversion=CRUX \
--without-rhino \
--with-jdk-home=$JAVA_HOME \
--with-ant-home=$JAVA_HOME/lib/ant \
--with-abs-install-dir=/$name \
--with-ecj-jar=$JAVA_HOME/share/java/ecj.jar \
--with-jar=/usr/bin/fastjar \
--with-java=$JAVA_HOME/bin/jamvm \
--with-javah=$JAVA_HOME/bin/javah \
--with-rmic=$JAVA_HOME/bin/rmic \
--with-ecj \
--without-gcj
LC_ALL=C ALT_UNIXCOMMAND_PATH="" DISABLE_HOTSPOT_OS_VERSION_CHECK="ok" make
# rebuild using our fresh openjdk6
export JAVA_HOME=$SRC/build-boot/openjdk.build/j2sdk-image
export PATH=$JAVA_HOME/bin:/opt/java-init/lib/ant/bin:$OLD_PATH
mkdir $SRC/build
cd $SRC/build
LC_ALL=C \
ALT_UNIXCOMMAND_PATH="" \
CONFIG_SHELL=/bin/bash \
../icedtea6-$icedtea_version/configure \
--prefix=/$name \
--disable-docs \
--disable-downloading \
--disable-systemtap \
--disable-tests \
--disable-hotspot-tests \
--disable-langtools-tests \
--disable-jdk-tests \
--disable-xrender \
--enable-system-gif \
--enable-system-jpeg \
--enable-system-kerberos \
--enable-system-lcms \
--enable-system-png \
--enable-system-zlib \
--enable-nss \
--enable-non-nss-curves \
--with-openjdk-src-zip=$SRC/openjdk-6-src-$openjdk_version-$openjdk_date.tar.xz \
--with-pkgversion=CRUX \
--without-rhino \
--with-javac \
--with-jdk-home=$JAVA_HOME \
--with-ant-home=/opt/java-init/lib/ant \
--with-abs-install-dir=/$name
LC_ALL=C \
ALT_UNIXCOMMAND_PATH="" \
DISABLE_HOTSPOT_OS_VERSION_CHECK="ok" \
make
# Copy the sdk image first before pruning it, saving original for later inspection/comparison.
mkdir -p $PKG/$name
cp -a 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}}
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' \) \
-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/jli/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 -f $PKG/$name/jre/lib/security/cacerts
ln -s /etc/ssl/cert.pem $PKG/$name/jre/lib/security/cacerts
rm $PKG/$name/{,jre/}THIRD_PARTY_README
}