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=242
_jdk_build=01
_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=2
# 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="f251afdc71f252c4d2559f9d49cbce3128ffcba2185b5d3a0e7020d5d214bab7
27590eaa48dcddaf9a8aa305333b5e619acede415f7a091afd9cca8fd69ccf85
af73a2b1a6bf2d59e5c2cb87253844c2969489f37ac6ad352c60599ea8a7e116
7ecb436b63feceec86b0aefca3b95e2b03d08503a26233b0d5f09441826925db
93bbcdfa489d4e5b68a7ccc5faf92ef74ea5ac5b2e3f93314158ea50624fd1c2
6bd28277bb73c29d189c70ca2d61263e698406d89e54403c09f19a4e852a703a
287d716a3f4ecd8a7c2e579a7514a0998c0164f544084cc90d8a476813663904
e272f22edc8f43c4c2dfcce6073b7689332a05014ead734dff24537a49e23682"
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)"
}