void-packages/srcpkgs/openjdk8/template

285 lines
10 KiB
Bash

# Template file for 'openjdk8'
# TODO: better places for bin and man?
# TODO: make -headless versions
# TODO: config files?
pkgname=openjdk8
version=8u272b02
revision=1
_jdk_update=272
_jdk_update="${version#*u}"
_jdk_update="${_jdk_update%b*}"
_jdk_build="${version#*b}"
_final_jdk_home="usr/lib/jvm/java-1.8-openjdk"
# 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"
--disable-option-checking"
make_build_args="images $(vopt_if docs docs) COMPILER_WARNINGS_FATAL=false"
hostmakedepends="pkg-config automake autoconf cpio tar unzip zip ca-certificates
zlib-devel make-ca which"
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="bb931ea723a8b6c418ef6a8dc7b33c9a082ce240f607e33d260951bdc52d1294
655a3f4875f4ea4d6d7083c65e3bffbd694114af25a7e25bb4276c63f606328d
2c6bc905ffe04659e89806514f10848e4ff548209c8e4407a5f37a3358a8cb78
9543a96eb3f60171cebbf0652190942c0b0a78560fae19c7c7aff7a72e14daa5
7a610a834483650660a98828420cd3bb36f17e077cc0eaf30c4d01db97ee0efd
330f52d045993ca98f6c6376bb67e5c085937553db80fd21503129f9fcdd144d
04d6b61009f7373c49a5381281cae2d4c06d4c5bc42991b3bccfb8b820b95bba
48aac240d50cb3fa651b2299b6add1376f31624fd7666b74ba23761bb535fab7"
build_options="docs"
desc_option_docs="Build documentation"
# no hotspot JIT for arm32 and ppc32
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
arm*|ppc*|mips*) _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"
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/}
case "$XBPS_TARGET_MACHINE" in
# force ELFv2 for ppc64 just in case
ppc64*)
CFLAGS+=" -DABI_ELFv2"
CXXFLAGS+=" -DABI_ELFv2"
;;
# with normal -O2 on mipshf there is a too-large jump which causes the
# assembler to fail. optimising for size means the jump is made smaller
mips*hf*)
CFLAGS+=" -Os"
CXXFLAGS+=" -Os"
;;
esac
./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
}
}