diff --git a/common/shlibs b/common/shlibs index 39137dbe04..c01c520695 100644 --- a/common/shlibs +++ b/common/shlibs @@ -4104,3 +4104,9 @@ libkaddressbookprivate.so.5 kaddressbook-21.08.3_1 libcodec2.so.1.0 codec2-1.0.1_1 libx86emu.so.3 libx86emu-3.4_1 libdeflate.so.0 libdeflate-1.8_1 +libjawt.so openjdk17-jre-17.0.1+12_1 +libawt.so openjdk17-jre-17.0.1+12_1 +libawt_xawt.so openjdk17-jre-17.0.1+12_1 +libjava.so openjdk17-jre-17.0.1+12_1 +libjli.so openjdk17-jre-17.0.1+12_1 +libjvm.so openjdk17-jre-17.0.1+12_1 diff --git a/srcpkgs/openjdk17-doc b/srcpkgs/openjdk17-doc new file mode 120000 index 0000000000..99ab1cb1b0 --- /dev/null +++ b/srcpkgs/openjdk17-doc @@ -0,0 +1 @@ +openjdk17 \ No newline at end of file diff --git a/srcpkgs/openjdk17-jre b/srcpkgs/openjdk17-jre new file mode 120000 index 0000000000..99ab1cb1b0 --- /dev/null +++ b/srcpkgs/openjdk17-jre @@ -0,0 +1 @@ +openjdk17 \ No newline at end of file diff --git a/srcpkgs/openjdk17-src b/srcpkgs/openjdk17-src new file mode 120000 index 0000000000..99ab1cb1b0 --- /dev/null +++ b/srcpkgs/openjdk17-src @@ -0,0 +1 @@ +openjdk17 \ No newline at end of file diff --git a/srcpkgs/openjdk17/files/musl_patches/arm.patch b/srcpkgs/openjdk17/files/musl_patches/arm.patch new file mode 100644 index 0000000000..32b4b0102a --- /dev/null +++ b/srcpkgs/openjdk17/files/musl_patches/arm.patch @@ -0,0 +1,22 @@ +--- a/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp ++++ b/src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp +@@ -73,7 +73,18 @@ + # include +-# include + # include + ++// 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 (bits/signal.h:10), so force it to that value. ++#ifdef NGREG ++# undef NGREG ++#endif ++#define NGREG 18 ++ + #define SPELL_REG_SP "sp" + + // Don't #define SPELL_REG_FP for thumb because it is not safe to use, so this makes sure we never fetch it. diff --git a/srcpkgs/openjdk17/files/musl_patches/build.patch b/srcpkgs/openjdk17/files/musl_patches/build.patch new file mode 100644 index 0000000000..1158babcd9 --- /dev/null +++ b/srcpkgs/openjdk17/files/musl_patches/build.patch @@ -0,0 +1,170 @@ +--- a/make/hotspot/lib/CompileJvm.gmk ++++ b/make/hotspot/lib/CompileJvm.gmk +@@ -73,6 +73,7 @@ CFLAGS_VM_VERSION := \ + -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \ + -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \ + -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \ ++ -DLIBC='"musl"' \ + # + + ################################################################################ +--- a/make/modules/java.base/lib/CoreLibraries.gmk ++++ b/make/modules/java.base/lib/CoreLibraries.gmk +@@ -190,6 +190,7 @@ ifeq ($(call isTargetOs, windows), true) + endif + + LIBJLI_CFLAGS += $(LIBZ_CFLAGS) ++LIBJLI_CFLAGS += -DLIBC=\"musl\" + + ifneq ($(USE_EXTERNAL_LIBZ), true) + LIBJLI_EXTRA_FILES += \ +--- a/src/hotspot/os/linux/os_linux.cpp ++++ b/src/hotspot/os/linux/os_linux.cpp +@@ -3117,20 +3123,36 @@ void os::Linux::sched_getcpu_init() { + 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() { +--- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp ++++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +@@ -75,9 +75,6 @@ + # include + # include + # include +-#ifndef AMD64 +-# include +-#endif + + #ifdef AMD64 + #define REG_SP REG_RSP +--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp ++++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp +@@ -1116,7 +1116,7 @@ HeapWord* GenCollectedHeap::allocate_new_tlab(size_t min_size, + 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"); +--- a/src/java.base/unix/native/libjava/childproc.c ++++ b/src/java.base/unix/native/libjava/childproc.c +@@ -235,7 +235,13 @@ JDK_execvpe(int mode, const char *file, + { + 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') { +--- a/src/java.base/unix/native/libjli/java_md.c ++++ b/src/java.base/unix/native/libjli/java_md.c +@@ -236,6 +236,39 @@ RequiresSetenv(const char *jvmpath) { + 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; +--- a/src/jdk.jdwp.agent/share/native/libjdwp/util.h ++++ b/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" \ No newline at end of file diff --git a/srcpkgs/openjdk17/files/musl_patches/ppc.patch b/srcpkgs/openjdk17/files/musl_patches/ppc.patch new file mode 100644 index 0000000000..d306d501e4 --- /dev/null +++ b/srcpkgs/openjdk17/files/musl_patches/ppc.patch @@ -0,0 +1,45 @@ +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 +@@ -47,6 +47,8 @@ + #include "opto/intrinsicnode.hpp" + #endif + ++#include ++ + #ifdef PRODUCT + #define BLOCK_COMMENT(str) // nothing + #else +--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp ++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp +@@ -845,7 +845,7 @@ void VM_Version::determine_features() { + 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 +@@ -75,7 +75,7 @@ + # include + # include + # include +- ++# include + + address os::current_stack_pointer() { + intptr_t* csp; +--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp ++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp +@@ -23,6 +23,8 @@ + * + */ + ++#include ++ + #include "precompiled.hpp" + #include "runtime/frame.inline.hpp" + #include "runtime/thread.hpp" diff --git a/srcpkgs/openjdk17/files/musl_patches/x86.patch b/srcpkgs/openjdk17/files/musl_patches/x86.patch new file mode 100644 index 0000000000..9c64c18903 --- /dev/null +++ b/srcpkgs/openjdk17/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 ++ . */ ++ ++#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 ++ ++/* 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/openjdk17/template b/srcpkgs/openjdk17/template new file mode 100644 index 0000000000..5b8b801513 --- /dev/null +++ b/srcpkgs/openjdk17/template @@ -0,0 +1,234 @@ +# Template file for 'openjdk17' +_java_ver=17 +_java_min_ver=0 +_java_sec_ver=1 +_jdk_update=12 +_jdk_home="usr/lib/jvm/openjdk${_java_ver}" +_base_version="${_java_ver}.${_java_min_ver}.${_java_sec_ver}" + +pkgname=openjdk17 +version="${_base_version}+${_jdk_update}" +revision=1 +wrksrc="jdk${_java_ver}u-jdk-${_base_version}-${_jdk_update}" +build_style=gnu-configure +configure_args="--disable-warnings-as-errors + --enable-unlimited-crypto + --with-zlib=system + --with-libjpeg=system + --with-giflib=system + --with-libpng=system + --with-lcms=system + --with-jtreg=no + --with-gtest=${XBPS_BUILDDIR}/googletest-release-1.8.1 + --with-debug-level=release + --with-jobs=${XBPS_ORIG_MAKEJOBS} + --with-version-pre= + --with-version-build=${_jdk_update} + --with-version-opt=void-r${revision} + --with-vendor-name=Void + --with-vendor-url=https://voidlinux.org/ + --with-vendor-bug-url=https://github.com/void-linux/void-packages/issues + --with-vendor-vm-bug-url=https://github.com/void-linux/void-packages/issues" +make_build_args="images $(vopt_if docs docs)" +make_install_args="INSTALL_PREFIX=\"${DESTDIR}/usr/lib\"" +make_check_target="test-hotspot-gtest" +hostmakedepends="pkg-config automake autoconf cpio tar unzip zip ca-certificates + libressl zlib-devel which make-ca" +makedepends="libXrender-devel libXtst-devel libXt-devel libXrandr-devel + giflib-devel libjpeg-turbo-devel cups-devel freetype-devel alsa-lib-devel + fontconfig-devel zlib-devel lcms2-devel" +depends="${pkgname}-jre-${version}_${revision}" +provides="java-environment-${version}_1" +short_desc="OpenJDK Java Development Kit (version ${_java_ver})" +maintainer="classabbyamp " +license="GPL-2.0-only WITH Classpath-exception-2.0" +homepage="http://openjdk.java.net/" +distfiles="https://github.com/openjdk/jdk${_java_ver}u/archive/jdk-${version}.tar.gz + https://github.com/google/googletest/archive/refs/tags/release-1.8.1.tar.gz" +checksum="8c076203a6f85ab916b3e54de1992bcbcc5ffe580c52b1ac8d52ca7afb9f02d1 + 9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c" + +# Build is still parallel, but don't use -jN. +disable_parallel_build=yes +build_options="docs" + +# no hotspot JIT for ppc32 +case "$XBPS_TARGET_MACHINE" in + ppc64*) ;; + ppc*) _use_zero=yes ;; +esac + +if [ -n "$_use_zero" ]; then + makedepends+=" libffi-devel" + configure_args+=" --with-jvm-variants=zero" + case "$XBPS_TARGET_MACHINE" in + ppc*) configure_args+=" --with-boot-jdk-jvmargs=-XX:ThreadStackSize=2560";; + esac +fi +configure_args+=" --with-boot-jdk-jvmargs=-Xlog:disable" + +case "$XBPS_TARGET_LIBC" in + glibc) build_options_default+=" docs";; +esac + +if [ ! "$CROSS_BUILD" ]; then + hostmakedepends+=" openjdk16-bootstrap" + configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk16" +else + hostmakedepends+=" openjdk17" + configure_args+=" --with-boot-jdk=/usr/lib/jvm/openjdk17" +fi + +if [ -n "$XBPS_DEBUG_PKGS" ]; then + configure_args+=" --with-native-debug-symbols=internal" +fi + +alternatives=" + java:/usr/bin/java:/${_jdk_home}/bin/java + java:/usr/bin/jfr:/${_jdk_home}/bin/jfr + java:/usr/bin/keytool:/${_jdk_home}/bin/keytool + java:/usr/bin/rmiregistry:/${_jdk_home}/bin/rmiregistry + + jdk:/usr/bin/jar:/${_jdk_home}/bin/jar + jdk:/usr/bin/jarsigner:/${_jdk_home}/bin/jarsigner + jdk:/usr/bin/java:/${_jdk_home}/bin/java + jdk:/usr/bin/javac:/${_jdk_home}/bin/javac + jdk:/usr/bin/javadoc:/${_jdk_home}/bin/javadoc + jdk:/usr/bin/javap:/${_jdk_home}/bin/javap + jdk:/usr/bin/jcmd:/${_jdk_home}/bin/jcmd + jdk:/usr/bin/jconsole:/${_jdk_home}/bin/jconsole + jdk:/usr/bin/jdb:/${_jdk_home}/bin/jdb + jdk:/usr/bin/jdeprscan:/${_jdk_home}/bin/jdeprscan + jdk:/usr/bin/jdeps:/${_jdk_home}/bin/jdeps + jdk:/usr/bin/jfr:/${_jdk_home}/bin/jfr + jdk:/usr/bin/jhsdb:/${_jdk_home}/bin/jhsdb + jdk:/usr/bin/jimage:/${_jdk_home}/bin/jimage + jdk:/usr/bin/jinfo:/${_jdk_home}/bin/jinfo + jdk:/usr/bin/jlink:/${_jdk_home}/bin/jlink + jdk:/usr/bin/jmap:/${_jdk_home}/bin/jmap + jdk:/usr/bin/jmod:/${_jdk_home}/bin/jmod + jdk:/usr/bin/jpackage:/${_jdk_home}/bin/jpackage + jdk:/usr/bin/jps:/${_jdk_home}/bin/jps + jdk:/usr/bin/jrunscript:/${_jdk_home}/bin/jrunscript + jdk:/usr/bin/jshell:/${_jdk_home}/bin/jshell + jdk:/usr/bin/jstack:/${_jdk_home}/bin/jstack + jdk:/usr/bin/jstat:/${_jdk_home}/bin/jstat + jdk:/usr/bin/jstatd:/${_jdk_home}/bin/jstatd + jdk:/usr/bin/keytool:/${_jdk_home}/bin/keytool + jdk:/usr/bin/rmiregistry:/${_jdk_home}/bin/rmiregistry + jdk:/usr/bin/serialver:/${_jdk_home}/bin/serialver +" + +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 + msg_normal "Applying ${f#$FILESDIR/}\n" + patch -lNp1 -i "$f" + done + fi +} + +do_configure() { + CFLAGS=${CFLAGS/-D_FORTIFY_SOURCE=2/} + CXXFLAGS=${CXXFLAGS/-D_FORTIFY_SOURCE=2/} + + # force ELFv2 for ppc64 just in case + case "$XBPS_TARGET_MACHINE" in + ppc64*) + CFLAGS+=" -DABI_ELFv2" + CXXFLAGS+=" -DABI_ELFv2" + ;; + esac + + configure_args=${configure_args/--with-libtool-sysroot=$XBPS_CROSS_BASE} + if [ "$XBPS_CCACHE" ] && [ -z "$CROSS_BUILD" ]; then + configure_args+=" --enable-ccache" + CC="/usr/bin/cc" + CXX="/usr/bin/c++" + fi + ./configure ${configure_args} \ + --with-extra-cflags="$CFLAGS" \ + --with-extra-cxxflags="$CXXFLAGS" \ + --with-extra-ldflags="$LDFLAGS" \ + READELF=$READELF AR=$AR STRIP=$STRIP NM=$NM \ + OBJDUMP=$OBJDUMP OBJCOPY=$OBJCOPY +} + +post_install() { + rm -rf ${DESTDIR}/usr/lib/bin + mv ${DESTDIR}/usr/lib/jvm/openjdk-${_base_version} ${DESTDIR}/$_jdk_home + vmkdir $_jdk_home/lib/security + make-ca -g -f --destdir "${PWD}/ca" -k "${DESTDIR}/$_jdk_home/bin/keytool" + mv ./ca/etc/pki/tls/java/cacerts ${DESTDIR}/$_jdk_home/lib/security/ + chmod -R ugo+rw ./ca + rm -rf ./ca +} + +do_clean() { + # clean up gtest + rm -rf ${XBPS_BUILDDIR}/googletest-release-* +} + +subpackages="openjdk17-src openjdk17-jre openjdk17-doc" + +openjdk17-jre_package() { + shlib_provides="libawt.so libawt_xawt.so libjava.so libjli.so libjvm.so libjawt.so" + short_desc+=" - runtime components" + provides="java-runtime-${version}_1" + alternatives=" + java:/usr/bin/java:/${_jdk_home}/bin/java + java:/usr/bin/jfr:/${_jdk_home}/bin/jfr + java:/usr/bin/keytool:/${_jdk_home}/bin/keytool + java:/usr/bin/rmiregistry:/${_jdk_home}/bin/rmiregistry + " + pkg_install() { + for bf in java jfr keytool rmiregistry; do + vmove $_jdk_home/bin/$bf + done + + for f in lib legal conf release; do + vmove $_jdk_home/$f + done + + vmkdir etc/profile.d + cat >>${PKGDESTDIR}/etc/profile.d/10_openjdk17.sh <<-EOF +export JAVA_HOME=\${JAVA_HOME=/$_jdk_home} +EOF + + vlicense ASSEMBLY_EXCEPTION + vlicense LICENSE + } +} + +openjdk17-doc_package() { + nostrip=yes + noverifyrdeps=yes + noshlibprovides=yes + short_desc+=" - documentation" + pkg_install() { + cd ${wrksrc} + if [ "$build_option_docs" ]; then + local _docdir=usr/share/doc/openjdk$_java_ver + vmkdir $_docdir + cp -a build/linux-*/images/docs/* ${PKGDESTDIR}/$_docdir + fi + vmove $_jdk_home/man/man1 + } +} + +openjdk17-src_package() { + nostrip=yes + noverifyrdeps=yes + noshlibprovides=yes + short_desc+=" - source code" + pkg_install() { + vmove "$_jdk_home/lib/src.zip" + } +} diff --git a/srcpkgs/openjdk17/update b/srcpkgs/openjdk17/update new file mode 100644 index 0000000000..baa13a22f3 --- /dev/null +++ b/srcpkgs/openjdk17/update @@ -0,0 +1 @@ +pattern='jdk-\K17\.[\d.+]+' \ No newline at end of file