void-packages/srcpkgs/openjdk8/template

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=252
_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 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="92c682ee19844341a21853c7db8bd7654d2e6e50a4c8d630b6b6be34c2591341
5ced6b56b60a658c04092ee6152462b4f3f84465b654f4bc874f03a2bc6539fb
255a113a1a299caef89b928ebcdb6964f0e63009089a07c162562beb20aa42c8
ec9a858770e348fe60817a67e670e268fb2445d64f99b6d4d33556f4e2f0c1d1
96ae2b2362f3d45874247b11bd8df59914fbfab051513e908eda11bb71a5837b
de5fe5813d47092e048f6860dc58dad8a2dbd2b9e7272493cff78cd7ad7aa82d
a971f578c3d8550f0b96b01ac24fc408cdcc7f2923d530d5ada81bba8caef9fe
02d4042b042c457b0ed41cc6c95cfe005badec55b5fc19f03f57aebbc7121e52"
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)"
}