contrib/openjdk8/Pkgfile

141 lines
5.3 KiB
Plaintext

# Description: OpenJDK 8 built using IcedTea build harness
# URL: https://icedtea.classpath.org
# Maintainer: Tim Biermann, tbier at posteo dot de
# Co-Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: alsa-lib cups giflib gtk3 lcms2 libxslt nss p11-kit unzip xorg-libxcomposite xorg-libxinerama xorg-libxt zip
# Optional: krb5
name=openjdk8
version=8u292-b10
_icedtea_version=3.19.0
_boot_version=20210620
release=1
source=(http://icedtea.wildebeest.org/download/source/icedtea-$_icedtea_version.tar.xz
https://crux.ster.zone/downloads/java/corba-$version.tar.xz
https://crux.ster.zone/downloads/java/hotspot-$version.tar.xz
https://crux.ster.zone/downloads/java/jaxp-$version.tar.xz
https://crux.ster.zone/downloads/java/jaxws-$version.tar.xz
https://crux.ster.zone/downloads/java/jdk-$version.tar.xz
https://crux.ster.zone/downloads/java/langtools-$version.tar.xz
https://crux.ster.zone/downloads/java/nashorn-$version.tar.xz
https://crux.ster.zone/downloads/java/openjdk-$version.tar.xz
https://crux.ster.zone/downloads/java/openjdk8_boot-$_boot_version.tar.xz)
# See README for links to originally named files and rationale of renaming/versioning/mirroring.
unpack_source() {
for file in ${source[@]}; do
case ${file##*/} in
icedtea-$_icedtea_version.tar.xz|\
openjdk8_boot-$_boot_version.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"
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
# local or opt installs.
if [ -e '/usr/bin/ccache' ]; then
EXTRA_OPTIONS+='--enable-ccache'
PATH=$(echo ${PATH} | awk -v RS=: -v ORS=: '/ccache/ {next} {print}' | sed 's/:*$//')
fi
unset JAVA_HOME
OLD_PATH=$PATH
export JAVA_HOME=$SRC/$name-boot
export PATH=$JAVA_HOME/bin:$OLD_PATH
if [ -f /etc/pki/tls/java/cacerts ]; then
JAVA_CACERTS=/etc/pki/tls/java/cacerts
else
/usr/sbin/make-ca -g -D $SRC/certs || exit 1
JAVA_CACERTS=$SRC/certs/etc/pki/tls/java/cacerts
fi
mkdir $SRC/build
cd $SRC/build
prt-get isinst krb5 && EXTRA_OPTIONS+=' --enable-system-kerberos' || EXTRA_OPTIONS+=' --disable-system-kerberos'
# Will fail if make-ca has not been run after p11-kit install
LC_ALL=C \
CONFIG_SHELL=/bin/bash \
../icedtea-$_icedtea_version/configure ${EXTRA_OPTIONS} \
--prefix=/usr/lib/java/$name \
--disable-docs \
--disable-downloading \
--disable-hotspot-tests \
--disable-jdk-tests \
--disable-langtools-tests \
--disable-precompiled-headers \
--disable-system-pcsc \
--disable-system-sctp \
--disable-systemtap-tests \
--disable-tests \
--enable-improved-font-rendering \
--enable-nss \
--enable-system-jpeg \
--enable-system-lcms \
--enable-system-png \
--enable-system-zlib \
--with-corba-src-zip=$SRC/corba-$version.tar.xz \
--with-hotspot-src-zip=$SRC/hotspot-$version.tar.xz \
--with-jaxp-src-zip=$SRC/jaxp-$version.tar.xz \
--with-jaxws-src-zip=$SRC/jaxws-$version.tar.xz \
--with-jdk-src-zip=$SRC/jdk-$version.tar.xz \
--with-langtools-src-zip=$SRC/langtools-$version.tar.xz \
--with-nashorn-src-zip=$SRC/nashorn-$version.tar.xz \
--with-openjdk-src-zip=$SRC/openjdk-$version.tar.xz \
--with-pkgversion=CRUX \
--with-jdk-home=$JAVA_HOME \
--with-cacerts-file=$JAVA_CACERTS \
--with-tzdata-dir=/usr/share/zoneinfo
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
install -d -m 0755 $PKG/etc/revdep.d
echo "/usr/lib/java/$name/jre/lib/amd64" > $PKG/etc/revdep.d/$name
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
rm -f $PKG/usr/lib/java/$name/src.zip
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' -o \
-name 'ASSEMBLY_EXCEPTION' -o \
-name 'LICENSE' -o \
-name 'THIRD_PARTY_README' \) \
-delete
# Deduplicate
rm $PKG/usr/lib/java/$name/jre/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 -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 -sr $PKG/usr/lib/java/$name/bin/${f##*/} $f
fi
done
chmod u+w $PKG/usr/lib/java/$name/jre/lib/security/cacerts
}