openjdk11: update to 11.0.12+5.

This commit is contained in:
Érico Nogueira 2021-04-11 00:43:19 -03:00 committed by John Zimmermann
parent f5082ab001
commit bb6b660ca5
2 changed files with 82 additions and 205 deletions

View File

@ -1,4 +1,11 @@
Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/commit/?id=8a1ae17d4a9af54285c7891a680620e7e24c6280
Subject: Fix compilation issues with musl libc
Upstream: No
Author: The portola team at https://openjdk.java.net/projects/portola/
With modifications by Simon Frankenberger <simon-alpine@fraho.eu>
This giant patch makes it possible to compile openjdk with musl libc.
The base was taken from a diff with the portola project and adjusted for latest musl libc.
--- old/make/ReleaseFile.gmk
+++ new/make/ReleaseFile.gmk
@@ -53,6 +53,7 @@
@ -9,9 +16,29 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
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 @@
@@ -79,6 +79,7 @@
-DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
-DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
@ -21,7 +48,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
################################################################################
--- old/make/lib/CoreLibraries.gmk
+++ new/make/lib/CoreLibraries.gmk
@@ -241,6 +241,7 @@
@@ -219,6 +219,7 @@
endif
LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
@ -31,7 +58,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
LIBJLI_EXTRA_FILES += \
--- old/src/hotspot/os/linux/os_linux.cpp
+++ new/src/hotspot/os/linux/os_linux.cpp
@@ -99,7 +99,6 @@
@@ -101,7 +101,6 @@
# include <string.h>
# include <syscall.h>
# include <sys/sysinfo.h>
@ -39,7 +66,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
# include <sys/ipc.h>
# include <sys/shm.h>
# include <link.h>
@@ -511,6 +510,11 @@
@@ -594,6 +593,11 @@
// detecting pthread library
void os::Linux::libpthread_init() {
@ -51,7 +78,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
// Save glibc and pthread version strings.
#if !defined(_CS_GNU_LIBC_VERSION) || \
!defined(_CS_GNU_LIBPTHREAD_VERSION)
@@ -528,6 +532,7 @@
@@ -611,6 +615,7 @@
str = (char *)malloc(n, mtInternal);
confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
os::Linux::set_libpthread_version(str);
@ -59,7 +86,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
}
/////////////////////////////////////////////////////////////////////////////
@@ -2916,20 +2921,36 @@
@@ -3109,20 +3114,36 @@
extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
extern "C" JNIEXPORT void numa_error(char *where) { }
@ -116,7 +143,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
#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 @@
@@ -1144,7 +1144,7 @@
static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
bool first = true;
size_t min_size = 0; // "first" makes this conceptually infinite.
@ -125,9 +152,9 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
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 @@
--- old/src/hotspot/share/runtime/abstract_vm_version.cpp
+++ new/src/hotspot/share/runtime/abstract_vm_version.cpp
@@ -266,7 +266,7 @@
#endif
#define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
@ -168,7 +195,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
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 @@
@@ -238,7 +238,13 @@
{
if (envp == NULL || (char **) envp == environ) {
execvp(file, (char **) argv);
@ -196,7 +223,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
#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 @@
@@ -236,6 +236,39 @@
char *dmllp = NULL;
char *p; /* a utility pointer */
@ -259,7 +286,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
#include <jvm.h>
#include <jni.h>
@@ -786,26 +783,6 @@
@@ -783,26 +780,6 @@
}
return ret;
}
@ -340,7 +367,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
void *run_java_overflow (void *p) {
JNIEnv *env;
jclass class_id;
@@ -254,13 +269,19 @@
@@ -258,13 +273,19 @@
exit(7);
}
@ -361,7 +388,7 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
pthread_join (thr, NULL);
printf("Testing stack guard page behaviour for initial thread\n");
@@ -273,7 +294,7 @@
@@ -277,7 +298,7 @@
printf("\nTesting NATIVE_OVERFLOW\n");
printf("Testing stack guard page behaviour for other thread\n");
@ -370,148 +397,3 @@ Patches for musl taken from Alpine linux: https://git.alpinelinux.org/aports/com
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);

View File

@ -1,12 +1,10 @@
# Template file for 'openjdk11'
pkgname=openjdk11
_java_ver=11
_java_min_ver=0
_java_sec_ver=9
_jdk_update=4
_java_sec_ver=12
_jdk_update=5
_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}"
@ -21,7 +19,10 @@ configure_args="
--with-libpng=system
--with-lcms=system
--with-jtreg=no
--with-version-build=${version}
--with-native-debug-symbols=none
--with-version-pre=
--with-version-opt="void-r$revision"
--with-version-build=${_jdk_update}
--with-vendor-name="Void"
--with-vendor-url="https://voidlinux.org/"
--with-vendor-bug-url="https://github.com/void-linux/void-packages/issues"
@ -33,22 +34,20 @@ hostmakedepends="pkg-config automake autoconf cpio tar unzip zip ca-certificates
makedepends="libXrender-devel libXtst-devel libXt-devel libXrandr-devel
giflib-devel libjpeg-turbo-devel cups-devel freetype-devel alsa-lib-devel
fontconfig-devel zlib-devel lcms2-devel"
depends="fontconfig"
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=eb946d536ae61b65bc8ad6d644cf7066bfe51a8e906fa09491821493eb854dc4
checksum=ff0edaf800c76ae435840365a9205a5f7277a5a2fd3c79ad874522a15c213559
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"
# Cross building currently segfaults
nocross="https://build.voidlinux.org/builders/armv7l_builder/builds/26862/steps/shell_3/logs/stdio"
# no hotspot JIT for ppc32
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
@ -145,22 +144,18 @@ do_configure() {
CXXFLAGS+=" -DABI_ELFv2"
;;
esac
configure_args=${configure_args/--with-libtool-sysroot=\/usr\/[a-z0-9]*-linux-[a-z]*/}
configure_args=${configure_args/--with-libtool-sysroot=$XBPS_CROSS_BASE}
if [ "$XBPS_CCACHE" ] && [ -z "$CROSS_BUILD" ]; then
configure_args+=" --enable-ccache"
CC="/usr/bin/cc"
CXX="/usr/bin/c++"
fi
CFLAGS+=" -fcommon"
CXXFLAGS+=" -fcommon"
./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
do_install() {
vmkdir usr/lib/jvm/openjdk${_java_ver}
vcopy build/*-normal-server-release/images/jdk/* "usr/lib/jvm/openjdk${_java_ver}"
vmkdir usr/lib/jvm/$_openjdk_version/lib/security
make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/usr/lib/jvm/openjdk${_java_ver}/bin/keytool"
mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/usr/lib/jvm/openjdk${_java_ver}/lib/security/