From 99074f2b7925f9550c6274010563a218528084f2 Mon Sep 17 00:00:00 2001 From: Tim Biermann Date: Sat, 9 Sep 2023 12:42:27 +0200 Subject: [PATCH] openjdk6: some cleanups --- openjdk6-boot/Pkgfile | 285 +++++++++++++++++++++++------------------- 1 file changed, 153 insertions(+), 132 deletions(-) diff --git a/openjdk6-boot/Pkgfile b/openjdk6-boot/Pkgfile index 8a4b0ac..378d0c7 100644 --- a/openjdk6-boot/Pkgfile +++ b/openjdk6-boot/Pkgfile @@ -1,7 +1,12 @@ # 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 +# URL: http://openjdk.java.net/projects/jdk6 +# Maintainer: +# Depends on: alsa-lib cups freetype giflib java-init krb5 libjpeg-turbo libpng libxslt nss xorg-libxcomposite xorg-libxinerama xorg-libxrender xorg-libxt xorg-libxtst wget + +# TODO: +# - https://git.launchpad.net/ubuntu/+source/openjdk-6/tree/debian/patches?h=applied/debian/experimental +# - https://git.launchpad.net/ubuntu/+source/openjdk-6/tree/patches?h=applied/debian/experimental +# take what is useful, maybe a few of the gcc related patches etc name=openjdk6-boot version=20190705 @@ -10,153 +15,169 @@ 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) + https://ponce.cc/slackware/sources/repo/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 + ld-symbolic-functions.diff + pr2849.patch + pr2808.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 + for file in ${source[@]}; do + case ${file##*/} in + icedtea6-$icedtea_version.tar.gz) + 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" + # 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" + #export LDFLAGS+=" -Xlinker -z -Xlinker defs -Wl,-Bsymbolic-functions" - OLD_PATH=$PATH - export JAVA_HOME=$SRC/openjdk6-boot - export PATH=$JAVA_HOME/bin:$OLD_PATH + OLD_PATH=$PATH + export JAVA_HOME=/opt/java-init + 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" + # Fix ups for java-init tools, which don't handle ambiguity well. + for i in icedtea6-all-source-level-1_6.patch fix-freetype-version-detect.patch fix-sysctl-include.patch; do + cp -v $SRC/${i} $SRC/icedtea6-$icedtea_version/patches/. + done + #patches/linker-libs-order.patch patches/linker-libs-order-zlib.patch patches/gcc-no-hardening.diff patches/gcc-opt-O2.diff + 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 + #patch -Np1 -d icedtea6-$icedtea_version -i $SRC/pr2849.patch + #patch -Np1 -d icedtea6-$icedtea_version -i $SRC/pr2808.patch - 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 + #cd icedtea6-$icedtea_version + #autoreconf -fvi + #cd $SRC - LC_ALL=C ALT_UNIXCOMMAND_PATH="" DISABLE_HOTSPOT_OS_VERSION_CHECK="ok" make + mkdir $SRC/build-boot + cd $SRC/build-boot - # 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 + 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 \ + --enable-system-kerberos \ + --enable-system-gif \ + --enable-system-jpeg \ + --enable-system-png \ + --enable-system-zlib \ + --disable-nss \ + --with-openjdk-src-zip=$SRC/openjdk-6-src-b41-04_jan_2017.tar.xz \ + --with-pkgversion=CRUX \ + --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 \ + --disable-docs \ + --disable-downloading \ + --disable-xrender \ + --disable-lcms2 \ + --disable-systemtap \ + --disable-tests \ + --disable-hotspot-tests \ + --disable-langtools-tests \ + --disable-jdk-tests \ + --without-rhino \ + --with-ecj \ + --without-gcj + LC_ALL=C \ + ALT_UNIXCOMMAND_PATH="" \ + DISABLE_HOTSPOT_OS_VERSION_CHECK="ok" \ + make || echo "First make failed" - mkdir $SRC/build - cd $SRC/build + # rebuild using our fresh openjdk6 + unset JAVA_HOME + export JAVA_HOME=$SRC/build-boot/openjdk.build/j2sdk-image + export PATH=$JAVA_HOME/bin:/opt/java-init/lib/ant/bin:$OLD_PATH - 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 + mkdir $SRC/build + cd $SRC/build - LC_ALL=C \ - ALT_UNIXCOMMAND_PATH="" \ - DISABLE_HOTSPOT_OS_VERSION_CHECK="ok" \ - make + 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 \ + --disable-lcms2 \ + --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 - # 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 + LC_ALL=C \ + ALT_UNIXCOMMAND_PATH="" \ + DISABLE_HOTSPOT_OS_VERSION_CHECK="ok" \ + make || echo "Second make failed" - # 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 + # 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 - # 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 + # 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 - # 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 + # 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 - rm $PKG/$name/{,jre/}THIRD_PARTY_README + # 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 }