* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
@ 2019-09-03 18:16 ` voidlinux-github
2019-09-03 18:16 ` voidlinux-github
` (29 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 18:16 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 56858 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/2] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From c0e081aaedac2cd61b056c8add49538fca12bf39 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:22:09 -0500
Subject: [PATCH 2/2] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
srcpkgs/openjdk-11/files/mkcacerts | 214 +++++++
.../files/musl_patches/aarch64.patch | 10 +
.../openjdk-11/files/musl_patches/arm.patch | 29 +
.../openjdk-11/files/musl_patches/build.patch | 536 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 220 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 129 +++++
srcpkgs/openjdk-11/template | 186 ++++++
10 files changed, 1332 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/mkcacerts
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/mkcacerts b/srcpkgs/openjdk-11/files/mkcacerts
new file mode 100644
index 00000000000..2db5a77bb05
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/mkcacerts
@@ -0,0 +1,214 @@
+#!/bin/sh
+# Script provided by http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html#ojdk-certs
+# EB 20141217: removed bashisms
+# Simple script to extract x509 certificates and create a JRE cacerts file.
+
+get_args()
+ {
+ if test -z "${1}" ; then
+ showhelp
+ exit 1
+ fi
+
+ while test -n "${1}" ; do
+ case "${1}" in
+ -f | --cafile)
+ check_arg $1 $2
+ CAFILE="${2}"
+ shift 2
+ ;;
+ -d | --cadir)
+ check_arg $1 $2
+ CADIR="${2}"
+ shift 2
+ ;;
+ -o | --outfile)
+ check_arg $1 $2
+ OUTFILE="${2}"
+ shift 2
+ ;;
+ -k | --keytool)
+ check_arg $1 $2
+ KEYTOOL="${2}"
+ shift 2
+ ;;
+ -s | --openssl)
+ check_arg $1 $2
+ OPENSSL="${2}"
+ shift 2
+ ;;
+ -h | --help)
+ showhelp
+ exit 0
+ ;;
+ *)
+ showhelp
+ exit 1
+ ;;
+ esac
+ done
+ }
+
+check_arg()
+ {
+ echo "${2}" | grep -v "^-" > /dev/null
+ if [ -z "$?" -o ! -n "$2" ]; then
+ echo "Error: $1 requires a valid argument."
+ exit 1
+ fi
+ }
+
+# The date binary is not reliable on 32bit systems for dates after 2038
+mydate()
+ {
+ local y=$( echo $1 | cut -d" " -f4 )
+ local M=$( echo $1 | cut -d" " -f1 )
+ local d=$( echo $1 | cut -d" " -f2 )
+ local m
+
+ if [ ${d} -lt 10 ]; then d="0${d}"; fi
+
+ case $M in
+ Jan) m="01";;
+ Feb) m="02";;
+ Mar) m="03";;
+ Apr) m="04";;
+ May) m="05";;
+ Jun) m="06";;
+ Jul) m="07";;
+ Aug) m="08";;
+ Sep) m="09";;
+ Oct) m="10";;
+ Nov) m="11";;
+ Dec) m="12";;
+ esac
+
+ certdate="${y}${m}${d}"
+ }
+
+showhelp()
+ {
+ echo "`basename ${0}` creates a valid cacerts file for use with IcedTea."
+ echo ""
+ echo " -f --cafile The path to a file containing PEM"
+ echo " formated CA certificates. May not be"
+ echo " used with -d/--cadir."
+ echo ""
+ echo " -d --cadir The path to a directory of PEM formatted"
+ echo " CA certificates. May not be used with"
+ echo " -f/--cafile."
+ echo ""
+ echo " -o --outfile The path to the output file."
+ echo ""
+ echo " -k --keytool The path to the java keytool utility."
+ echo ""
+ echo " -s --openssl The path to the openssl utility."
+ echo ""
+ echo " -h --help Show this help message and exit."
+ echo ""
+ echo ""
+ }
+
+# Initialize empty variables so that the shell does not pollute the script
+CAFILE=""
+CADIR=""
+OUTFILE=""
+OPENSSL=""
+KEYTOOL=""
+certdate=""
+date=""
+today=$( date +%Y%m%d )
+
+# Process command line arguments
+get_args ${@}
+
+# Handle common errors
+if test "${CAFILE}x" = "x" -a "${CADIR}x" = "x" ; then
+ echo "ERROR! You must provide an x509 certificate store!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${CAFILE}x" != "x" -a "${CADIR}x" != "x" ; then
+ echo "ERROR! You cannot provide two x509 certificate stores!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${KEYTOOL}x" = "x" ; then
+ echo "ERROR! You must provide a valid keytool program!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OPENSSL}x" = "x" ; then
+ echo "ERROR! You must provide a valid path to openssl!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OUTFILE}x" = "x" ; then
+ echo "ERROR! You must provide a valid output file!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+# Get on with the work
+
+# If using a CAFILE, split it into individual files in a temp directory
+if test "${CAFILE}x" != "x" ; then
+ TEMPDIR=`mktemp -d`
+ CADIR="${TEMPDIR}"
+
+ # Get a list of staring lines for each cert
+ CERTLIST=`grep -n "^-----BEGIN" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Get a list of ending lines for each cert
+ ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Start a loop
+ for certbegin in ${CERTLIST} ; do
+ for certend in ${ENDCERTLIST} ; do
+ if test "${certend}" -gt "${certbegin}"; then
+ break
+ fi
+ done
+ sed -n "${certbegin},${certend}p" "${CAFILE}" > "${CADIR}/${certbegin}.pem"
+ keyhash=`${OPENSSL} x509 -noout -in "${CADIR}/${certbegin}.pem" -hash`
+ echo "Generated PEM file with hash: ${keyhash}."
+ done
+fi
+
+# Write the output file
+for cert in `find "${CADIR}" -type f -name "*.pem" -o -name "*.crt"`
+do
+
+ # Make sure the certificate date is valid...
+ date=$( ${OPENSSL} x509 -enddate -in "${cert}" -noout | sed 's/^notAfter=//' )
+ mydate "${date}"
+ if test "${certdate}" -lt "${today}" ; then
+ echo "${cert} expired on ${certdate}! Skipping..."
+ unset date certdate
+ continue
+ fi
+ unset date certdate
+ ls "${cert}"
+ tempfile=`mktemp`
+ sed -n "/^-----BEGIN/,/^-----END/p" "${cert}" > "${tempfile}"
+ echo yes | env LC_ALL=C "${KEYTOOL}" -import \
+ -alias `basename "${cert}"` \
+ -keystore "${OUTFILE}" \
+ -storepass 'changeit' \
+ -file "${tempfile}"
+ rm "${tempfile}"
+done
+
+if test "${TEMPDIR}x" != "x" ; then
+ rm -rf "${TEMPDIR}"
+fi
+exit 0
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..c4d578738d2
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,10 @@
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..b8f104c8fa9
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,29 @@
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..aab3d6ea6d6
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,536 @@
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..e14944d7de7
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,220 @@
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..cef2ace4e13
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,129 @@
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..0b15b8f39d3
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,186 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel"
+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"
+provides="java-environment-${version}_1 java-runtime"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/mkcacerts:/usr/lib/jvm/openjdk-11/bin/mkcacerts
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vinstall ${FILESDIR}/mkcacerts 755 usr/lib/jvm/$_openjdk_version/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ sh ${FILESDIR}/mkcacerts \
+ -d "/usr/share/ca-certificates/" \
+ -s "/usr/bin/openssl" \
+ -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool" \
+ -o "${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/cacerts"
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
2019-09-03 18:16 ` [PR PATCH] [Updated] WIP: Openjdk 11 voidlinux-github
@ 2019-09-03 18:16 ` voidlinux-github
2019-09-03 21:08 ` voidlinux-github
` (28 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 18:16 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 56858 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/2] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From c0e081aaedac2cd61b056c8add49538fca12bf39 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:22:09 -0500
Subject: [PATCH 2/2] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
srcpkgs/openjdk-11/files/mkcacerts | 214 +++++++
.../files/musl_patches/aarch64.patch | 10 +
.../openjdk-11/files/musl_patches/arm.patch | 29 +
.../openjdk-11/files/musl_patches/build.patch | 536 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 220 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 129 +++++
srcpkgs/openjdk-11/template | 186 ++++++
10 files changed, 1332 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/mkcacerts
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/mkcacerts b/srcpkgs/openjdk-11/files/mkcacerts
new file mode 100644
index 00000000000..2db5a77bb05
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/mkcacerts
@@ -0,0 +1,214 @@
+#!/bin/sh
+# Script provided by http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html#ojdk-certs
+# EB 20141217: removed bashisms
+# Simple script to extract x509 certificates and create a JRE cacerts file.
+
+get_args()
+ {
+ if test -z "${1}" ; then
+ showhelp
+ exit 1
+ fi
+
+ while test -n "${1}" ; do
+ case "${1}" in
+ -f | --cafile)
+ check_arg $1 $2
+ CAFILE="${2}"
+ shift 2
+ ;;
+ -d | --cadir)
+ check_arg $1 $2
+ CADIR="${2}"
+ shift 2
+ ;;
+ -o | --outfile)
+ check_arg $1 $2
+ OUTFILE="${2}"
+ shift 2
+ ;;
+ -k | --keytool)
+ check_arg $1 $2
+ KEYTOOL="${2}"
+ shift 2
+ ;;
+ -s | --openssl)
+ check_arg $1 $2
+ OPENSSL="${2}"
+ shift 2
+ ;;
+ -h | --help)
+ showhelp
+ exit 0
+ ;;
+ *)
+ showhelp
+ exit 1
+ ;;
+ esac
+ done
+ }
+
+check_arg()
+ {
+ echo "${2}" | grep -v "^-" > /dev/null
+ if [ -z "$?" -o ! -n "$2" ]; then
+ echo "Error: $1 requires a valid argument."
+ exit 1
+ fi
+ }
+
+# The date binary is not reliable on 32bit systems for dates after 2038
+mydate()
+ {
+ local y=$( echo $1 | cut -d" " -f4 )
+ local M=$( echo $1 | cut -d" " -f1 )
+ local d=$( echo $1 | cut -d" " -f2 )
+ local m
+
+ if [ ${d} -lt 10 ]; then d="0${d}"; fi
+
+ case $M in
+ Jan) m="01";;
+ Feb) m="02";;
+ Mar) m="03";;
+ Apr) m="04";;
+ May) m="05";;
+ Jun) m="06";;
+ Jul) m="07";;
+ Aug) m="08";;
+ Sep) m="09";;
+ Oct) m="10";;
+ Nov) m="11";;
+ Dec) m="12";;
+ esac
+
+ certdate="${y}${m}${d}"
+ }
+
+showhelp()
+ {
+ echo "`basename ${0}` creates a valid cacerts file for use with IcedTea."
+ echo ""
+ echo " -f --cafile The path to a file containing PEM"
+ echo " formated CA certificates. May not be"
+ echo " used with -d/--cadir."
+ echo ""
+ echo " -d --cadir The path to a directory of PEM formatted"
+ echo " CA certificates. May not be used with"
+ echo " -f/--cafile."
+ echo ""
+ echo " -o --outfile The path to the output file."
+ echo ""
+ echo " -k --keytool The path to the java keytool utility."
+ echo ""
+ echo " -s --openssl The path to the openssl utility."
+ echo ""
+ echo " -h --help Show this help message and exit."
+ echo ""
+ echo ""
+ }
+
+# Initialize empty variables so that the shell does not pollute the script
+CAFILE=""
+CADIR=""
+OUTFILE=""
+OPENSSL=""
+KEYTOOL=""
+certdate=""
+date=""
+today=$( date +%Y%m%d )
+
+# Process command line arguments
+get_args ${@}
+
+# Handle common errors
+if test "${CAFILE}x" = "x" -a "${CADIR}x" = "x" ; then
+ echo "ERROR! You must provide an x509 certificate store!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${CAFILE}x" != "x" -a "${CADIR}x" != "x" ; then
+ echo "ERROR! You cannot provide two x509 certificate stores!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${KEYTOOL}x" = "x" ; then
+ echo "ERROR! You must provide a valid keytool program!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OPENSSL}x" = "x" ; then
+ echo "ERROR! You must provide a valid path to openssl!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OUTFILE}x" = "x" ; then
+ echo "ERROR! You must provide a valid output file!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+# Get on with the work
+
+# If using a CAFILE, split it into individual files in a temp directory
+if test "${CAFILE}x" != "x" ; then
+ TEMPDIR=`mktemp -d`
+ CADIR="${TEMPDIR}"
+
+ # Get a list of staring lines for each cert
+ CERTLIST=`grep -n "^-----BEGIN" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Get a list of ending lines for each cert
+ ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Start a loop
+ for certbegin in ${CERTLIST} ; do
+ for certend in ${ENDCERTLIST} ; do
+ if test "${certend}" -gt "${certbegin}"; then
+ break
+ fi
+ done
+ sed -n "${certbegin},${certend}p" "${CAFILE}" > "${CADIR}/${certbegin}.pem"
+ keyhash=`${OPENSSL} x509 -noout -in "${CADIR}/${certbegin}.pem" -hash`
+ echo "Generated PEM file with hash: ${keyhash}."
+ done
+fi
+
+# Write the output file
+for cert in `find "${CADIR}" -type f -name "*.pem" -o -name "*.crt"`
+do
+
+ # Make sure the certificate date is valid...
+ date=$( ${OPENSSL} x509 -enddate -in "${cert}" -noout | sed 's/^notAfter=//' )
+ mydate "${date}"
+ if test "${certdate}" -lt "${today}" ; then
+ echo "${cert} expired on ${certdate}! Skipping..."
+ unset date certdate
+ continue
+ fi
+ unset date certdate
+ ls "${cert}"
+ tempfile=`mktemp`
+ sed -n "/^-----BEGIN/,/^-----END/p" "${cert}" > "${tempfile}"
+ echo yes | env LC_ALL=C "${KEYTOOL}" -import \
+ -alias `basename "${cert}"` \
+ -keystore "${OUTFILE}" \
+ -storepass 'changeit' \
+ -file "${tempfile}"
+ rm "${tempfile}"
+done
+
+if test "${TEMPDIR}x" != "x" ; then
+ rm -rf "${TEMPDIR}"
+fi
+exit 0
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..c4d578738d2
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,10 @@
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..b8f104c8fa9
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,29 @@
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..aab3d6ea6d6
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,536 @@
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..e14944d7de7
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,220 @@
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..cef2ace4e13
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,129 @@
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..0b15b8f39d3
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,186 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel"
+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"
+provides="java-environment-${version}_1 java-runtime"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/mkcacerts:/usr/lib/jvm/openjdk-11/bin/mkcacerts
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vinstall ${FILESDIR}/mkcacerts 755 usr/lib/jvm/$_openjdk_version/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ sh ${FILESDIR}/mkcacerts \
+ -d "/usr/share/ca-certificates/" \
+ -s "/usr/bin/openssl" \
+ -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool" \
+ -o "${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/cacerts"
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
2019-09-03 18:16 ` [PR PATCH] [Updated] WIP: Openjdk 11 voidlinux-github
2019-09-03 18:16 ` voidlinux-github
@ 2019-09-03 21:08 ` voidlinux-github
2019-09-03 21:29 ` voidlinux-github
` (27 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 21:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
New comment by Vaelatern on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-527641351
Comment:
I'd like a source for the patches before just adding them, a source tracked in the patch file itself.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (2 preceding siblings ...)
2019-09-03 21:08 ` voidlinux-github
@ 2019-09-03 21:29 ` voidlinux-github
2019-09-03 21:44 ` voidlinux-github
` (26 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 21:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-527648176
Comment:
Source seems to be from alpine linux:
https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
If I add a link to that commit to the patches, is that sufficient?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (3 preceding siblings ...)
2019-09-03 21:29 ` voidlinux-github
@ 2019-09-03 21:44 ` voidlinux-github
2019-09-03 22:02 ` [PR PATCH] [Updated] " voidlinux-github
` (25 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 21:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 146 bytes --]
New comment by Vaelatern on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-527652844
Comment:
Yes
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (4 preceding siblings ...)
2019-09-03 21:44 ` voidlinux-github
@ 2019-09-03 22:02 ` voidlinux-github
2019-09-03 22:02 ` voidlinux-github
` (24 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 22:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 57508 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/2] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From 8fd4c9e471c0fa7e2511ff7c4080d16f67080249 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:22:09 -0500
Subject: [PATCH 2/2] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
srcpkgs/openjdk-11/files/mkcacerts | 214 +++++++
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 186 ++++++
10 files changed, 1337 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/mkcacerts
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/mkcacerts b/srcpkgs/openjdk-11/files/mkcacerts
new file mode 100644
index 00000000000..2db5a77bb05
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/mkcacerts
@@ -0,0 +1,214 @@
+#!/bin/sh
+# Script provided by http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html#ojdk-certs
+# EB 20141217: removed bashisms
+# Simple script to extract x509 certificates and create a JRE cacerts file.
+
+get_args()
+ {
+ if test -z "${1}" ; then
+ showhelp
+ exit 1
+ fi
+
+ while test -n "${1}" ; do
+ case "${1}" in
+ -f | --cafile)
+ check_arg $1 $2
+ CAFILE="${2}"
+ shift 2
+ ;;
+ -d | --cadir)
+ check_arg $1 $2
+ CADIR="${2}"
+ shift 2
+ ;;
+ -o | --outfile)
+ check_arg $1 $2
+ OUTFILE="${2}"
+ shift 2
+ ;;
+ -k | --keytool)
+ check_arg $1 $2
+ KEYTOOL="${2}"
+ shift 2
+ ;;
+ -s | --openssl)
+ check_arg $1 $2
+ OPENSSL="${2}"
+ shift 2
+ ;;
+ -h | --help)
+ showhelp
+ exit 0
+ ;;
+ *)
+ showhelp
+ exit 1
+ ;;
+ esac
+ done
+ }
+
+check_arg()
+ {
+ echo "${2}" | grep -v "^-" > /dev/null
+ if [ -z "$?" -o ! -n "$2" ]; then
+ echo "Error: $1 requires a valid argument."
+ exit 1
+ fi
+ }
+
+# The date binary is not reliable on 32bit systems for dates after 2038
+mydate()
+ {
+ local y=$( echo $1 | cut -d" " -f4 )
+ local M=$( echo $1 | cut -d" " -f1 )
+ local d=$( echo $1 | cut -d" " -f2 )
+ local m
+
+ if [ ${d} -lt 10 ]; then d="0${d}"; fi
+
+ case $M in
+ Jan) m="01";;
+ Feb) m="02";;
+ Mar) m="03";;
+ Apr) m="04";;
+ May) m="05";;
+ Jun) m="06";;
+ Jul) m="07";;
+ Aug) m="08";;
+ Sep) m="09";;
+ Oct) m="10";;
+ Nov) m="11";;
+ Dec) m="12";;
+ esac
+
+ certdate="${y}${m}${d}"
+ }
+
+showhelp()
+ {
+ echo "`basename ${0}` creates a valid cacerts file for use with IcedTea."
+ echo ""
+ echo " -f --cafile The path to a file containing PEM"
+ echo " formated CA certificates. May not be"
+ echo " used with -d/--cadir."
+ echo ""
+ echo " -d --cadir The path to a directory of PEM formatted"
+ echo " CA certificates. May not be used with"
+ echo " -f/--cafile."
+ echo ""
+ echo " -o --outfile The path to the output file."
+ echo ""
+ echo " -k --keytool The path to the java keytool utility."
+ echo ""
+ echo " -s --openssl The path to the openssl utility."
+ echo ""
+ echo " -h --help Show this help message and exit."
+ echo ""
+ echo ""
+ }
+
+# Initialize empty variables so that the shell does not pollute the script
+CAFILE=""
+CADIR=""
+OUTFILE=""
+OPENSSL=""
+KEYTOOL=""
+certdate=""
+date=""
+today=$( date +%Y%m%d )
+
+# Process command line arguments
+get_args ${@}
+
+# Handle common errors
+if test "${CAFILE}x" = "x" -a "${CADIR}x" = "x" ; then
+ echo "ERROR! You must provide an x509 certificate store!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${CAFILE}x" != "x" -a "${CADIR}x" != "x" ; then
+ echo "ERROR! You cannot provide two x509 certificate stores!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${KEYTOOL}x" = "x" ; then
+ echo "ERROR! You must provide a valid keytool program!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OPENSSL}x" = "x" ; then
+ echo "ERROR! You must provide a valid path to openssl!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OUTFILE}x" = "x" ; then
+ echo "ERROR! You must provide a valid output file!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+# Get on with the work
+
+# If using a CAFILE, split it into individual files in a temp directory
+if test "${CAFILE}x" != "x" ; then
+ TEMPDIR=`mktemp -d`
+ CADIR="${TEMPDIR}"
+
+ # Get a list of staring lines for each cert
+ CERTLIST=`grep -n "^-----BEGIN" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Get a list of ending lines for each cert
+ ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Start a loop
+ for certbegin in ${CERTLIST} ; do
+ for certend in ${ENDCERTLIST} ; do
+ if test "${certend}" -gt "${certbegin}"; then
+ break
+ fi
+ done
+ sed -n "${certbegin},${certend}p" "${CAFILE}" > "${CADIR}/${certbegin}.pem"
+ keyhash=`${OPENSSL} x509 -noout -in "${CADIR}/${certbegin}.pem" -hash`
+ echo "Generated PEM file with hash: ${keyhash}."
+ done
+fi
+
+# Write the output file
+for cert in `find "${CADIR}" -type f -name "*.pem" -o -name "*.crt"`
+do
+
+ # Make sure the certificate date is valid...
+ date=$( ${OPENSSL} x509 -enddate -in "${cert}" -noout | sed 's/^notAfter=//' )
+ mydate "${date}"
+ if test "${certdate}" -lt "${today}" ; then
+ echo "${cert} expired on ${certdate}! Skipping..."
+ unset date certdate
+ continue
+ fi
+ unset date certdate
+ ls "${cert}"
+ tempfile=`mktemp`
+ sed -n "/^-----BEGIN/,/^-----END/p" "${cert}" > "${tempfile}"
+ echo yes | env LC_ALL=C "${KEYTOOL}" -import \
+ -alias `basename "${cert}"` \
+ -keystore "${OUTFILE}" \
+ -storepass 'changeit' \
+ -file "${tempfile}"
+ rm "${tempfile}"
+done
+
+if test "${TEMPDIR}x" != "x" ; then
+ rm -rf "${TEMPDIR}"
+fi
+exit 0
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..0b15b8f39d3
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,186 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel"
+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"
+provides="java-environment-${version}_1 java-runtime"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/mkcacerts:/usr/lib/jvm/openjdk-11/bin/mkcacerts
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vinstall ${FILESDIR}/mkcacerts 755 usr/lib/jvm/$_openjdk_version/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ sh ${FILESDIR}/mkcacerts \
+ -d "/usr/share/ca-certificates/" \
+ -s "/usr/bin/openssl" \
+ -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool" \
+ -o "${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/cacerts"
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (5 preceding siblings ...)
2019-09-03 22:02 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-09-03 22:02 ` voidlinux-github
2019-09-03 22:02 ` voidlinux-github
` (23 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 22:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 57508 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/2] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From 8fd4c9e471c0fa7e2511ff7c4080d16f67080249 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:22:09 -0500
Subject: [PATCH 2/2] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
srcpkgs/openjdk-11/files/mkcacerts | 214 +++++++
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 186 ++++++
10 files changed, 1337 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/mkcacerts
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/mkcacerts b/srcpkgs/openjdk-11/files/mkcacerts
new file mode 100644
index 00000000000..2db5a77bb05
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/mkcacerts
@@ -0,0 +1,214 @@
+#!/bin/sh
+# Script provided by http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html#ojdk-certs
+# EB 20141217: removed bashisms
+# Simple script to extract x509 certificates and create a JRE cacerts file.
+
+get_args()
+ {
+ if test -z "${1}" ; then
+ showhelp
+ exit 1
+ fi
+
+ while test -n "${1}" ; do
+ case "${1}" in
+ -f | --cafile)
+ check_arg $1 $2
+ CAFILE="${2}"
+ shift 2
+ ;;
+ -d | --cadir)
+ check_arg $1 $2
+ CADIR="${2}"
+ shift 2
+ ;;
+ -o | --outfile)
+ check_arg $1 $2
+ OUTFILE="${2}"
+ shift 2
+ ;;
+ -k | --keytool)
+ check_arg $1 $2
+ KEYTOOL="${2}"
+ shift 2
+ ;;
+ -s | --openssl)
+ check_arg $1 $2
+ OPENSSL="${2}"
+ shift 2
+ ;;
+ -h | --help)
+ showhelp
+ exit 0
+ ;;
+ *)
+ showhelp
+ exit 1
+ ;;
+ esac
+ done
+ }
+
+check_arg()
+ {
+ echo "${2}" | grep -v "^-" > /dev/null
+ if [ -z "$?" -o ! -n "$2" ]; then
+ echo "Error: $1 requires a valid argument."
+ exit 1
+ fi
+ }
+
+# The date binary is not reliable on 32bit systems for dates after 2038
+mydate()
+ {
+ local y=$( echo $1 | cut -d" " -f4 )
+ local M=$( echo $1 | cut -d" " -f1 )
+ local d=$( echo $1 | cut -d" " -f2 )
+ local m
+
+ if [ ${d} -lt 10 ]; then d="0${d}"; fi
+
+ case $M in
+ Jan) m="01";;
+ Feb) m="02";;
+ Mar) m="03";;
+ Apr) m="04";;
+ May) m="05";;
+ Jun) m="06";;
+ Jul) m="07";;
+ Aug) m="08";;
+ Sep) m="09";;
+ Oct) m="10";;
+ Nov) m="11";;
+ Dec) m="12";;
+ esac
+
+ certdate="${y}${m}${d}"
+ }
+
+showhelp()
+ {
+ echo "`basename ${0}` creates a valid cacerts file for use with IcedTea."
+ echo ""
+ echo " -f --cafile The path to a file containing PEM"
+ echo " formated CA certificates. May not be"
+ echo " used with -d/--cadir."
+ echo ""
+ echo " -d --cadir The path to a directory of PEM formatted"
+ echo " CA certificates. May not be used with"
+ echo " -f/--cafile."
+ echo ""
+ echo " -o --outfile The path to the output file."
+ echo ""
+ echo " -k --keytool The path to the java keytool utility."
+ echo ""
+ echo " -s --openssl The path to the openssl utility."
+ echo ""
+ echo " -h --help Show this help message and exit."
+ echo ""
+ echo ""
+ }
+
+# Initialize empty variables so that the shell does not pollute the script
+CAFILE=""
+CADIR=""
+OUTFILE=""
+OPENSSL=""
+KEYTOOL=""
+certdate=""
+date=""
+today=$( date +%Y%m%d )
+
+# Process command line arguments
+get_args ${@}
+
+# Handle common errors
+if test "${CAFILE}x" = "x" -a "${CADIR}x" = "x" ; then
+ echo "ERROR! You must provide an x509 certificate store!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${CAFILE}x" != "x" -a "${CADIR}x" != "x" ; then
+ echo "ERROR! You cannot provide two x509 certificate stores!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${KEYTOOL}x" = "x" ; then
+ echo "ERROR! You must provide a valid keytool program!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OPENSSL}x" = "x" ; then
+ echo "ERROR! You must provide a valid path to openssl!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OUTFILE}x" = "x" ; then
+ echo "ERROR! You must provide a valid output file!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+# Get on with the work
+
+# If using a CAFILE, split it into individual files in a temp directory
+if test "${CAFILE}x" != "x" ; then
+ TEMPDIR=`mktemp -d`
+ CADIR="${TEMPDIR}"
+
+ # Get a list of staring lines for each cert
+ CERTLIST=`grep -n "^-----BEGIN" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Get a list of ending lines for each cert
+ ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Start a loop
+ for certbegin in ${CERTLIST} ; do
+ for certend in ${ENDCERTLIST} ; do
+ if test "${certend}" -gt "${certbegin}"; then
+ break
+ fi
+ done
+ sed -n "${certbegin},${certend}p" "${CAFILE}" > "${CADIR}/${certbegin}.pem"
+ keyhash=`${OPENSSL} x509 -noout -in "${CADIR}/${certbegin}.pem" -hash`
+ echo "Generated PEM file with hash: ${keyhash}."
+ done
+fi
+
+# Write the output file
+for cert in `find "${CADIR}" -type f -name "*.pem" -o -name "*.crt"`
+do
+
+ # Make sure the certificate date is valid...
+ date=$( ${OPENSSL} x509 -enddate -in "${cert}" -noout | sed 's/^notAfter=//' )
+ mydate "${date}"
+ if test "${certdate}" -lt "${today}" ; then
+ echo "${cert} expired on ${certdate}! Skipping..."
+ unset date certdate
+ continue
+ fi
+ unset date certdate
+ ls "${cert}"
+ tempfile=`mktemp`
+ sed -n "/^-----BEGIN/,/^-----END/p" "${cert}" > "${tempfile}"
+ echo yes | env LC_ALL=C "${KEYTOOL}" -import \
+ -alias `basename "${cert}"` \
+ -keystore "${OUTFILE}" \
+ -storepass 'changeit' \
+ -file "${tempfile}"
+ rm "${tempfile}"
+done
+
+if test "${TEMPDIR}x" != "x" ; then
+ rm -rf "${TEMPDIR}"
+fi
+exit 0
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..0b15b8f39d3
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,186 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel"
+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"
+provides="java-environment-${version}_1 java-runtime"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/mkcacerts:/usr/lib/jvm/openjdk-11/bin/mkcacerts
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vinstall ${FILESDIR}/mkcacerts 755 usr/lib/jvm/$_openjdk_version/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ sh ${FILESDIR}/mkcacerts \
+ -d "/usr/share/ca-certificates/" \
+ -s "/usr/bin/openssl" \
+ -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool" \
+ -o "${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/cacerts"
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (6 preceding siblings ...)
2019-09-03 22:02 ` voidlinux-github
@ 2019-09-03 22:02 ` voidlinux-github
2019-09-04 1:02 ` voidlinux-github
` (22 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-03 22:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-527658384
Comment:
@Vaelatern Done.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (7 preceding siblings ...)
2019-09-03 22:02 ` voidlinux-github
@ 2019-09-04 1:02 ` voidlinux-github
2019-09-04 21:03 ` [PR PATCH] [Updated] " voidlinux-github
` (21 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 1:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 255 bytes --]
New comment by the-maldridge on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-527696547
Comment:
The cacerts script is quite large, would it be possible to fetch that dynamically and have it as a distfile?
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (9 preceding siblings ...)
2019-09-04 21:03 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-09-04 21:03 ` voidlinux-github
2019-09-04 21:06 ` voidlinux-github
` (19 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 21:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 62364 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From fb5bf747903e72ce06e25e63da88e81f088007ad Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.4
---
srcpkgs/make-ca/patches/allow_destdir.patch | 63 +++++++++++++++++++++
srcpkgs/make-ca/template | 13 +++++
2 files changed, 76 insertions(+)
create mode 100644 srcpkgs/make-ca/patches/allow_destdir.patch
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/patches/allow_destdir.patch b/srcpkgs/make-ca/patches/allow_destdir.patch
new file mode 100644
index 00000000000..1ca8774a0fe
--- /dev/null
+++ b/srcpkgs/make-ca/patches/allow_destdir.patch
@@ -0,0 +1,63 @@
+This patch allows make-ca to generate certs in a specific destination directory.
+See: https://github.com/djlucas/make-ca/pull/3
+--- make-ca 2019-04-13 00:10:05.000000000 -0500
++++ make-ca 2019-09-04 11:26:41.929212855 -0500
+@@ -816,34 +816,32 @@ fi
+ # Clean up the mess
+ popd
+ rm -rf "${TEMPDIR}"
+
+ # Build ANCHORLIST
+-"${MD5SUM}" "${ANCHORDIR}"/*.pem > "${ANCHORLIST}"
++"${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/*.pem > "${DESTDIR}${ANCHORLIST}"
+
+-# Build alternate formats using p11-kit trust (if not using DESTDIR)
+-if test "x${DESTDIR}" == "x"; then
+- mkdir -p "${BUNDLEDIR}" "${KEYSTORE}"
+- echo -n "Extracting OpenSSL certificates to ${CERTDIR}..."
+- "${TRUST}" extract --filter=certificates --format=openssl-directory \
+- --overwrite --comment "${CERTDIR}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS server auth certificates to ${CABUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose server-auth --overwrite --comment "${CABUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS S-Mime certificates to ${SMBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose email --overwrite --comment "${SMBUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS code signing certificates to ${CSBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose code-signing --overwrite --comment \
+- "${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting Java cacerts (JKS) to ${KEYSTORE}/cacerts..."
+- "${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
+- --purpose server-auth --overwrite \
+- --comment "${KEYSTORE}/cacerts" \
+- && echo "Done!" || echo "Failed!!!"
+-fi
++# Build alternate formats using p11-kit trust
++mkdir -p "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}"
++echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..."
++"${TRUST}" extract --filter=certificates --format=openssl-directory \
++ --overwrite --comment "${DESTDIR}${CERTDIR}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS server auth certificates to ${DESTDIR}${CABUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose server-auth --overwrite --comment "${DESTDIR}${CABUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS S-Mime certificates to ${DESTDIR}${SMBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose email --overwrite --comment "${DESTDIR}${SMBUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS code signing certificates to ${DESTDIR}${CSBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose code-signing --overwrite --comment \
++ "${DESTDIR}${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting Java cacerts (JKS) to ${DESTDIR}${KEYSTORE}/cacerts..."
++"${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
++ --purpose server-auth --overwrite \
++ --comment "${DESTDIR}${KEYSTORE}/cacerts" \
++ && echo "Done!" || echo "Failed!!!"
+
+ # End /usr/sbin/make-ca
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..b7fb0dc7479
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,13 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.4
+revision=1
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v1.4/make-ca-1.4.tar.xz"
+checksum=89fd5533768ef5d6471bc824f8f3ad0dc5b4bb40779add0ba40ce565c9066162
From c5ed1e4f48e94d13651362425471550977550ca1 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:06:06 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
srcpkgs/openjdk-11/files/mkcacerts | 214 +++++++
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
10 files changed, 1332 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/mkcacerts
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/mkcacerts b/srcpkgs/openjdk-11/files/mkcacerts
new file mode 100644
index 00000000000..2db5a77bb05
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/mkcacerts
@@ -0,0 +1,214 @@
+#!/bin/sh
+# Script provided by http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html#ojdk-certs
+# EB 20141217: removed bashisms
+# Simple script to extract x509 certificates and create a JRE cacerts file.
+
+get_args()
+ {
+ if test -z "${1}" ; then
+ showhelp
+ exit 1
+ fi
+
+ while test -n "${1}" ; do
+ case "${1}" in
+ -f | --cafile)
+ check_arg $1 $2
+ CAFILE="${2}"
+ shift 2
+ ;;
+ -d | --cadir)
+ check_arg $1 $2
+ CADIR="${2}"
+ shift 2
+ ;;
+ -o | --outfile)
+ check_arg $1 $2
+ OUTFILE="${2}"
+ shift 2
+ ;;
+ -k | --keytool)
+ check_arg $1 $2
+ KEYTOOL="${2}"
+ shift 2
+ ;;
+ -s | --openssl)
+ check_arg $1 $2
+ OPENSSL="${2}"
+ shift 2
+ ;;
+ -h | --help)
+ showhelp
+ exit 0
+ ;;
+ *)
+ showhelp
+ exit 1
+ ;;
+ esac
+ done
+ }
+
+check_arg()
+ {
+ echo "${2}" | grep -v "^-" > /dev/null
+ if [ -z "$?" -o ! -n "$2" ]; then
+ echo "Error: $1 requires a valid argument."
+ exit 1
+ fi
+ }
+
+# The date binary is not reliable on 32bit systems for dates after 2038
+mydate()
+ {
+ local y=$( echo $1 | cut -d" " -f4 )
+ local M=$( echo $1 | cut -d" " -f1 )
+ local d=$( echo $1 | cut -d" " -f2 )
+ local m
+
+ if [ ${d} -lt 10 ]; then d="0${d}"; fi
+
+ case $M in
+ Jan) m="01";;
+ Feb) m="02";;
+ Mar) m="03";;
+ Apr) m="04";;
+ May) m="05";;
+ Jun) m="06";;
+ Jul) m="07";;
+ Aug) m="08";;
+ Sep) m="09";;
+ Oct) m="10";;
+ Nov) m="11";;
+ Dec) m="12";;
+ esac
+
+ certdate="${y}${m}${d}"
+ }
+
+showhelp()
+ {
+ echo "`basename ${0}` creates a valid cacerts file for use with IcedTea."
+ echo ""
+ echo " -f --cafile The path to a file containing PEM"
+ echo " formated CA certificates. May not be"
+ echo " used with -d/--cadir."
+ echo ""
+ echo " -d --cadir The path to a directory of PEM formatted"
+ echo " CA certificates. May not be used with"
+ echo " -f/--cafile."
+ echo ""
+ echo " -o --outfile The path to the output file."
+ echo ""
+ echo " -k --keytool The path to the java keytool utility."
+ echo ""
+ echo " -s --openssl The path to the openssl utility."
+ echo ""
+ echo " -h --help Show this help message and exit."
+ echo ""
+ echo ""
+ }
+
+# Initialize empty variables so that the shell does not pollute the script
+CAFILE=""
+CADIR=""
+OUTFILE=""
+OPENSSL=""
+KEYTOOL=""
+certdate=""
+date=""
+today=$( date +%Y%m%d )
+
+# Process command line arguments
+get_args ${@}
+
+# Handle common errors
+if test "${CAFILE}x" = "x" -a "${CADIR}x" = "x" ; then
+ echo "ERROR! You must provide an x509 certificate store!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${CAFILE}x" != "x" -a "${CADIR}x" != "x" ; then
+ echo "ERROR! You cannot provide two x509 certificate stores!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${KEYTOOL}x" = "x" ; then
+ echo "ERROR! You must provide a valid keytool program!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OPENSSL}x" = "x" ; then
+ echo "ERROR! You must provide a valid path to openssl!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OUTFILE}x" = "x" ; then
+ echo "ERROR! You must provide a valid output file!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+# Get on with the work
+
+# If using a CAFILE, split it into individual files in a temp directory
+if test "${CAFILE}x" != "x" ; then
+ TEMPDIR=`mktemp -d`
+ CADIR="${TEMPDIR}"
+
+ # Get a list of staring lines for each cert
+ CERTLIST=`grep -n "^-----BEGIN" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Get a list of ending lines for each cert
+ ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Start a loop
+ for certbegin in ${CERTLIST} ; do
+ for certend in ${ENDCERTLIST} ; do
+ if test "${certend}" -gt "${certbegin}"; then
+ break
+ fi
+ done
+ sed -n "${certbegin},${certend}p" "${CAFILE}" > "${CADIR}/${certbegin}.pem"
+ keyhash=`${OPENSSL} x509 -noout -in "${CADIR}/${certbegin}.pem" -hash`
+ echo "Generated PEM file with hash: ${keyhash}."
+ done
+fi
+
+# Write the output file
+for cert in `find "${CADIR}" -type f -name "*.pem" -o -name "*.crt"`
+do
+
+ # Make sure the certificate date is valid...
+ date=$( ${OPENSSL} x509 -enddate -in "${cert}" -noout | sed 's/^notAfter=//' )
+ mydate "${date}"
+ if test "${certdate}" -lt "${today}" ; then
+ echo "${cert} expired on ${certdate}! Skipping..."
+ unset date certdate
+ continue
+ fi
+ unset date certdate
+ ls "${cert}"
+ tempfile=`mktemp`
+ sed -n "/^-----BEGIN/,/^-----END/p" "${cert}" > "${tempfile}"
+ echo yes | env LC_ALL=C "${KEYTOOL}" -import \
+ -alias `basename "${cert}"` \
+ -keystore "${OUTFILE}" \
+ -storepass 'changeit' \
+ -file "${tempfile}"
+ rm "${tempfile}"
+done
+
+if test "${TEMPDIR}x" != "x" ; then
+ rm -rf "${TEMPDIR}"
+fi
+exit 0
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..9ba8c225cfc
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir ./ca -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (8 preceding siblings ...)
2019-09-04 1:02 ` voidlinux-github
@ 2019-09-04 21:03 ` voidlinux-github
2019-09-04 21:03 ` voidlinux-github
` (20 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 21:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 62364 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From fb5bf747903e72ce06e25e63da88e81f088007ad Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.4
---
srcpkgs/make-ca/patches/allow_destdir.patch | 63 +++++++++++++++++++++
srcpkgs/make-ca/template | 13 +++++
2 files changed, 76 insertions(+)
create mode 100644 srcpkgs/make-ca/patches/allow_destdir.patch
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/patches/allow_destdir.patch b/srcpkgs/make-ca/patches/allow_destdir.patch
new file mode 100644
index 00000000000..1ca8774a0fe
--- /dev/null
+++ b/srcpkgs/make-ca/patches/allow_destdir.patch
@@ -0,0 +1,63 @@
+This patch allows make-ca to generate certs in a specific destination directory.
+See: https://github.com/djlucas/make-ca/pull/3
+--- make-ca 2019-04-13 00:10:05.000000000 -0500
++++ make-ca 2019-09-04 11:26:41.929212855 -0500
+@@ -816,34 +816,32 @@ fi
+ # Clean up the mess
+ popd
+ rm -rf "${TEMPDIR}"
+
+ # Build ANCHORLIST
+-"${MD5SUM}" "${ANCHORDIR}"/*.pem > "${ANCHORLIST}"
++"${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/*.pem > "${DESTDIR}${ANCHORLIST}"
+
+-# Build alternate formats using p11-kit trust (if not using DESTDIR)
+-if test "x${DESTDIR}" == "x"; then
+- mkdir -p "${BUNDLEDIR}" "${KEYSTORE}"
+- echo -n "Extracting OpenSSL certificates to ${CERTDIR}..."
+- "${TRUST}" extract --filter=certificates --format=openssl-directory \
+- --overwrite --comment "${CERTDIR}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS server auth certificates to ${CABUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose server-auth --overwrite --comment "${CABUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS S-Mime certificates to ${SMBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose email --overwrite --comment "${SMBUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS code signing certificates to ${CSBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose code-signing --overwrite --comment \
+- "${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting Java cacerts (JKS) to ${KEYSTORE}/cacerts..."
+- "${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
+- --purpose server-auth --overwrite \
+- --comment "${KEYSTORE}/cacerts" \
+- && echo "Done!" || echo "Failed!!!"
+-fi
++# Build alternate formats using p11-kit trust
++mkdir -p "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}"
++echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..."
++"${TRUST}" extract --filter=certificates --format=openssl-directory \
++ --overwrite --comment "${DESTDIR}${CERTDIR}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS server auth certificates to ${DESTDIR}${CABUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose server-auth --overwrite --comment "${DESTDIR}${CABUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS S-Mime certificates to ${DESTDIR}${SMBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose email --overwrite --comment "${DESTDIR}${SMBUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS code signing certificates to ${DESTDIR}${CSBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose code-signing --overwrite --comment \
++ "${DESTDIR}${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting Java cacerts (JKS) to ${DESTDIR}${KEYSTORE}/cacerts..."
++"${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
++ --purpose server-auth --overwrite \
++ --comment "${DESTDIR}${KEYSTORE}/cacerts" \
++ && echo "Done!" || echo "Failed!!!"
+
+ # End /usr/sbin/make-ca
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..b7fb0dc7479
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,13 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.4
+revision=1
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v1.4/make-ca-1.4.tar.xz"
+checksum=89fd5533768ef5d6471bc824f8f3ad0dc5b4bb40779add0ba40ce565c9066162
From c5ed1e4f48e94d13651362425471550977550ca1 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:06:06 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
srcpkgs/openjdk-11/files/mkcacerts | 214 +++++++
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
10 files changed, 1332 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/mkcacerts
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/mkcacerts b/srcpkgs/openjdk-11/files/mkcacerts
new file mode 100644
index 00000000000..2db5a77bb05
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/mkcacerts
@@ -0,0 +1,214 @@
+#!/bin/sh
+# Script provided by http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html#ojdk-certs
+# EB 20141217: removed bashisms
+# Simple script to extract x509 certificates and create a JRE cacerts file.
+
+get_args()
+ {
+ if test -z "${1}" ; then
+ showhelp
+ exit 1
+ fi
+
+ while test -n "${1}" ; do
+ case "${1}" in
+ -f | --cafile)
+ check_arg $1 $2
+ CAFILE="${2}"
+ shift 2
+ ;;
+ -d | --cadir)
+ check_arg $1 $2
+ CADIR="${2}"
+ shift 2
+ ;;
+ -o | --outfile)
+ check_arg $1 $2
+ OUTFILE="${2}"
+ shift 2
+ ;;
+ -k | --keytool)
+ check_arg $1 $2
+ KEYTOOL="${2}"
+ shift 2
+ ;;
+ -s | --openssl)
+ check_arg $1 $2
+ OPENSSL="${2}"
+ shift 2
+ ;;
+ -h | --help)
+ showhelp
+ exit 0
+ ;;
+ *)
+ showhelp
+ exit 1
+ ;;
+ esac
+ done
+ }
+
+check_arg()
+ {
+ echo "${2}" | grep -v "^-" > /dev/null
+ if [ -z "$?" -o ! -n "$2" ]; then
+ echo "Error: $1 requires a valid argument."
+ exit 1
+ fi
+ }
+
+# The date binary is not reliable on 32bit systems for dates after 2038
+mydate()
+ {
+ local y=$( echo $1 | cut -d" " -f4 )
+ local M=$( echo $1 | cut -d" " -f1 )
+ local d=$( echo $1 | cut -d" " -f2 )
+ local m
+
+ if [ ${d} -lt 10 ]; then d="0${d}"; fi
+
+ case $M in
+ Jan) m="01";;
+ Feb) m="02";;
+ Mar) m="03";;
+ Apr) m="04";;
+ May) m="05";;
+ Jun) m="06";;
+ Jul) m="07";;
+ Aug) m="08";;
+ Sep) m="09";;
+ Oct) m="10";;
+ Nov) m="11";;
+ Dec) m="12";;
+ esac
+
+ certdate="${y}${m}${d}"
+ }
+
+showhelp()
+ {
+ echo "`basename ${0}` creates a valid cacerts file for use with IcedTea."
+ echo ""
+ echo " -f --cafile The path to a file containing PEM"
+ echo " formated CA certificates. May not be"
+ echo " used with -d/--cadir."
+ echo ""
+ echo " -d --cadir The path to a directory of PEM formatted"
+ echo " CA certificates. May not be used with"
+ echo " -f/--cafile."
+ echo ""
+ echo " -o --outfile The path to the output file."
+ echo ""
+ echo " -k --keytool The path to the java keytool utility."
+ echo ""
+ echo " -s --openssl The path to the openssl utility."
+ echo ""
+ echo " -h --help Show this help message and exit."
+ echo ""
+ echo ""
+ }
+
+# Initialize empty variables so that the shell does not pollute the script
+CAFILE=""
+CADIR=""
+OUTFILE=""
+OPENSSL=""
+KEYTOOL=""
+certdate=""
+date=""
+today=$( date +%Y%m%d )
+
+# Process command line arguments
+get_args ${@}
+
+# Handle common errors
+if test "${CAFILE}x" = "x" -a "${CADIR}x" = "x" ; then
+ echo "ERROR! You must provide an x509 certificate store!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${CAFILE}x" != "x" -a "${CADIR}x" != "x" ; then
+ echo "ERROR! You cannot provide two x509 certificate stores!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${KEYTOOL}x" = "x" ; then
+ echo "ERROR! You must provide a valid keytool program!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OPENSSL}x" = "x" ; then
+ echo "ERROR! You must provide a valid path to openssl!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+if test "${OUTFILE}x" = "x" ; then
+ echo "ERROR! You must provide a valid output file!"
+ echo "\'$(basename ${0}) --help\' for more info."
+ echo ""
+ exit 1
+fi
+
+# Get on with the work
+
+# If using a CAFILE, split it into individual files in a temp directory
+if test "${CAFILE}x" != "x" ; then
+ TEMPDIR=`mktemp -d`
+ CADIR="${TEMPDIR}"
+
+ # Get a list of staring lines for each cert
+ CERTLIST=`grep -n "^-----BEGIN" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Get a list of ending lines for each cert
+ ENDCERTLIST=`grep -n "^-----END" "${CAFILE}" | cut -d ":" -f 1`
+
+ # Start a loop
+ for certbegin in ${CERTLIST} ; do
+ for certend in ${ENDCERTLIST} ; do
+ if test "${certend}" -gt "${certbegin}"; then
+ break
+ fi
+ done
+ sed -n "${certbegin},${certend}p" "${CAFILE}" > "${CADIR}/${certbegin}.pem"
+ keyhash=`${OPENSSL} x509 -noout -in "${CADIR}/${certbegin}.pem" -hash`
+ echo "Generated PEM file with hash: ${keyhash}."
+ done
+fi
+
+# Write the output file
+for cert in `find "${CADIR}" -type f -name "*.pem" -o -name "*.crt"`
+do
+
+ # Make sure the certificate date is valid...
+ date=$( ${OPENSSL} x509 -enddate -in "${cert}" -noout | sed 's/^notAfter=//' )
+ mydate "${date}"
+ if test "${certdate}" -lt "${today}" ; then
+ echo "${cert} expired on ${certdate}! Skipping..."
+ unset date certdate
+ continue
+ fi
+ unset date certdate
+ ls "${cert}"
+ tempfile=`mktemp`
+ sed -n "/^-----BEGIN/,/^-----END/p" "${cert}" > "${tempfile}"
+ echo yes | env LC_ALL=C "${KEYTOOL}" -import \
+ -alias `basename "${cert}"` \
+ -keystore "${OUTFILE}" \
+ -storepass 'changeit' \
+ -file "${tempfile}"
+ rm "${tempfile}"
+done
+
+if test "${TEMPDIR}x" != "x" ; then
+ rm -rf "${TEMPDIR}"
+fi
+exit 0
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..9ba8c225cfc
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir ./ca -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (11 preceding siblings ...)
2019-09-04 21:06 ` voidlinux-github
@ 2019-09-04 21:06 ` voidlinux-github
2019-09-04 21:11 ` voidlinux-github
` (17 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 21:06 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 55604 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From fb5bf747903e72ce06e25e63da88e81f088007ad Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.4
---
srcpkgs/make-ca/patches/allow_destdir.patch | 63 +++++++++++++++++++++
srcpkgs/make-ca/template | 13 +++++
2 files changed, 76 insertions(+)
create mode 100644 srcpkgs/make-ca/patches/allow_destdir.patch
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/patches/allow_destdir.patch b/srcpkgs/make-ca/patches/allow_destdir.patch
new file mode 100644
index 00000000000..1ca8774a0fe
--- /dev/null
+++ b/srcpkgs/make-ca/patches/allow_destdir.patch
@@ -0,0 +1,63 @@
+This patch allows make-ca to generate certs in a specific destination directory.
+See: https://github.com/djlucas/make-ca/pull/3
+--- make-ca 2019-04-13 00:10:05.000000000 -0500
++++ make-ca 2019-09-04 11:26:41.929212855 -0500
+@@ -816,34 +816,32 @@ fi
+ # Clean up the mess
+ popd
+ rm -rf "${TEMPDIR}"
+
+ # Build ANCHORLIST
+-"${MD5SUM}" "${ANCHORDIR}"/*.pem > "${ANCHORLIST}"
++"${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/*.pem > "${DESTDIR}${ANCHORLIST}"
+
+-# Build alternate formats using p11-kit trust (if not using DESTDIR)
+-if test "x${DESTDIR}" == "x"; then
+- mkdir -p "${BUNDLEDIR}" "${KEYSTORE}"
+- echo -n "Extracting OpenSSL certificates to ${CERTDIR}..."
+- "${TRUST}" extract --filter=certificates --format=openssl-directory \
+- --overwrite --comment "${CERTDIR}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS server auth certificates to ${CABUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose server-auth --overwrite --comment "${CABUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS S-Mime certificates to ${SMBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose email --overwrite --comment "${SMBUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS code signing certificates to ${CSBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose code-signing --overwrite --comment \
+- "${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting Java cacerts (JKS) to ${KEYSTORE}/cacerts..."
+- "${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
+- --purpose server-auth --overwrite \
+- --comment "${KEYSTORE}/cacerts" \
+- && echo "Done!" || echo "Failed!!!"
+-fi
++# Build alternate formats using p11-kit trust
++mkdir -p "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}"
++echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..."
++"${TRUST}" extract --filter=certificates --format=openssl-directory \
++ --overwrite --comment "${DESTDIR}${CERTDIR}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS server auth certificates to ${DESTDIR}${CABUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose server-auth --overwrite --comment "${DESTDIR}${CABUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS S-Mime certificates to ${DESTDIR}${SMBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose email --overwrite --comment "${DESTDIR}${SMBUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS code signing certificates to ${DESTDIR}${CSBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose code-signing --overwrite --comment \
++ "${DESTDIR}${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting Java cacerts (JKS) to ${DESTDIR}${KEYSTORE}/cacerts..."
++"${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
++ --purpose server-auth --overwrite \
++ --comment "${DESTDIR}${KEYSTORE}/cacerts" \
++ && echo "Done!" || echo "Failed!!!"
+
+ # End /usr/sbin/make-ca
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..b7fb0dc7479
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,13 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.4
+revision=1
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v1.4/make-ca-1.4.tar.xz"
+checksum=89fd5533768ef5d6471bc824f8f3ad0dc5b4bb40779add0ba40ce565c9066162
From 7df2009e553457085c1175b3e173f44dd406504e Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 16:06:50 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
9 files changed, 1118 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..9ba8c225cfc
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir ./ca -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (10 preceding siblings ...)
2019-09-04 21:03 ` voidlinux-github
@ 2019-09-04 21:06 ` voidlinux-github
2019-09-04 21:06 ` voidlinux-github
` (18 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 21:06 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 55604 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From fb5bf747903e72ce06e25e63da88e81f088007ad Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.4
---
srcpkgs/make-ca/patches/allow_destdir.patch | 63 +++++++++++++++++++++
srcpkgs/make-ca/template | 13 +++++
2 files changed, 76 insertions(+)
create mode 100644 srcpkgs/make-ca/patches/allow_destdir.patch
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/patches/allow_destdir.patch b/srcpkgs/make-ca/patches/allow_destdir.patch
new file mode 100644
index 00000000000..1ca8774a0fe
--- /dev/null
+++ b/srcpkgs/make-ca/patches/allow_destdir.patch
@@ -0,0 +1,63 @@
+This patch allows make-ca to generate certs in a specific destination directory.
+See: https://github.com/djlucas/make-ca/pull/3
+--- make-ca 2019-04-13 00:10:05.000000000 -0500
++++ make-ca 2019-09-04 11:26:41.929212855 -0500
+@@ -816,34 +816,32 @@ fi
+ # Clean up the mess
+ popd
+ rm -rf "${TEMPDIR}"
+
+ # Build ANCHORLIST
+-"${MD5SUM}" "${ANCHORDIR}"/*.pem > "${ANCHORLIST}"
++"${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/*.pem > "${DESTDIR}${ANCHORLIST}"
+
+-# Build alternate formats using p11-kit trust (if not using DESTDIR)
+-if test "x${DESTDIR}" == "x"; then
+- mkdir -p "${BUNDLEDIR}" "${KEYSTORE}"
+- echo -n "Extracting OpenSSL certificates to ${CERTDIR}..."
+- "${TRUST}" extract --filter=certificates --format=openssl-directory \
+- --overwrite --comment "${CERTDIR}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS server auth certificates to ${CABUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose server-auth --overwrite --comment "${CABUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS S-Mime certificates to ${SMBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose email --overwrite --comment "${SMBUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS code signing certificates to ${CSBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose code-signing --overwrite --comment \
+- "${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting Java cacerts (JKS) to ${KEYSTORE}/cacerts..."
+- "${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
+- --purpose server-auth --overwrite \
+- --comment "${KEYSTORE}/cacerts" \
+- && echo "Done!" || echo "Failed!!!"
+-fi
++# Build alternate formats using p11-kit trust
++mkdir -p "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}"
++echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..."
++"${TRUST}" extract --filter=certificates --format=openssl-directory \
++ --overwrite --comment "${DESTDIR}${CERTDIR}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS server auth certificates to ${DESTDIR}${CABUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose server-auth --overwrite --comment "${DESTDIR}${CABUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS S-Mime certificates to ${DESTDIR}${SMBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose email --overwrite --comment "${DESTDIR}${SMBUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS code signing certificates to ${DESTDIR}${CSBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose code-signing --overwrite --comment \
++ "${DESTDIR}${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting Java cacerts (JKS) to ${DESTDIR}${KEYSTORE}/cacerts..."
++"${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
++ --purpose server-auth --overwrite \
++ --comment "${DESTDIR}${KEYSTORE}/cacerts" \
++ && echo "Done!" || echo "Failed!!!"
+
+ # End /usr/sbin/make-ca
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..b7fb0dc7479
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,13 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.4
+revision=1
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v1.4/make-ca-1.4.tar.xz"
+checksum=89fd5533768ef5d6471bc824f8f3ad0dc5b4bb40779add0ba40ce565c9066162
From 7df2009e553457085c1175b3e173f44dd406504e Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 16:06:50 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
9 files changed, 1118 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..9ba8c225cfc
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir ./ca -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (12 preceding siblings ...)
2019-09-04 21:06 ` voidlinux-github
@ 2019-09-04 21:11 ` voidlinux-github
2019-09-04 21:12 ` voidlinux-github
` (16 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 21:11 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-528089029
Comment:
@the-maldridge I did you (what I think is) one better. The source of mkcacerts (LFS) now instead recommends a package that contains a slightly different script, `make-ca`. I packaged that and made it a dependency. I think that's good since the package can be useful on its own. Instead of stuffing `mkcacerts` into the java `bin` directory, we can just let users install `make-ca` if they want. If that's no good, I can just pull it in as part of the openjdk build.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (13 preceding siblings ...)
2019-09-04 21:11 ` voidlinux-github
@ 2019-09-04 21:12 ` voidlinux-github
2019-09-04 22:45 ` [PR PATCH] [Updated] " voidlinux-github
` (15 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 21:12 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 610 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-528089029
Comment:
@the-maldridge I did you (what I think is) one better. The source of `mkcacerts` (LFS) now instead recommends a package that contains a slightly different script, `make-ca`. I packaged that and made it a dependency. I think that's good since the package can be useful on its own. Instead of stuffing `mkcacerts` into the java `bin` directory, we can just let users install `make-ca` if they want. If that's no good, I can just pull it in as part of the openjdk build.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (14 preceding siblings ...)
2019-09-04 21:12 ` voidlinux-github
@ 2019-09-04 22:45 ` voidlinux-github
2019-09-04 22:45 ` voidlinux-github
` (14 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 22:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 55611 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From fb5bf747903e72ce06e25e63da88e81f088007ad Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.4
---
srcpkgs/make-ca/patches/allow_destdir.patch | 63 +++++++++++++++++++++
srcpkgs/make-ca/template | 13 +++++
2 files changed, 76 insertions(+)
create mode 100644 srcpkgs/make-ca/patches/allow_destdir.patch
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/patches/allow_destdir.patch b/srcpkgs/make-ca/patches/allow_destdir.patch
new file mode 100644
index 00000000000..1ca8774a0fe
--- /dev/null
+++ b/srcpkgs/make-ca/patches/allow_destdir.patch
@@ -0,0 +1,63 @@
+This patch allows make-ca to generate certs in a specific destination directory.
+See: https://github.com/djlucas/make-ca/pull/3
+--- make-ca 2019-04-13 00:10:05.000000000 -0500
++++ make-ca 2019-09-04 11:26:41.929212855 -0500
+@@ -816,34 +816,32 @@ fi
+ # Clean up the mess
+ popd
+ rm -rf "${TEMPDIR}"
+
+ # Build ANCHORLIST
+-"${MD5SUM}" "${ANCHORDIR}"/*.pem > "${ANCHORLIST}"
++"${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/*.pem > "${DESTDIR}${ANCHORLIST}"
+
+-# Build alternate formats using p11-kit trust (if not using DESTDIR)
+-if test "x${DESTDIR}" == "x"; then
+- mkdir -p "${BUNDLEDIR}" "${KEYSTORE}"
+- echo -n "Extracting OpenSSL certificates to ${CERTDIR}..."
+- "${TRUST}" extract --filter=certificates --format=openssl-directory \
+- --overwrite --comment "${CERTDIR}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS server auth certificates to ${CABUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose server-auth --overwrite --comment "${CABUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS S-Mime certificates to ${SMBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose email --overwrite --comment "${SMBUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS code signing certificates to ${CSBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose code-signing --overwrite --comment \
+- "${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting Java cacerts (JKS) to ${KEYSTORE}/cacerts..."
+- "${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
+- --purpose server-auth --overwrite \
+- --comment "${KEYSTORE}/cacerts" \
+- && echo "Done!" || echo "Failed!!!"
+-fi
++# Build alternate formats using p11-kit trust
++mkdir -p "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}"
++echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..."
++"${TRUST}" extract --filter=certificates --format=openssl-directory \
++ --overwrite --comment "${DESTDIR}${CERTDIR}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS server auth certificates to ${DESTDIR}${CABUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose server-auth --overwrite --comment "${DESTDIR}${CABUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS S-Mime certificates to ${DESTDIR}${SMBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose email --overwrite --comment "${DESTDIR}${SMBUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS code signing certificates to ${DESTDIR}${CSBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose code-signing --overwrite --comment \
++ "${DESTDIR}${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting Java cacerts (JKS) to ${DESTDIR}${KEYSTORE}/cacerts..."
++"${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
++ --purpose server-auth --overwrite \
++ --comment "${DESTDIR}${KEYSTORE}/cacerts" \
++ && echo "Done!" || echo "Failed!!!"
+
+ # End /usr/sbin/make-ca
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..b7fb0dc7479
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,13 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.4
+revision=1
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v1.4/make-ca-1.4.tar.xz"
+checksum=89fd5533768ef5d6471bc824f8f3ad0dc5b4bb40779add0ba40ce565c9066162
From e5522fd297b3f81881c75e1a9d7a4ca9075388a8 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 16:06:50 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
9 files changed, 1118 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..22a87d499fd
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] WIP: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (15 preceding siblings ...)
2019-09-04 22:45 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-09-04 22:45 ` voidlinux-github
2019-09-11 20:36 ` [PR PATCH] [Updated] " voidlinux-github
` (13 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-04 22:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 618 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
WIP: Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 55611 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From fb5bf747903e72ce06e25e63da88e81f088007ad Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.4
---
srcpkgs/make-ca/patches/allow_destdir.patch | 63 +++++++++++++++++++++
srcpkgs/make-ca/template | 13 +++++
2 files changed, 76 insertions(+)
create mode 100644 srcpkgs/make-ca/patches/allow_destdir.patch
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/patches/allow_destdir.patch b/srcpkgs/make-ca/patches/allow_destdir.patch
new file mode 100644
index 00000000000..1ca8774a0fe
--- /dev/null
+++ b/srcpkgs/make-ca/patches/allow_destdir.patch
@@ -0,0 +1,63 @@
+This patch allows make-ca to generate certs in a specific destination directory.
+See: https://github.com/djlucas/make-ca/pull/3
+--- make-ca 2019-04-13 00:10:05.000000000 -0500
++++ make-ca 2019-09-04 11:26:41.929212855 -0500
+@@ -816,34 +816,32 @@ fi
+ # Clean up the mess
+ popd
+ rm -rf "${TEMPDIR}"
+
+ # Build ANCHORLIST
+-"${MD5SUM}" "${ANCHORDIR}"/*.pem > "${ANCHORLIST}"
++"${MD5SUM}" "${DESTDIR}${ANCHORDIR}"/*.pem > "${DESTDIR}${ANCHORLIST}"
+
+-# Build alternate formats using p11-kit trust (if not using DESTDIR)
+-if test "x${DESTDIR}" == "x"; then
+- mkdir -p "${BUNDLEDIR}" "${KEYSTORE}"
+- echo -n "Extracting OpenSSL certificates to ${CERTDIR}..."
+- "${TRUST}" extract --filter=certificates --format=openssl-directory \
+- --overwrite --comment "${CERTDIR}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS server auth certificates to ${CABUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose server-auth --overwrite --comment "${CABUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS S-Mime certificates to ${SMBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose email --overwrite --comment "${SMBUNDLE}" \
+- && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting GNUTLS code signing certificates to ${CSBUNDLE}..."
+- "${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
+- --purpose code-signing --overwrite --comment \
+- "${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
+- echo -n "Extracting Java cacerts (JKS) to ${KEYSTORE}/cacerts..."
+- "${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
+- --purpose server-auth --overwrite \
+- --comment "${KEYSTORE}/cacerts" \
+- && echo "Done!" || echo "Failed!!!"
+-fi
++# Build alternate formats using p11-kit trust
++mkdir -p "${DESTDIR}${BUNDLEDIR}" "${DESTDIR}${KEYSTORE}"
++echo -n "Extracting OpenSSL certificates to ${DESTDIR}${CERTDIR}..."
++"${TRUST}" extract --filter=certificates --format=openssl-directory \
++ --overwrite --comment "${DESTDIR}${CERTDIR}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS server auth certificates to ${DESTDIR}${CABUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose server-auth --overwrite --comment "${DESTDIR}${CABUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS S-Mime certificates to ${DESTDIR}${SMBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose email --overwrite --comment "${DESTDIR}${SMBUNDLE}" \
++ && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting GNUTLS code signing certificates to ${DESTDIR}${CSBUNDLE}..."
++"${TRUST}" extract --filter=ca-anchors --format=pem-bundle \
++ --purpose code-signing --overwrite --comment \
++ "${DESTDIR}${CSBUNDLE}" && echo "Done!" || echo "Failed!!!"
++echo -n "Extracting Java cacerts (JKS) to ${DESTDIR}${KEYSTORE}/cacerts..."
++"${TRUST}" extract --filter=ca-anchors --format=java-cacerts \
++ --purpose server-auth --overwrite \
++ --comment "${DESTDIR}${KEYSTORE}/cacerts" \
++ && echo "Done!" || echo "Failed!!!"
+
+ # End /usr/sbin/make-ca
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..b7fb0dc7479
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,13 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.4
+revision=1
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v1.4/make-ca-1.4.tar.xz"
+checksum=89fd5533768ef5d6471bc824f8f3ad0dc5b4bb40779add0ba40ce565c9066162
From e5522fd297b3f81881c75e1a9d7a4ca9075388a8 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 16:06:50 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
9 files changed, 1118 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..22a87d499fd
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (17 preceding siblings ...)
2019-09-11 20:36 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-09-11 20:36 ` voidlinux-github
2019-09-11 20:36 ` voidlinux-github
` (11 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-11 20:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 51653 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From f24f277bd4fd282d4451fe77414bae0916715e2e Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.5
---
srcpkgs/make-ca/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..0d5c019835d
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,14 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.5
+revision=1
+wrksrc="make-ca-${version}"
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v${version}/make-ca-${version}.tar.xz"
+checksum=e75771dd73eb97189339379626fb42241ee579058c6ea2900ec850e7d96179f7
From ab068a12267ea335f6c63c5f44fdce46f126661b Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 16:06:50 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
9 files changed, 1118 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..22a87d499fd
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (16 preceding siblings ...)
2019-09-04 22:45 ` voidlinux-github
@ 2019-09-11 20:36 ` voidlinux-github
2019-09-11 20:36 ` voidlinux-github
` (12 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-11 20:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 51653 bytes --]
From 9bd4cd5c9953c43d4ea0bea891b596f7f4879efa Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Fri, 16 Aug 2019 17:20:13 -0500
Subject: [PATCH 1/3] New package: openjdk-11-bin-11+28
---
srcpkgs/openjdk-11-bin/template | 73 +++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk-11-bin/template
diff --git a/srcpkgs/openjdk-11-bin/template b/srcpkgs/openjdk-11-bin/template
new file mode 100644
index 00000000000..64dfaaef229
--- /dev/null
+++ b/srcpkgs/openjdk-11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk-11-bin'
+pkgname=openjdk-11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk-11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk-11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk-11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk-11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk-11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk-11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk-11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk-11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk-11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk-11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk-11-bin
+}
From f24f277bd4fd282d4451fe77414bae0916715e2e Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 15:05:26 -0500
Subject: [PATCH 2/3] New package: make-ca-1.5
---
srcpkgs/make-ca/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..0d5c019835d
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,14 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.5
+revision=1
+wrksrc="make-ca-${version}"
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v${version}/make-ca-${version}.tar.xz"
+checksum=e75771dd73eb97189339379626fb42241ee579058c6ea2900ec850e7d96179f7
From ab068a12267ea335f6c63c5f44fdce46f126661b Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 4 Sep 2019 16:06:50 -0500
Subject: [PATCH 3/3] New package: openjdk-11-11+28
---
common/shlibs | 6 +
srcpkgs/openjdk-11-doc | 1 +
srcpkgs/openjdk-11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk-11/files/musl_patches/arm.patch | 30 +
.../openjdk-11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk-11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk-11/template | 181 ++++++
9 files changed, 1118 insertions(+)
create mode 120000 srcpkgs/openjdk-11-doc
create mode 120000 srcpkgs/openjdk-11-src
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk-11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk-11/template
diff --git a/common/shlibs b/common/shlibs
index 11442f1b936..e86c92c74d8 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1775,6 +1775,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk-11-11.0.4+11_1
+libawt.so openjdk-11-11.0.4+11_1
+libawt_xawt.so openjdk-11-11.0.4+11_1
+libjava.so openjdk-11-11.0.4+11_1
+libjli.so openjdk-11-11.0.4+11_1
+libjvm.so openjdk-11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk-11-doc b/srcpkgs/openjdk-11-doc
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-doc
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11-src b/srcpkgs/openjdk-11-src
new file mode 120000
index 00000000000..7faba71b9a8
--- /dev/null
+++ b/srcpkgs/openjdk-11-src
@@ -0,0 +1 @@
+openjdk-11
\ No newline at end of file
diff --git a/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk-11/files/musl_patches/arm.patch b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk-11/files/musl_patches/build.patch b/srcpkgs/openjdk-11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk-11/files/musl_patches/x86.patch b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk-11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk-11/template b/srcpkgs/openjdk-11/template
new file mode 100644
index 00000000000..22a87d499fd
--- /dev/null
+++ b/srcpkgs/openjdk-11/template
@@ -0,0 +1,181 @@
+# Template file for 'openjdk-11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk-11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk-11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11"
+else
+ hostmakedepends+=" openjdk-11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk-11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk-11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk-11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk-11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk-11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk-11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk-11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk-11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk-11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk-11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk-11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk-11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk-11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk-11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk-11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk-11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk-11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk-11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk-11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk-11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk-11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk-11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk-11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk-11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk-11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk-11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk-11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk-11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk-11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk-11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk-11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk-11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk-11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk-11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk-11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk-11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk-11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk-11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk-11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk-11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk-11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk-11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk-11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ pkg_install() {
+ cd ${wrksrc}
+ if [ "$build_option_docs" ]; then
+ vmkdir usr/share/doc/openjdk-11
+ cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/usr/share/doc/openjdk-11
+ fi
+ vmove usr/lib/jvm/openjdk-11/man/man1/
+ }
+}
+
+openjdk-11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk-11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (18 preceding siblings ...)
2019-09-11 20:36 ` voidlinux-github
@ 2019-09-11 20:36 ` voidlinux-github
2019-09-11 22:02 ` voidlinux-github
` (10 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-11 20:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 230 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-530555096
Comment:
make-ca merged my change and released a new version, so those patches have been removed.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (19 preceding siblings ...)
2019-09-11 20:36 ` voidlinux-github
@ 2019-09-11 22:02 ` voidlinux-github
2019-09-17 23:47 ` voidlinux-github
` (9 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-11 22:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 188 bytes --]
New comment by Vaelatern on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-530583869
Comment:
I'm going to look at this and give it a spin.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (20 preceding siblings ...)
2019-09-11 22:02 ` voidlinux-github
@ 2019-09-17 23:47 ` voidlinux-github
2019-09-18 15:12 ` voidlinux-github
` (8 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-17 23:47 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 415 bytes --]
New comment by abenson on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-532444076
Comment:
Testing this right now as well. Seems to be working well for me at, least. The only thing I wonder about is the package name: Should they not by `openjdk11`, the extra '-' doesn't match with the convention followed for other versioned package names (`libssl*`, for example).
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (21 preceding siblings ...)
2019-09-17 23:47 ` voidlinux-github
@ 2019-09-18 15:12 ` voidlinux-github
2019-09-18 18:21 ` [PR PATCH] [Updated] " voidlinux-github
` (7 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-18 15:12 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-532730690
Comment:
@abenson You're right about the name. I don't see any written rules about it, but all the packages I see in this repo seem to follow the convention you describe. I'll change the name.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (22 preceding siblings ...)
2019-09-18 15:12 ` voidlinux-github
@ 2019-09-18 18:21 ` voidlinux-github
2019-09-18 18:21 ` voidlinux-github
` (6 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-18 18:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 51536 bytes --]
From 3be74b43eca907741764c2866c364cbf9ff9bfe7 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 18 Sep 2019 12:30:46 -0500
Subject: [PATCH 1/3] New package: make-ca-1.5
---
srcpkgs/make-ca/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..0d5c019835d
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,14 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.5
+revision=1
+wrksrc="make-ca-${version}"
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v${version}/make-ca-${version}.tar.xz"
+checksum=e75771dd73eb97189339379626fb42241ee579058c6ea2900ec850e7d96179f7
From ca0f5870304f0a279528fe28d2d86aac917df077 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 18 Sep 2019 12:34:57 -0500
Subject: [PATCH 2/3] New package: openjdk11-bin-11+28
---
srcpkgs/openjdk11-bin/template | 73 ++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk11-bin/template
diff --git a/srcpkgs/openjdk11-bin/template b/srcpkgs/openjdk11-bin/template
new file mode 100644
index 00000000000..b2da83d21eb
--- /dev/null
+++ b/srcpkgs/openjdk11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk11-bin'
+pkgname=openjdk11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk11-bin
+}
From 6f379b4ad295102e6b532ee066abc17347e72ab0 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 18 Sep 2019 12:36:04 -0500
Subject: [PATCH 3/3] New package: openjdk11-11.0.4+11
---
common/shlibs | 6 +
srcpkgs/openjdk11-doc | 1 +
srcpkgs/openjdk11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk11/files/musl_patches/arm.patch | 30 +
.../openjdk11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk11/template | 183 ++++++
9 files changed, 1120 insertions(+)
create mode 120000 srcpkgs/openjdk11-doc
create mode 120000 srcpkgs/openjdk11-src
create mode 100644 srcpkgs/openjdk11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk11/template
diff --git a/common/shlibs b/common/shlibs
index b5b6086d24f..97e40381641 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1778,6 +1778,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk11-11.0.4+11_1
+libawt.so openjdk11-11.0.4+11_1
+libawt_xawt.so openjdk11-11.0.4+11_1
+libjava.so openjdk11-11.0.4+11_1
+libjli.so openjdk11-11.0.4+11_1
+libjvm.so openjdk11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk11-doc b/srcpkgs/openjdk11-doc
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-doc
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11-src b/srcpkgs/openjdk11-src
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-src
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk11/files/musl_patches/arm.patch b/srcpkgs/openjdk11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk11/files/musl_patches/build.patch b/srcpkgs/openjdk11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk11/files/musl_patches/x86.patch b/srcpkgs/openjdk11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template
new file mode 100644
index 00000000000..c63d1a214b9
--- /dev/null
+++ b/srcpkgs/openjdk11/template
@@ -0,0 +1,183 @@
+# Template file for 'openjdk11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11"
+else
+ hostmakedepends+=" openjdk11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ chmod -R ugo+rw ./ca
+ rm -Rf ./ca
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ 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
+ vmove usr/lib/jvm/openjdk11/man/man1/
+ }
+}
+
+openjdk11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (23 preceding siblings ...)
2019-09-18 18:21 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-09-18 18:21 ` voidlinux-github
2019-09-18 18:21 ` voidlinux-github
` (5 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-18 18:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 51536 bytes --]
From 3be74b43eca907741764c2866c364cbf9ff9bfe7 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 18 Sep 2019 12:30:46 -0500
Subject: [PATCH 1/3] New package: make-ca-1.5
---
srcpkgs/make-ca/template | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..0d5c019835d
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,14 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.5
+revision=1
+wrksrc="make-ca-${version}"
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v${version}/make-ca-${version}.tar.xz"
+checksum=e75771dd73eb97189339379626fb42241ee579058c6ea2900ec850e7d96179f7
From ca0f5870304f0a279528fe28d2d86aac917df077 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 18 Sep 2019 12:34:57 -0500
Subject: [PATCH 2/3] New package: openjdk11-bin-11+28
---
srcpkgs/openjdk11-bin/template | 73 ++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk11-bin/template
diff --git a/srcpkgs/openjdk11-bin/template b/srcpkgs/openjdk11-bin/template
new file mode 100644
index 00000000000..b2da83d21eb
--- /dev/null
+++ b/srcpkgs/openjdk11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk11-bin'
+pkgname=openjdk11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk11-bin
+}
From 6f379b4ad295102e6b532ee066abc17347e72ab0 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Wed, 18 Sep 2019 12:36:04 -0500
Subject: [PATCH 3/3] New package: openjdk11-11.0.4+11
---
common/shlibs | 6 +
srcpkgs/openjdk11-doc | 1 +
srcpkgs/openjdk11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk11/files/musl_patches/arm.patch | 30 +
.../openjdk11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk11/template | 183 ++++++
9 files changed, 1120 insertions(+)
create mode 120000 srcpkgs/openjdk11-doc
create mode 120000 srcpkgs/openjdk11-src
create mode 100644 srcpkgs/openjdk11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk11/template
diff --git a/common/shlibs b/common/shlibs
index b5b6086d24f..97e40381641 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1778,6 +1778,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk11-11.0.4+11_1
+libawt.so openjdk11-11.0.4+11_1
+libawt_xawt.so openjdk11-11.0.4+11_1
+libjava.so openjdk11-11.0.4+11_1
+libjli.so openjdk11-11.0.4+11_1
+libjvm.so openjdk11-11.0.4+11_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk11-doc b/srcpkgs/openjdk11-doc
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-doc
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11-src b/srcpkgs/openjdk11-src
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-src
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk11/files/musl_patches/arm.patch b/srcpkgs/openjdk11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk11/files/musl_patches/build.patch b/srcpkgs/openjdk11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk11/files/musl_patches/x86.patch b/srcpkgs/openjdk11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template
new file mode 100644
index 00000000000..c63d1a214b9
--- /dev/null
+++ b/srcpkgs/openjdk11/template
@@ -0,0 +1,183 @@
+# Template file for 'openjdk11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=4
+_jdk_update=11
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=272aeab0b68262e270b9e2f9aae9a37a9793b110428c8d96d486c094cc6a6429
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11"
+else
+ hostmakedepends+=" openjdk11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ chmod -R ugo+rw ./ca
+ rm -Rf ./ca
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ 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
+ vmove usr/lib/jvm/openjdk11/man/man1/
+ }
+}
+
+openjdk11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (24 preceding siblings ...)
2019-09-18 18:21 ` voidlinux-github
@ 2019-09-18 18:21 ` voidlinux-github
2019-10-28 23:37 ` voidlinux-github
` (4 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-09-18 18:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 179 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-532806242
Comment:
Updated `openjdk-11` to `openjdk11`
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (25 preceding siblings ...)
2019-09-18 18:21 ` voidlinux-github
@ 2019-10-28 23:37 ` voidlinux-github
2019-10-29 17:36 ` [PR PATCH] [Updated] " voidlinux-github
` (3 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-10-28 23:37 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 208 bytes --]
New comment by Johnnynator on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-547191850
Comment:
Pls bump version to `11.0.5+10`. Shouldn't require any changes.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (27 preceding siblings ...)
2019-10-29 17:36 ` [PR PATCH] [Updated] " voidlinux-github
@ 2019-10-29 17:36 ` voidlinux-github
2019-10-30 4:20 ` [PR PATCH] [Merged]: " voidlinux-github
2019-10-30 13:49 ` voidlinux-github
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-10-29 17:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 51568 bytes --]
From c6b830f7a48459767b0286a90f6d2465f056657a Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <KyleJNusbaum@gmail.com>
Date: Tue, 29 Oct 2019 12:33:17 -0500
Subject: [PATCH 1/3] New package: make-ca-1.5
---
srcpkgs/make-ca/template | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..bcc41f8119d
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,16 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.5
+revision=1
+wrksrc="make-ca-${version}"
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+depends="p11-kit"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v${version}/make-ca-${version}.tar.xz"
+checksum=e75771dd73eb97189339379626fb42241ee579058c6ea2900ec850e7d96179f7
+archs=noarch
From 2179e315e6f5ca9ef2af487e449b512d96cbec5e Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <KyleJNusbaum@gmail.com>
Date: Tue, 29 Oct 2019 12:33:58 -0500
Subject: [PATCH 2/3] New package: openjdk11-bin-11+28
---
srcpkgs/openjdk11-bin/template | 73 ++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk11-bin/template
diff --git a/srcpkgs/openjdk11-bin/template b/srcpkgs/openjdk11-bin/template
new file mode 100644
index 00000000000..b2da83d21eb
--- /dev/null
+++ b/srcpkgs/openjdk11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk11-bin'
+pkgname=openjdk11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk11-bin
+}
From 3cf9ec125001614cd4e75c519d96afb846c018d9 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <KyleJNusbaum@gmail.com>
Date: Tue, 29 Oct 2019 12:36:00 -0500
Subject: [PATCH 3/3] New package: openjdk11-11.0.5+10
---
common/shlibs | 6 +
srcpkgs/openjdk11-doc | 1 +
srcpkgs/openjdk11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk11/files/musl_patches/arm.patch | 30 +
.../openjdk11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk11/template | 183 ++++++
9 files changed, 1120 insertions(+)
create mode 120000 srcpkgs/openjdk11-doc
create mode 120000 srcpkgs/openjdk11-src
create mode 100644 srcpkgs/openjdk11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk11/template
diff --git a/common/shlibs b/common/shlibs
index b5b6086d24f..ae506221e25 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1778,6 +1778,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk11-11.0.5+10_1
+libawt.so openjdk11-11.0.5+10_1
+libawt_xawt.so openjdk11-11.0.5+10_1
+libjava.so openjdk11-11.0.5+10_1
+libjli.so openjdk11-11.0.5+10_1
+libjvm.so openjdk11-11.0.5+10_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk11-doc b/srcpkgs/openjdk11-doc
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-doc
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11-src b/srcpkgs/openjdk11-src
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-src
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk11/files/musl_patches/arm.patch b/srcpkgs/openjdk11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk11/files/musl_patches/build.patch b/srcpkgs/openjdk11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk11/files/musl_patches/x86.patch b/srcpkgs/openjdk11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template
new file mode 100644
index 00000000000..b4d4c64b61d
--- /dev/null
+++ b/srcpkgs/openjdk11/template
@@ -0,0 +1,183 @@
+# Template file for 'openjdk11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=5
+_jdk_update=10
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=a3bc19d278f68660f02610cbe1ce6c110a39a1aa53aeb90c6133a1cebf948462
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11"
+else
+ hostmakedepends+=" openjdk11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ chmod -R ugo+rw ./ca
+ rm -Rf ./ca
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ 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
+ vmove usr/lib/jvm/openjdk11/man/man1/
+ }
+}
+
+openjdk11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Updated] Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (26 preceding siblings ...)
2019-10-28 23:37 ` voidlinux-github
@ 2019-10-29 17:36 ` voidlinux-github
2019-10-29 17:36 ` voidlinux-github
` (2 subsequent siblings)
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-10-29 17:36 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
There is an updated pull request by knusbaum against master on the void-packages repository
https://github.com/knusbaum/void-packages openjdk-11
https://github.com/void-linux/void-packages/pull/13721
Openjdk 11
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
A patch file from https://github.com/void-linux/void-packages/pull/13721.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-openjdk-11-13721.patch --]
[-- Type: text/x-diff, Size: 51568 bytes --]
From c6b830f7a48459767b0286a90f6d2465f056657a Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <KyleJNusbaum@gmail.com>
Date: Tue, 29 Oct 2019 12:33:17 -0500
Subject: [PATCH 1/3] New package: make-ca-1.5
---
srcpkgs/make-ca/template | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 srcpkgs/make-ca/template
diff --git a/srcpkgs/make-ca/template b/srcpkgs/make-ca/template
new file mode 100644
index 00000000000..bcc41f8119d
--- /dev/null
+++ b/srcpkgs/make-ca/template
@@ -0,0 +1,16 @@
+# Template file for 'make-ca'
+pkgname=make-ca
+version=1.5
+revision=1
+wrksrc="make-ca-${version}"
+build_style=gnu-makefile
+make_install_args="SBINDIR=/usr/bin"
+hostmakedepends="help2man"
+depends="p11-kit"
+short_desc="PKI setup script for LFS (and others)"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/djlucas/make-ca/"
+distfiles="https://github.com/djlucas/make-ca/releases/download/v${version}/make-ca-${version}.tar.xz"
+checksum=e75771dd73eb97189339379626fb42241ee579058c6ea2900ec850e7d96179f7
+archs=noarch
From 2179e315e6f5ca9ef2af487e449b512d96cbec5e Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <KyleJNusbaum@gmail.com>
Date: Tue, 29 Oct 2019 12:33:58 -0500
Subject: [PATCH 2/3] New package: openjdk11-bin-11+28
---
srcpkgs/openjdk11-bin/template | 73 ++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 srcpkgs/openjdk11-bin/template
diff --git a/srcpkgs/openjdk11-bin/template b/srcpkgs/openjdk11-bin/template
new file mode 100644
index 00000000000..b2da83d21eb
--- /dev/null
+++ b/srcpkgs/openjdk11-bin/template
@@ -0,0 +1,73 @@
+# Template file for 'openjdk11-bin'
+pkgname=openjdk11-bin
+version=11+28
+revision=1
+archs="x86_64"
+wrksrc=jdk-11
+short_desc="Official Reference Implementation for Java SE 11"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="https://jdk.java.net/java-se-ri/11"
+distfiles="https://download.java.net/openjdk/jdk11/ri/openjdk-${version}_linux-x64_bin.tar.gz"
+checksum=3784cfc4670f0d4c5482604c7c513beb1a92b005f569df9bf100e8bef6610f2e
+nopie=true
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11-bin/bin/java
+ java:/usr/bin/javaws:/usr/lib/jvm/openjdk11-bin/bin/javaws
+ java:/usr/bin/jcontrol:/usr/lib/jvm/openjdk11-bin/bin/jcontrol
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11-bin/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11-bin/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11-bin/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11-bin/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11-bin/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11-bin/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11-bin/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11-bin/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11-bin/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11-bin/bin/unpack200
+
+ jdk:/usr/bin/ControlPanel:/usr/lib/jvm/openjdk11-bin/bin/ControlPanel
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11-bin/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11-bin/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11-bin/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11-bin/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11-bin/bin/jarsigner
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11-bin/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11-bin/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11-bin/bin/javadoc
+ jdk:/usr/bin/javafxpackager:/usr/lib/jvm/openjdk11-bin/bin/javafxpackager
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11-bin/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11-bin/bin/javap
+ jdk:/usr/bin/javapackager:/usr/lib/jvm/openjdk11-bin/bin/javapackager
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11-bin/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11-bin/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11-bin/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11-bin/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11-bin/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11-bin/bin/jinfo
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11-bin/bin/jmap
+ jdk:/usr/bin/jmc:/usr/lib/jvm/openjdk11-bin/bin/jmc
+ jdk:/usr/bin/jmc.ini:/usr/lib/jvm/openjdk11-bin/bin/jmc.ini
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11-bin/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11-bin/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11-bin/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11-bin/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11-bin/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11-bin/bin/jstatd
+ jdk:/usr/bin/jvisualvm:/usr/lib/jvm/openjdk11-bin/bin/jvisualvm
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11-bin/bin/native2ascii
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11-bin/bin/rmic
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11-bin/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11-bin/bin/serialver
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11-bin/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11-bin/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11-bin/bin/xjc
+
+ java-plugin:/usr/lib/mozilla/plugins/libnpjp2.so:/usr/lib/jvm/openjdk11-bin/jre/lib/$_arch/libnpjp2.so
+"
+
+do_install() {
+ vmkdir /usr/lib/jvm/openjdk11-bin
+ cp -R ./* ${DESTDIR}/usr/lib/jvm/openjdk11-bin
+}
From 3cf9ec125001614cd4e75c519d96afb846c018d9 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <KyleJNusbaum@gmail.com>
Date: Tue, 29 Oct 2019 12:36:00 -0500
Subject: [PATCH 3/3] New package: openjdk11-11.0.5+10
---
common/shlibs | 6 +
srcpkgs/openjdk11-doc | 1 +
srcpkgs/openjdk11-src | 1 +
.../files/musl_patches/aarch64.patch | 11 +
.../openjdk11/files/musl_patches/arm.patch | 30 +
.../openjdk11/files/musl_patches/build.patch | 537 ++++++++++++++++++
.../files/musl_patches/ppc64le.patch | 221 +++++++
.../openjdk11/files/musl_patches/x86.patch | 130 +++++
srcpkgs/openjdk11/template | 183 ++++++
9 files changed, 1120 insertions(+)
create mode 120000 srcpkgs/openjdk11-doc
create mode 120000 srcpkgs/openjdk11-src
create mode 100644 srcpkgs/openjdk11/files/musl_patches/aarch64.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/arm.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/build.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
create mode 100644 srcpkgs/openjdk11/files/musl_patches/x86.patch
create mode 100644 srcpkgs/openjdk11/template
diff --git a/common/shlibs b/common/shlibs
index b5b6086d24f..ae506221e25 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -1778,6 +1778,12 @@ libawt_xawt.so openjdk-jre-8u20_1
libjava.so openjdk-jre-8u20_1
libjli.so openjdk-jre-8u20_1
libjvm.so openjdk-jre-8u20_1
+libjawt.so openjdk11-11.0.5+10_1
+libawt.so openjdk11-11.0.5+10_1
+libawt_xawt.so openjdk11-11.0.5+10_1
+libjava.so openjdk11-11.0.5+10_1
+libjli.so openjdk11-11.0.5+10_1
+libjvm.so openjdk11-11.0.5+10_1
libucl.so.5 libucl-0.8.1_1
libhandle.so.1 xfsprogs-3.2.1_1
libnfnetlink.so.0 libnfnetlink-1.0.1_1
diff --git a/srcpkgs/openjdk11-doc b/srcpkgs/openjdk11-doc
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-doc
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11-src b/srcpkgs/openjdk11-src
new file mode 120000
index 00000000000..8213494c49e
--- /dev/null
+++ b/srcpkgs/openjdk11-src
@@ -0,0 +1 @@
+openjdk11
\ No newline at end of file
diff --git a/srcpkgs/openjdk11/files/musl_patches/aarch64.patch b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
new file mode 100644
index 00000000000..b95f455e926
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/aarch64.patch
@@ -0,0 +1,11 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -77,7 +77,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
diff --git a/srcpkgs/openjdk11/files/musl_patches/arm.patch b/srcpkgs/openjdk11/files/musl_patches/arm.patch
new file mode 100644
index 00000000000..12d0022c149
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/arm.patch
@@ -0,0 +1,30 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
++++ new/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
+@@ -71,7 +71,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+ # include <asm/ptrace.h>
+
+ #define SPELL_REG_SP "sp"
+@@ -104,6 +103,18 @@
+ #define ARM_REGS_IN_CONTEXT 31
+
+ #else
++
++// Stupid hack as the origin if below doesnt compile with gcc 8.2.0:
++//
++// os_linux_arm.cpp:114:5: error: missing binary operator before token "("
++// #if NGREG == 16
++// ^~~~~
++//
++// The NGREG is 18, so force it to that value.
++#ifdef NGREG
++# undef NGREG
++#endif
++#define NGREG 18
+
+ #if NGREG == 16
+ // These definitions are based on the observation that until
diff --git a/srcpkgs/openjdk11/files/musl_patches/build.patch b/srcpkgs/openjdk11/files/musl_patches/build.patch
new file mode 100644
index 00000000000..81ed0f53b1d
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/build.patch
@@ -0,0 +1,537 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -77,6 +77,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -241,6 +241,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -99,7 +99,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -511,6 +510,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -528,6 +532,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2916,20 +2921,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1147,7 +1147,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -272,7 +272,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -235,6 +235,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -786,26 +783,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -254,13 +269,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -273,7 +294,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -389,8 +389,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -431,13 +431,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -453,10 +453,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -511,12 +511,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -613,6 +613,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -651,6 +658,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1954,7 +2000,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,6 +298,13 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
diff --git a/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
new file mode 100644
index 00000000000..67f6642142c
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/ppc64le.patch
@@ -0,0 +1,221 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -768,7 +768,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -69,7 +74,11 @@
+ if (!((Method*)(istate->method))->is_metaspace_object()) {
+ return false;
+ }
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base());
+ uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size());
diff --git a/srcpkgs/openjdk11/files/musl_patches/x86.patch b/srcpkgs/openjdk11/files/musl_patches/x86.patch
new file mode 100644
index 00000000000..9c64c189036
--- /dev/null
+++ b/srcpkgs/openjdk11/files/musl_patches/x86.patch
@@ -0,0 +1,130 @@
+Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -90,6 +90,126 @@
+ #define SPELL_REG_FP "ebp"
+ #endif // AMD64
+
++// ==============================================================================
++// Taken from glibc 2.28
++// source: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/fpu_control.h;h=4cb98c5679b2897ff4e5826d228cba6be589e24d;hb=3c03baca37fdcb52c3881e653ca392bba7a99c2b
++// ==============================================================================
++#ifndef AMD64
++/* FPU control word bits. x86 version.
++ Copyright (C) 1993-2018 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Olaf Flebbe.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _FPU_CONTROL_H
++#define _FPU_CONTROL_H 1
++
++/* Note that this file sets on x86-64 only the x87 FPU, it does not
++ touch the SSE unit. */
++
++/* Here is the dirty part. Set up your 387 through the control word
++ * (cw) register.
++ *
++ * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0
++ * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM
++ *
++ * IM: Invalid operation mask
++ * DM: Denormalized operand mask
++ * ZM: Zero-divide mask
++ * OM: Overflow mask
++ * UM: Underflow mask
++ * PM: Precision (inexact result) mask
++ *
++ * Mask bit is 1 means no interrupt.
++ *
++ * PC: Precision control
++ * 11 - round to extended precision
++ * 10 - round to double precision
++ * 00 - round to single precision
++ *
++ * RC: Rounding control
++ * 00 - rounding to nearest
++ * 01 - rounding down (toward - infinity)
++ * 10 - rounding up (toward + infinity)
++ * 11 - rounding toward zero
++ *
++ * IC: Infinity control
++ * That is for 8087 and 80287 only.
++ *
++ * The hardware default is 0x037f which we use.
++ */
++
++#include <features.h>
++
++/* masking of interrupts */
++#define _FPU_MASK_IM 0x01
++#define _FPU_MASK_DM 0x02
++#define _FPU_MASK_ZM 0x04
++#define _FPU_MASK_OM 0x08
++#define _FPU_MASK_UM 0x10
++#define _FPU_MASK_PM 0x20
++
++/* precision control */
++#define _FPU_EXTENDED 0x300 /* libm requires double extended precision. */
++#define _FPU_DOUBLE 0x200
++#define _FPU_SINGLE 0x0
++
++/* rounding control */
++#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
++#define _FPU_RC_DOWN 0x400
++#define _FPU_RC_UP 0x800
++#define _FPU_RC_ZERO 0xC00
++
++#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
++
++
++/* The fdlibm code requires strict IEEE double precision arithmetic,
++ and no interrupts for exceptions, rounding to nearest. */
++
++#define _FPU_DEFAULT 0x037f
++
++/* IEEE: same as above. */
++#define _FPU_IEEE 0x037f
++
++/* Type of the control word. */
++typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
++
++/* Macros for accessing the hardware control word. "*&" is used to
++ work around a bug in older versions of GCC. __volatile__ is used
++ to support combination of writing the control register and reading
++ it back. Without __volatile__, the old value may be used for reading
++ back under compiler optimization.
++
++ Note that the use of these macros is not sufficient anymore with
++ recent hardware nor on x86-64. Some floating point operations are
++ executed in the SSE/SSE2 engines which have their own control and
++ status register. */
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
++/* Default control word set at startup. */
++extern fpu_control_t __fpu_control;
++
++#endif /* fpu_control.h */
++
++#endif // AMD64
++// ==============================================================================
++// ==============================================================================
++// ==============================================================================
++
+ address os::current_stack_pointer() {
+ #ifdef SPARC_WORKS
+ register void *esp;
diff --git a/srcpkgs/openjdk11/template b/srcpkgs/openjdk11/template
new file mode 100644
index 00000000000..b4d4c64b61d
--- /dev/null
+++ b/srcpkgs/openjdk11/template
@@ -0,0 +1,183 @@
+# Template file for 'openjdk11'
+_java_ver=11
+_java_min_ver=0
+_java_sec_ver=5
+_jdk_update=10
+_openjdk_version="openjdk-${_java_ver}"
+
+
+pkgname=openjdk11
+version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}+${_jdk_update}"
+revision=1
+wrksrc="jdk${_java_ver}u-jdk-${version}"
+build_style=gnu-configure
+configure_args="
+ --disable-warnings-as-errors
+ --prefix=${XBPS_DESTDIR}/${XBPS_CROSS_TRIPLET}/${pkgname}-${version}/usr/lib
+ --enable-unlimited-crypto
+ --with-zlib=system
+ --with-libjpeg=system
+ --with-giflib=system
+ --with-libpng=system
+ --with-lcms=system
+ --with-jtreg=no
+ --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"
+ --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+
+make_build_args="images $(vopt_if docs docs)"
+make_check_target="test-hotspot-gtest"
+hostmakedepends="pkg-config automake autoconf cpio unzip zip ca-certificates
+ libressl zlib-devel 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"
+provides="java-environment-${version}_1 java-runtime-${version}_1"
+short_desc="OpenJDK Java Development Kit"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="GPL-2.0-or-later"
+homepage="http://openjdk.java.net/"
+distfiles="https://hg.openjdk.java.net/jdk-updates/jdk${_java_ver}u/archive/jdk-${version}.tar.gz"
+checksum=a3bc19d278f68660f02610cbe1ce6c110a39a1aa53aeb90c6133a1cebf948462
+shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so"
+
+# Build is still parallel, but don't use -jN.
+disable_parallel_build=yes
+build_options="docs"
+
+case "$XBPS_TARGET_LIBC" in
+ glibc) build_options_default+=" docs";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+ hostmakedepends+=" openjdk11"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11"
+else
+ hostmakedepends+=" openjdk11-bin"
+ configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk11-bin"
+fi
+
+alternatives="
+ java:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ java:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ java:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ java:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ java:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ java:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ java:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ java:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ java:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ java:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ java:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+
+ jdk:/usr/bin/appletviewer:/usr/lib/jvm/openjdk11/bin/appletviewer
+ jdk:/usr/bin/extcheck:/usr/lib/jvm/openjdk11/bin/extcheck
+ jdk:/usr/bin/idlj:/usr/lib/jvm/openjdk11/bin/idlj
+ jdk:/usr/bin/jar:/usr/lib/jvm/openjdk11/bin/jar
+ jdk:/usr/bin/jarsigner:/usr/lib/jvm/openjdk11/bin/jarsigner
+ jdk:/usr/bin/java:/usr/lib/jvm/openjdk11/bin/java
+ jdk:/usr/bin/java-rmi.cgi:/usr/lib/jvm/openjdk11/bin/java-rmi.cgi
+ jdk:/usr/bin/javac:/usr/lib/jvm/openjdk11/bin/javac
+ jdk:/usr/bin/javadoc:/usr/lib/jvm/openjdk11/bin/javadoc
+ jdk:/usr/bin/javah:/usr/lib/jvm/openjdk11/bin/javah
+ jdk:/usr/bin/javap:/usr/lib/jvm/openjdk11/bin/javap
+ jdk:/usr/bin/jcmd:/usr/lib/jvm/openjdk11/bin/jcmd
+ jdk:/usr/bin/jconsole:/usr/lib/jvm/openjdk11/bin/jconsole
+ jdk:/usr/bin/jdb:/usr/lib/jvm/openjdk11/bin/jdb
+ jdk:/usr/bin/jdeps:/usr/lib/jvm/openjdk11/bin/jdeps
+ jdk:/usr/bin/jhat:/usr/lib/jvm/openjdk11/bin/jhat
+ jdk:/usr/bin/jinfo:/usr/lib/jvm/openjdk11/bin/jinfo
+ jdk:/usr/bin/jjs:/usr/lib/jvm/openjdk11/bin/jjs
+ jdk:/usr/bin/jmap:/usr/lib/jvm/openjdk11/bin/jmap
+ jdk:/usr/bin/jps:/usr/lib/jvm/openjdk11/bin/jps
+ jdk:/usr/bin/jrunscript:/usr/lib/jvm/openjdk11/bin/jrunscript
+ jdk:/usr/bin/jsadebugd:/usr/lib/jvm/openjdk11/bin/jsadebugd
+ jdk:/usr/bin/jstack:/usr/lib/jvm/openjdk11/bin/jstack
+ jdk:/usr/bin/jstat:/usr/lib/jvm/openjdk11/bin/jstat
+ jdk:/usr/bin/jstatd:/usr/lib/jvm/openjdk11/bin/jstatd
+ jdk:/usr/bin/keytool:/usr/lib/jvm/openjdk11/bin/keytool
+ jdk:/usr/bin/native2ascii:/usr/lib/jvm/openjdk11/bin/native2ascii
+ jdk:/usr/bin/orbd:/usr/lib/jvm/openjdk11/bin/orbd
+ jdk:/usr/bin/pack200:/usr/lib/jvm/openjdk11/bin/pack200
+ jdk:/usr/bin/policytool:/usr/lib/jvm/openjdk11/bin/policytool
+ jdk:/usr/bin/rmic:/usr/lib/jvm/openjdk11/bin/rmic
+ jdk:/usr/bin/rmid:/usr/lib/jvm/openjdk11/bin/rmid
+ jdk:/usr/bin/rmiregistry:/usr/lib/jvm/openjdk11/bin/rmiregistry
+ jdk:/usr/bin/schemagen:/usr/lib/jvm/openjdk11/bin/schemagen
+ jdk:/usr/bin/serialver:/usr/lib/jvm/openjdk11/bin/serialver
+ jdk:/usr/bin/servertool:/usr/lib/jvm/openjdk11/bin/servertool
+ jdk:/usr/bin/tnameserv:/usr/lib/jvm/openjdk11/bin/tnameserv
+ jdk:/usr/bin/unpack200:/usr/lib/jvm/openjdk11/bin/unpack200
+ jdk:/usr/bin/wsgen:/usr/lib/jvm/openjdk11/bin/wsgen
+ jdk:/usr/bin/wsimport:/usr/lib/jvm/openjdk11/bin/wsimport
+ jdk:/usr/bin/xjc:/usr/lib/jvm/openjdk11/bin/xjc
+"
+
+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/}
+ configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
+ 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"
+}
+
+post_install() {
+ vmkdir /usr/lib/jvm
+ mv ${DESTDIR}/usr/lib/jvm/openjdk-${_java_ver}.${_java_min_ver}.${_java_sec_ver}-internal ${DESTDIR}/usr/lib/jvm/openjdk${_java_ver}
+ rm -rf ${DESTDIR}/usr/lib/bin
+ vmkdir usr/lib/jvm/$_openjdk_version/lib/security
+ make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/$_openjdk_version/bin/keytool"
+ mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/$_openjdk_version/lib/security/
+ chmod -R ugo+rw ./ca
+ rm -Rf ./ca
+ vlicense ASSEMBLY_EXCEPTION
+ vlicense LICENSE
+}
+
+openjdk11-doc_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- documentation"
+ 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
+ vmove usr/lib/jvm/openjdk11/man/man1/
+ }
+}
+
+openjdk11-src_package() {
+ nostrip=yes
+ noverifyrdeps=yes
+ noshlibprovides=yes
+ short_desc+=" -- sources"
+ pkg_install() {
+ vmove "usr/lib/jvm/openjdk11/lib/src.zip"
+ }
+}
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PR PATCH] [Merged]: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (28 preceding siblings ...)
2019-10-29 17:36 ` voidlinux-github
@ 2019-10-30 4:20 ` voidlinux-github
2019-10-30 13:49 ` voidlinux-github
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-10-30 4:20 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
There's a merged pull request on the void-packages repository
Openjdk 11
https://github.com/void-linux/void-packages/pull/13721
Description:
I'd much rather have @q66's solution (#3237) but this seems to build for at least x86_64, i686, aarch64.
This bootstraps openjdk-11 from openjdk-11-bin, which is the binary reference implementation.
Travis will fail because the builds take too long, but I've tested on my local machine and they build.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: Openjdk 11
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
` (29 preceding siblings ...)
2019-10-30 4:20 ` [PR PATCH] [Merged]: " voidlinux-github
@ 2019-10-30 13:49 ` voidlinux-github
30 siblings, 0 replies; 31+ messages in thread
From: voidlinux-github @ 2019-10-30 13:49 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 168 bytes --]
New comment by knusbaum on void-packages repository
https://github.com/void-linux/void-packages/pull/13721#issuecomment-547912537
Comment:
So glad to have this in!!!
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2019-10-30 13:49 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-13721@inbox.vuxu.org>
2019-09-03 18:16 ` [PR PATCH] [Updated] WIP: Openjdk 11 voidlinux-github
2019-09-03 18:16 ` voidlinux-github
2019-09-03 21:08 ` voidlinux-github
2019-09-03 21:29 ` voidlinux-github
2019-09-03 21:44 ` voidlinux-github
2019-09-03 22:02 ` [PR PATCH] [Updated] " voidlinux-github
2019-09-03 22:02 ` voidlinux-github
2019-09-03 22:02 ` voidlinux-github
2019-09-04 1:02 ` voidlinux-github
2019-09-04 21:03 ` [PR PATCH] [Updated] " voidlinux-github
2019-09-04 21:03 ` voidlinux-github
2019-09-04 21:06 ` voidlinux-github
2019-09-04 21:06 ` voidlinux-github
2019-09-04 21:11 ` voidlinux-github
2019-09-04 21:12 ` voidlinux-github
2019-09-04 22:45 ` [PR PATCH] [Updated] " voidlinux-github
2019-09-04 22:45 ` voidlinux-github
2019-09-11 20:36 ` [PR PATCH] [Updated] " voidlinux-github
2019-09-11 20:36 ` voidlinux-github
2019-09-11 20:36 ` voidlinux-github
2019-09-11 22:02 ` voidlinux-github
2019-09-17 23:47 ` voidlinux-github
2019-09-18 15:12 ` voidlinux-github
2019-09-18 18:21 ` [PR PATCH] [Updated] " voidlinux-github
2019-09-18 18:21 ` voidlinux-github
2019-09-18 18:21 ` voidlinux-github
2019-10-28 23:37 ` voidlinux-github
2019-10-29 17:36 ` [PR PATCH] [Updated] " voidlinux-github
2019-10-29 17:36 ` voidlinux-github
2019-10-30 4:20 ` [PR PATCH] [Merged]: " voidlinux-github
2019-10-30 13:49 ` voidlinux-github
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).