void-packages/srcpkgs/openjdk8/template
q66 6783ab9f47 openjdk: update to 8u232b09, rename to openjdk8, native bootstrap
This updates OpenJDK 8 to a newer version and brings a bunch of
changes.

Newly, it is bootstrapped with openjdk7-bootstrap, so it does not
need to download binaries. It can also cross-compile and is patched
for musl and other platforms.

We're newly using the aarch64 port repo in order to get aarch64
JIT. For non-aarch64 platforms, the codebase is the same.

The symlink for /usr/lib/jvm/openjdk is also now gone and we're
using a unified java-VERSION-VENDOR naming.

Also general template cleanup.

[ci skip]
2019-11-24 16:33:30 -05:00

309 lines
11 KiB
Bash

# Template file for 'openjdk8'
# TODO: better places for bin and man?
# TODO: make -headless versions
# TODO: config files?
_java_ver=8
_jdk_update=232
_jdk_build=09
_main_ver=${_java_ver}u${_jdk_update}
_final_jdk_home="usr/lib/jvm/java-1.8-openjdk"
pkgname=openjdk8
version="${_java_ver}u${_jdk_update}b${_jdk_build}"
revision=1
# we're using aarch64 port repo to get aarch64 JIT; the repo is
# otherwise the same as the normal one, just with aarch64 port added
_repo_ver="aarch64-shenandoah-jdk${version/b/-b}"
wrksrc="jdk8u-shenandoah-aarch64-shenandoah-jdk8u${_jdk_update}-b${_jdk_build}"
build_style=gnu-configure
configure_args="
--prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
--with-update-version=${_jdk_update}
--with-build-number=b${_jdk_build}
--with-milestone=fcs
--enable-unlimited-crypto
--with-zlib=system
--with-giflib=system
--with-freetype-lib=${XBPS_CROSS_BASE}/usr/lib
--with-freetype-include=${XBPS_CROSS_BASE}/usr/include/freetype2
--with-jtreg=no
--with-jobs=${XBPS_MAKEJOBS}
--with-vendor-name="Void"
--with-vendor-url="https://voidlinux.org/"
--with-vendor-bug-url="https://github.com/void-linux/void-packages/issues"
--with-vendor-vm-bug-url="https://github.com/void-linux/void-packages/issues""
make_build_args="images $(vopt_if docs docs) COMPILER_WARNINGS_FATAL=false"
hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
zlib-devel make-ca"
makedepends="libXrender-devel libXtst-devel libXt-devel libXrandr-devel
giflib-devel cups-devel freetype-devel alsa-lib-devel fontconfig-devel
zlib-devel"
depends="openjdk8-jre-${version}_${revision}"
short_desc="OpenJDK Java Development Kit (version 8)"
maintainer="Toyam Cox <Vaelatern@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="http://openjdk.java.net/"
distfiles="
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/archive/${_repo_ver}.tar.gz>jdk8u-${_repo_ver}.tar.gz
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/corba/archive/${_repo_ver}.tar.gz>corba-${_repo_ver}.tar.gz
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/hotspot/archive/${_repo_ver}.tar.gz>hotspot-${_repo_ver}.tar.gz
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/jdk/archive/${_repo_ver}.tar.gz>jdk-${_repo_ver}.tar.gz
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/jaxws/archive/${_repo_ver}.tar.gz>jaxws-${_repo_ver}.tar.gz
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/jaxp/archive/${_repo_ver}.tar.gz>jaxp-${_repo_ver}.tar.gz
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/langtools/archive/${_repo_ver}.tar.gz>langtools-${_repo_ver}.tar.gz
http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/nashorn/archive/${_repo_ver}.tar.gz>nashorn-${_repo_ver}.tar.gz"
checksum="9c08eb72cb3f46e8b03d4c4ef186dccbecb823e4eef3003e61fd9631bab825ec
a8473d48ea87ee4213f24dfbf665bf5259ce31946ba128358666d11415a03c18
90a28984c1ae55ab18b8deab8c3459c47f03aaaac2d0fc50f36012b74007610d
98f75b028a07d0737c4d401ba1fd3ea7ecfbfe7fc914ff4fd218ac9e3ba5995e
3f8f8183c35b5343f10490cbecc477036c4032bda9584ce4e065a1d1ee877d3f
7426e95cde9dc816bd9d3ab44c8eea2a2dc97cb2e9905ec900d56b888e8b7def
376205b35a9d43e38808171b3be9e07c2211613f694c8be60af2e326905caab3
9cd16a9ed8feed26a485f6df296f4900cb6de6a70b50e5c6bb03198623d1773a"
build_options="docs"
desc_option_docs="Build documentation"
# no hotspot JIT for arm32 and ppc32
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
arm*|ppc*) _use_zero=yes ;;
esac
# specifically do not enable docs because with zero it takes hours
if [ -n "$_use_zero" ]; then
makedepends+=" libffi-devel"
configure_args+=" --with-jvm-variants=zero"
else
build_options_default+=" docs"
fi
provides="java-environment-${version}_1"
patch_args="-Np1"
if [ -n "$XBPS_DEBUG_PKGS" ]; then
configure_args+=" --with-native-debug-symbols=internal"
fi
if [ ! "$CROSS_BUILD" ]; then
hostmakedepends+=" openjdk7-bootstrap"
configure_args+=" --with-boot-jdk=/usr/lib/jvm/java-1.7-openjdk"
else
hostmakedepends+=" openjdk8"
configure_args+=" --with-boot-jdk=/${_final_jdk_home}"
fi
# enabling ccache segfaults gcc
export CCACHE_DISABLE=1
alternatives="
java:/usr/bin/java:/${_final_jdk_home}/bin/java
java:/usr/bin/jjs:/${_final_jdk_home}/bin/jjs
java:/usr/bin/keytool:/${_final_jdk_home}/bin/keytool
java:/usr/bin/orbd:/${_final_jdk_home}/bin/orbd
java:/usr/bin/pack200:/${_final_jdk_home}/bin/pack200
java:/usr/bin/policytool:/${_final_jdk_home}/bin/policytool
java:/usr/bin/rmid:/${_final_jdk_home}/bin/rmid
java:/usr/bin/rmiregistry:/${_final_jdk_home}/bin/rmiregistry
java:/usr/bin/servertool:/${_final_jdk_home}/bin/servertool
java:/usr/bin/tnameserv:/${_final_jdk_home}/bin/tnameserv
java:/usr/bin/unpack200:/${_final_jdk_home}/bin/unpack200
jdk:/usr/bin/appletviewer:/${_final_jdk_home}/bin/appletviewer
jdk:/usr/bin/extcheck:/${_final_jdk_home}/bin/extcheck
jdk:/usr/bin/idlj:/${_final_jdk_home}/bin/idlj
jdk:/usr/bin/jar:/${_final_jdk_home}/bin/jar
jdk:/usr/bin/jarsigner:/${_final_jdk_home}/bin/jarsigner
jdk:/usr/bin/java:/${_final_jdk_home}/bin/java
jdk:/usr/bin/java-rmi.cgi:/${_final_jdk_home}/bin/java-rmi.cgi
jdk:/usr/bin/javac:/${_final_jdk_home}/bin/javac
jdk:/usr/bin/javadoc:/${_final_jdk_home}/bin/javadoc
jdk:/usr/bin/javah:/${_final_jdk_home}/bin/javah
jdk:/usr/bin/javap:/${_final_jdk_home}/bin/javap
jdk:/usr/bin/jcmd:/${_final_jdk_home}/bin/jcmd
jdk:/usr/bin/jconsole:/${_final_jdk_home}/bin/jconsole
jdk:/usr/bin/jdb:/${_final_jdk_home}/bin/jdb
jdk:/usr/bin/jdeps:/${_final_jdk_home}/bin/jdeps
jdk:/usr/bin/jhat:/${_final_jdk_home}/bin/jhat
jdk:/usr/bin/jinfo:/${_final_jdk_home}/bin/jinfo
jdk:/usr/bin/jjs:/${_final_jdk_home}/bin/jjs
jdk:/usr/bin/jmap:/${_final_jdk_home}/bin/jmap
jdk:/usr/bin/jps:/${_final_jdk_home}/bin/jps
jdk:/usr/bin/jrunscript:/${_final_jdk_home}/bin/jrunscript
jdk:/usr/bin/jsadebugd:/${_final_jdk_home}/bin/jsadebugd
jdk:/usr/bin/jstack:/${_final_jdk_home}/bin/jstack
jdk:/usr/bin/jstat:/${_final_jdk_home}/bin/jstat
jdk:/usr/bin/jstatd:/${_final_jdk_home}/bin/jstatd
jdk:/usr/bin/keytool:/${_final_jdk_home}/bin/keytool
jdk:/usr/bin/native2ascii:/${_final_jdk_home}/bin/native2ascii
jdk:/usr/bin/orbd:/${_final_jdk_home}/bin/orbd
jdk:/usr/bin/pack200:/${_final_jdk_home}/bin/pack200
jdk:/usr/bin/policytool:/${_final_jdk_home}/bin/policytool
jdk:/usr/bin/rmic:/${_final_jdk_home}/bin/rmic
jdk:/usr/bin/rmid:/${_final_jdk_home}/bin/rmid
jdk:/usr/bin/rmiregistry:/${_final_jdk_home}/bin/rmiregistry
jdk:/usr/bin/schemagen:/${_final_jdk_home}/bin/schemagen
jdk:/usr/bin/serialver:/${_final_jdk_home}/bin/serialver
jdk:/usr/bin/servertool:/${_final_jdk_home}/bin/servertool
jdk:/usr/bin/tnameserv:/${_final_jdk_home}/bin/tnameserv
jdk:/usr/bin/unpack200:/${_final_jdk_home}/bin/unpack200
jdk:/usr/bin/wsgen:/${_final_jdk_home}/bin/wsgen
jdk:/usr/bin/wsimport:/${_final_jdk_home}/bin/wsimport
jdk:/usr/bin/xjc:/${_final_jdk_home}/bin/xjc
"
post_extract() {
chmod +x configure
for subrepo in corba hotspot jdk jaxws jaxp langtools nashorn; do
mv ../${subrepo}-${_repo_ver} ${subrepo}
done
# gcc complains about the signed shift left
vsed -i jdk/src/share/native/com/sun/java/util/jar/pack/constants.h \
-e's;(-1)<<13;~0u<<13;g'
# wrong "return false;" instead of "return null;"
vsed -i jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp \
-e"295s;false;null;"
}
post_patch() {
[ "$XBPS_TARGET_LIBC" != "musl" ] && return 0
for f in ${FILESDIR}/musl_*.patch; do
echo "Applying $f"
patch -sNp1 -i "$f"
done
# add cross prefix for thread_db.h check, fix cross from glibc to musl
sed -i "s,/usr/include/thread_db.h,${XBPS_CROSS_BASE}/usr/include/thread_db.h," \
hotspot/make/linux/makefiles/defs.make hotspot/make/linux/makefiles/sa.make \
hotspot/make/linux/makefiles/saproc.make
}
do_configure() {
CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/}
CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2/}
# force ELFv2 for ppc64 just in case
case "$XBPS_TARGET_MACHINE" in
ppc64*)
CFLAGS+=" -DABI_ELFv2"
CXXFLAGS+=" -DABI_ELFv2"
;;
esac
configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
./configure ${configure_args} --with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CXXFLAGS" --with-extra-ldflags="$LDFLAGS"
}
pre_build() {
# only use modified flags as specified in configure
unset CFLAGS CXXFLAGS LDFLAGS
}
do_build() {
# do not set disable_parallel_build in order to be able to read makejobs
make -j1 ${make_build_args} ${make_build_target}
}
post_install() {
# we manage this ourselves
rm -rf ${DESTDIR}/usr/lib/bin
# unify the install prefix
mv ${DESTDIR}/usr/lib/jvm/openjdk-1.8.0_${_jdk_update} \
${DESTDIR}/${_final_jdk_home}
vmkdir ${_final_jdk_home}/lib/security
make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/${_final_jdk_home}/bin/keytool"
mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/${_final_jdk_home}/lib/security/
chmod -R ugo+rw ./ca
rm -Rf ./ca
vlicense ASSEMBLY_EXCEPTION
vlicense LICENSE
vlicense THIRD_PARTY_README
}
openjdk8-jre_package() {
shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
short_desc+=" - runtime components"
provides="java-runtime-${version}_1"
alternatives="
java:/usr/bin/java:/${_final_jdk_home}/jre/bin/java
java:/usr/bin/jjs:/${_final_jdk_home}/jre/bin/jjs
java:/usr/bin/keytool:/${_final_jdk_home}/jre/bin/keytool
java:/usr/bin/orbd:/${_final_jdk_home}/jre/bin/orbd
java:/usr/bin/pack200:/${_final_jdk_home}/jre/bin/pack200
java:/usr/bin/policytool:/${_final_jdk_home}/jre/bin/policytool
java:/usr/bin/rmid:/${_final_jdk_home}/jre/bin/rmid
java:/usr/bin/rmiregistry:/${_final_jdk_home}/jre/bin/rmiregistry
java:/usr/bin/servertool:/${_final_jdk_home}/jre/bin/servertool
java:/usr/bin/tnameserv:/${_final_jdk_home}/jre/bin/tnameserv
java:/usr/bin/unpack200:/${_final_jdk_home}/jre/bin/unpack200
"
pkg_install() {
vmove ${_final_jdk_home}/jre
vmkdir etc/profile.d
cat >>${PKGDESTDIR}/etc/profile.d/10_openjdk8.sh <<EOF
export JAVA_HOME=\${JAVA_HOME=/${_final_jdk_home}/jre}
EOF
}
}
openjdk8-src_package() {
nostrip=yes
noverifyrdeps=yes
noshlibprovides=yes
short_desc+=" - source code"
pkg_install() {
vmove ${_final_jdk_home}/src.zip
}
}
openjdk8-doc_package() {
nostrip=yes
noverifyrdeps=yes
noshlibprovides=yes
short_desc+=" - documentation"
pkg_install() {
cd ${wrksrc}
if [ "$build_option_docs" ]; then
vmkdir usr/share/doc/openjdk8
cp -a build/linux-*/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk8
fi
vmove ${_final_jdk_home}/man/man1
}
}
openjdk_package() {
archs=noarch
build_style=meta
depends="openjdk8>=${version}_${revision}"
short_desc+=" (transitional dummy package)"
}
openjdk-jre_package() {
archs=noarch
build_style=meta
depends="openjdk8-jre>=${version}_${revision}"
short_desc+=" - runtime components (transitional dummy package)"
}
openjdk-src_package() {
archs=noarch
build_style=meta
depends="openjdk8-src>=${version}_${revision}"
short_desc+=" - source code (transitional dummy package)"
}
openjdk-doc_package() {
archs=noarch
build_style=meta
depends="openjdk8-doc>=${version}_${revision}"
short_desc+=" - documentation (transitional dummy package)"
}