void-packages/srcpkgs/openjdk11/template

198 lines
5.4 KiB
Bash

# Template file for 'openjdk11'
pkgname=openjdk11
version=11.0.25+5
revision=1
_java_ver="${version%%.*}"
_jdk_home="usr/lib/jvm/openjdk${_java_ver}"
archs="x86_64* i686* aarch64* armv7* ppc64*"
build_style=gnu-configure
configure_args="
--disable-warnings-as-errors
--prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
--with-jobs=${XBPS_ORIG_MAKEJOBS}
--enable-unlimited-crypto
--with-zlib=system
--with-libjpeg=system
--with-giflib=system
--with-libpng=system
--with-lcms=system
--with-jtreg=no
--with-native-debug-symbols=internal
--with-version-pre=
--with-version-opt=void-r$revision
--with-version-build=${version#*+}
--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 static-libs-image $(vopt_if docs docs)"
make_check_target="test-hotspot-gtest"
hostmakedepends="pkg-config automake autoconf cpio tar unzip zip ca-certificates
openssl zlib-devel which make-ca"
makedepends="libXrender-devel libXtst-devel libXt-devel libXrandr-devel
giflib-devel libjpeg-turbo-devel cups-devel freetype-devel alsa-lib-devel
fontconfig-devel zlib-devel lcms2-devel"
depends="${pkgname}-jre-${version}_${revision}"
short_desc="OpenJDK Java Development Kit (version ${_java_ver})"
maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
license="GPL-2.0-only WITH Classpath-exception-2.0"
homepage="http://openjdk.java.net/"
distfiles="https://github.com/openjdk/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
checksum=fb7e68bbaf9174605504e04331b3eadfeb37c23437598a04776fd3a9c085ace2
alternatives="jdk:/usr/lib/jvm/default-jdk:/${_jdk_home}"
provides="java-environment-${version}_1"
# Build is still parallel, but don't use -jN.
disable_parallel_build=yes
disable_parallel_check=yes
build_options="docs"
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
# no hotspot JIT for ppc32
ppc*) _use_zero=yes ;;
armv[56]*) broken="Unsupported architecture" ;;
esac
if [ -n "$_use_zero" ]; then
makedepends+=" libffi-devel"
configure_args+=" --with-jvm-variants=zero"
case "$XBPS_TARGET_MACHINE" in
ppc*) configure_args+=" --with-boot-jdk-jvmargs=-XX:ThreadStackSize=2560";;
esac
fi
case "$XBPS_TARGET_LIBC" in
glibc) build_options_default+=" docs";;
esac
if [ ! "$CROSS_BUILD" ]; then
hostmakedepends+=" openjdk10-bootstrap"
configure_args+=" --with-boot-jdk=/usr/lib/jvm/java-10-openjdk"
else
hostmakedepends+=" openjdk11"
configure_args+=" --with-boot-jdk=/${_jdk_home}"
fi
post_extract() {
chmod +x configure
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
rm -r src/jdk.hotspot.agent
fi
}
post_patch() {
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
for f in "${FILESDIR}"/musl_patches/*.patch; do
echo "Applying $f"
patch -Np1 -i "$f"
done
fi
}
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=$XBPS_CROSS_BASE}
if [ "$XBPS_CCACHE" ] && [ -z "$CROSS_BUILD" ]; then
configure_args+=" --enable-ccache"
CC="/usr/bin/cc"
CXX="/usr/bin/c++"
fi
./configure ${configure_args} --with-extra-cflags="$CFLAGS" --with-extra-cxxflags="$CXXFLAGS" --with-extra-ldflags="$LDFLAGS"
}
do_install() {
vmkdir $_jdk_home
vcopy build/*-normal-*-release/images/jdk/* $_jdk_home
vmkdir $_jdk_home/lib/security
make-ca -g -f --destdir "${PWD}/ca" -k $DESTDIR/$_jdk_home/bin/keytool
mv ./ca/etc/pki/tls/java/cacerts $DESTDIR/$_jdk_home/lib/security/
chmod -R ugo+rw ./ca
rm -Rf ./ca
vlicense ASSEMBLY_EXCEPTION
vlicense LICENSE
}
subpackages="openjdk11-src openjdk11-jre openjdk11-doc openjdk11-jmods openjdk11-static-libs openjdk11-bin"
openjdk11-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"
depends="fontconfig openjdk-common public-suffix"
alternatives="java:/usr/lib/jvm/default-jre:/${_jdk_home}"
pkg_install() {
for bin in java jjs keytool pack200 rmid rmiregistry unpack200; do
vmove "${_jdk_home}/bin/${bin}"
vmove "${_jdk_home}/man/man1/${bin}.1"
vmove "${_jdk_home}/man/ja_JP.UTF-8/man1/${bin}.1"
done
for f in lib legal conf release; do
vmove $_jdk_home/$f
done
vlicense ASSEMBLY_EXCEPTION
vlicense LICENSE
}
}
openjdk11-doc_package() {
nostrip=yes
noverifyrdeps=yes
noshlibprovides=yes
short_desc+=" - documentation"
if [ -z "$build_option_docs" ]; then
build_style=meta
fi
pkg_install() {
cd ${wrksrc}
if [ "$build_option_docs" ]; then
vmkdir usr/share/doc/openjdk11
cp -a build/linux-*/images/docs/* $PKGDESTDIR/usr/share/doc/openjdk11
fi
}
}
openjdk11-src_package() {
nostrip=yes
noverifyrdeps=yes
noshlibprovides=yes
short_desc+=" - sources"
pkg_install() {
vmove $_jdk_home/lib/src.zip
}
}
openjdk11-static-libs_package() {
short_desc+=" - static libs"
pkg_install() {
vmkdir $_jdk_home
vcopy build/*-normal-*-release/images/static-libs/lib $_jdk_home
}
}
openjdk11-jmods_package() {
short_desc+=" - JMODs"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove $_jdk_home/jmods
}
}
openjdk11-bin_package() {
reverts="11+28_1 11+28_2"
short_desc+=" (transitional dummy package)"
depends="${sourcepkg}>=${version}_${revision}"
build_style=meta
}