aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-02-19 07:48:39 +0000
committerTimo Teräs <timo.teras@iki.fi>2014-02-19 07:50:34 +0000
commit8df009284c4c1f79abd2360b5c373fb391c34706 (patch)
treefaebca0cc634d1472f721acbe1e63214461e88f0 /main
parent20eae13751573f2ba970f44d16674cbaaf69e101 (diff)
downloadaports-8df009284c4c1f79abd2360b5c373fb391c34706.tar.bz2
aports-8df009284c4c1f79abd2360b5c373fb391c34706.tar.xz
main/openjdk6: fix musl build
exclude hotspot agent as thread_db is not properly supported in musl.
Diffstat (limited to 'main')
-rw-r--r--main/openjdk6/APKBUILD26
-rw-r--r--main/openjdk6/icedtea-hotspot-musl.patch55
-rw-r--r--main/openjdk6/icedtea-hotspot-noagent-musl.patch56
-rw-r--r--main/openjdk6/icedtea-hotspot-uclibc-fixes.patch51
-rw-r--r--main/openjdk6/icedtea-jdk-execinfo.patch8
-rw-r--r--main/openjdk6/icedtea-jdk-musl.patch196
6 files changed, 361 insertions, 31 deletions
diff --git a/main/openjdk6/APKBUILD b/main/openjdk6/APKBUILD
index fdd3468388..dadecdf4b0 100644
--- a/main/openjdk6/APKBUILD
+++ b/main/openjdk6/APKBUILD
@@ -4,7 +4,7 @@ pkgname=openjdk6
_icedteaver=1.12.8
_openjdkbuild=27
pkgver=6.$_openjdkbuild.$_icedteaver
-pkgrel=0
+pkgrel=1
pkgdesc="Sun OpenJDK 6 via IcedTea"
url="http://icedtea.classpath.org/"
arch="x86 x86_64"
@@ -53,9 +53,12 @@ source="http://download.java.net/openjdk/jdk6/promoted/$OPENJDK_VERSION/openjdk-
http://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VER-bin.tar.gz
ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino$RHINO_VER.zip
icedtea-hotspot-uclibc-fixes.patch
+ icedtea-hotspot-musl.patch
+ icedtea-hotspot-noagent-musl.patch
icedtea-jdk-fix-ipv6-init.patch
icedtea-jdk-iconv-uclibc.patch
icedtea-jdk-execinfo.patch
+ icedtea-jdk-musl.patch
icedtea-jdk-no-lib-nsl-uclibc.patch
icedtea6-1.9.7-generate_cacerts-1.patch
icedtea-jdk-no-soname.patch
@@ -215,10 +218,13 @@ md5sums="3a0963158e07c8829c8bd31a698bd23d openjdk-6-src-b27-26_oct_2012.tar.gz
7712c4b3b9f8092aa8c7b5cad0b46d06 icedtea6-1.12.8.tar.gz
9a2826a1819aa128629778217af36c55 apache-ant-1.9.2-bin.tar.gz
99d94103662a8d0b571e247a77432ac5 rhino1_7R3.zip
-dc6a1e28a97d897d7a1057c11696727d icedtea-hotspot-uclibc-fixes.patch
+58c107b4c03cd365b4ddf0bfd8179cc4 icedtea-hotspot-uclibc-fixes.patch
+e9beae91433317ccf785bccafaf53b1b icedtea-hotspot-musl.patch
+50ccd48072537d6e9bc562cb65431871 icedtea-hotspot-noagent-musl.patch
250b0807b59762670954b132e8f8dfba icedtea-jdk-fix-ipv6-init.patch
7c0814181e5adc0763c5c0a24b01d4cb icedtea-jdk-iconv-uclibc.patch
-dae2ba8b87e2106b53974ace07e4ca72 icedtea-jdk-execinfo.patch
+bd623081d5d2e63694c3649975b12412 icedtea-jdk-execinfo.patch
+9c7810cb0ff1e89935690e4810199c1f icedtea-jdk-musl.patch
c4bb40d5b1ff690b27900c5cd06bc1e5 icedtea-jdk-no-lib-nsl-uclibc.patch
0bc0131c87fcc0d1046e3ba20d205c73 icedtea6-1.9.7-generate_cacerts-1.patch
d014431e70cdabb82a75e4b9ae4c28a9 icedtea-jdk-no-soname.patch
@@ -227,10 +233,13 @@ sha256sums="044c3877b15940ff04f8aa817337f2878a00cc89674854557f1a02f15b1802a0 op
c2ad74af29af774f778675d3fde952f4defebb2be44f565253d788e2e7af39d4 icedtea6-1.12.8.tar.gz
cab1b8754e5f1f2aa869e2ba603903ae5e81a585de4eafd00f173531a11b5a45 apache-ant-1.9.2-bin.tar.gz
885b46e24fe5af23ad3712c5e08e8d97d6d92a4b89e1be860e8fe88e4a3dacd1 rhino1_7R3.zip
-f4b06c01b664922a6d7785d90bb888fe4665ae9ed6ae76c5484314821fd2cc2d icedtea-hotspot-uclibc-fixes.patch
+6f3642c6c29b8be6c5fe0f204183bc05e57459546ea64de0491713963b8a8ebd icedtea-hotspot-uclibc-fixes.patch
+d3ad6890f6732f0a87a44de0914fe4146078c204808573118ff7716142f67823 icedtea-hotspot-musl.patch
+3332640b95773532c197d7d8818bfb2ee3217093e4a6bc57914bda355423c842 icedtea-hotspot-noagent-musl.patch
632683ec88a6fb250ef043aae9cace605d0c669b7058f8c47b62b09b03ecc6c5 icedtea-jdk-fix-ipv6-init.patch
a36ff13d81a1f1415bedd595b77f2c43574c546938cce7882cb33bbe63464865 icedtea-jdk-iconv-uclibc.patch
-024a22622da408aa9db5b258e3eed49500292483c923f62b19aa6db0a3fed7b7 icedtea-jdk-execinfo.patch
+6cebef19d8eec5a4623a96c37ae71b79d124a10478c1db33ad5fc71bc04b30e9 icedtea-jdk-execinfo.patch
+7c5dc3744be7394c106ced3418ce8eb5a0860660d11dce8eb95c6b4faf630958 icedtea-jdk-musl.patch
6bba2870af0c5eac7b6edb7351e8e1833db401b1bf6b4861a14dcb1fd45cbea6 icedtea-jdk-no-lib-nsl-uclibc.patch
f83dea0ee1d11deceb45d643cf0cce84099775de88b972e3ea979a8529bf4c85 icedtea6-1.9.7-generate_cacerts-1.patch
6c0bbe710395c4ced1359ab279be6a7c36da5bfb9fd60dc47d920f06a0456d82 icedtea-jdk-no-soname.patch
@@ -239,10 +248,13 @@ sha512sums="4198f11b2f49c9bc5ffbeadf2d0d87dfa413a918d49faff3a043266bf4a2fa99579f
8e1cdf4124ee7b7c67f1832043546aea530de98ace3bb2177a5015c24aa81f8fd5f5b2a84f3dee7fb83cfb1680eef1fa17af0464c73a6b8947926a2d2c91d202 icedtea6-1.12.8.tar.gz
618c0c3d80f7c44c2bb8cdfdc2b5278ccd926ab1aa0c8f7099bd0ad5cb4c090f023c0b86c8267052a0a6b1ac57076296fcc16042b9e7a72a1482af63c99e0e49 apache-ant-1.9.2-bin.tar.gz
77964485481e22d20459ea094c773e1930c5ef22d69bc449375a1ead31f340b3a652e2dd85c645e210be1abc8e623aeb560a5dc81629f388322af270ce868d36 rhino1_7R3.zip
-dc5a72ef92cd31e9ba4870ad2126f619932bae5918b6f6ad22af59dbc3e77a70fc27ba37909df0612f70922dfec6a58464469a18ed7a77d902c4a5038e086900 icedtea-hotspot-uclibc-fixes.patch
+1fcc9d22bdc0a991e1739f2d15db73c7ada7640223eb79a9db3bfe106c39b0228e9196af10eba754a2f3f6f26b9b2c4b814be23b3149f72103a369bbc5c0fae8 icedtea-hotspot-uclibc-fixes.patch
+8039e155511e066e4c7031b0ad4fe721a86f3be859e949f2e30fda5cefb04d4e1cf64059f6603325f5f13434855346931659c07b1e8527959767f3ff7f83df7b icedtea-hotspot-musl.patch
+f079b4f353a54b8927609c3ce2836ccce0495830557de0c66402e3a0e3f30f08dec4832e4b2fab6fc57d1dbedd1ef93fb15d994ebcec823663cd5a6e90c14c8a icedtea-hotspot-noagent-musl.patch
48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774 icedtea-jdk-fix-ipv6-init.patch
a6ee1c63a171859ab1350481bc3e5d464354f1105d80fc72c1d58620672ca5c1a550b954b35917f89537f0aeb28c49470b27522ce53588e42dedff41e074774c icedtea-jdk-iconv-uclibc.patch
-dd8d7edad8309d41881d92d173b7b86e37d833bdb9be0ae9dbc39844b226b77f0e2dc2a137a50738c7642df32964b92c6ee74d0a6207aa3f4f7abaeb40ea3435 icedtea-jdk-execinfo.patch
+0391970e6a32946aa3cccf38fdef9c0fe2af26cd0df824b98aa2fcfa1bf661d4a68e339bffcfd16f386c565fc68bb28a29208a67d4bad8a0e847ad02bd8becbb icedtea-jdk-execinfo.patch
+fb9b324763e75a24b7174a5b25a064947d31f25b51e45b3b5225adf02a6eae98467aa1d0edfe606e93621b560900ab4c5acab09be411edff86cd82f6ba830cd3 icedtea-jdk-musl.patch
833ec90fa9d3d26191303201012e4b8ca220d634497277f7e8c703ca03753720343e22c97dd2f10cd3e3be79c84f95b8c7d0db21545b8a35761c0de7cb834e7a icedtea-jdk-no-lib-nsl-uclibc.patch
5fbf3571abd6e0eece8fecd45365996ff83368d674782da3435681afdd6cbb51c6da7e8e4d9ca3ba767a1d373a01d0a4109d1c9bf9b93109a34accaee134a8ab icedtea6-1.9.7-generate_cacerts-1.patch
bf4b184e170f7b0ff64ab30d2162784fe2bd5460d1fa31973259f7065fd4c511c46f97724fe2bd72bb94e9006cb568d0e0c87d1a9c90819e65880f8f44830bb1 icedtea-jdk-no-soname.patch
diff --git a/main/openjdk6/icedtea-hotspot-musl.patch b/main/openjdk6/icedtea-hotspot-musl.patch
new file mode 100644
index 0000000000..ef61635489
--- /dev/null
+++ b/main/openjdk6/icedtea-hotspot-musl.patch
@@ -0,0 +1,55 @@
+--- openjdk.orig/hotspot/src/os/linux/vm/jvm_linux.cpp
++++ openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp
+@@ -159,7 +159,9 @@
+ #ifdef SIGSTKFLT
+ "STKFLT", SIGSTKFLT, /* Stack fault. */
+ #endif
++#ifdef SIGCLD
+ "CLD", SIGCLD, /* Same as SIGCHLD (System V). */
++#endif
+ "CHLD", SIGCHLD, /* Child status has changed (POSIX). */
+ "CONT", SIGCONT, /* Continue (POSIX). */
+ "STOP", SIGSTOP, /* Stop, unblockable (POSIX). */
+--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.inline.hpp
++++ openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
+@@ -44,7 +44,7 @@
+
+ #include <unistd.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <netdb.h>
+
+ inline void* os::thread_local_storage_at(int index) {
+--- openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
+@@ -31,7 +31,9 @@
+ // map stack pointer to thread pointer - see notes in threadLS_linux_x86.cpp
+ #define SP_BITLENGTH 32
+ #define PAGE_SHIFT 12
++ #ifndef PAGE_SIZE
+ #define PAGE_SIZE (1UL << PAGE_SHIFT)
++ #endif
+ static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
+ #endif // !AMD64
+
+--- openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+@@ -79,7 +79,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+@@ -529,6 +528,9 @@
+
+ ShouldNotReachHere();
+ }
++
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
+
+ void os::Linux::init_thread_fpu_state(void) {
+ #ifndef AMD64
diff --git a/main/openjdk6/icedtea-hotspot-noagent-musl.patch b/main/openjdk6/icedtea-hotspot-noagent-musl.patch
new file mode 100644
index 0000000000..0128241a96
--- /dev/null
+++ b/main/openjdk6/icedtea-hotspot-noagent-musl.patch
@@ -0,0 +1,56 @@
+--- openjdk.orig/hotspot/make/linux/makefiles/sa.make
++++ openjdk/hotspot/make/linux/makefiles/sa.make
+@@ -59,9 +59,12 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium, PowerPC, ARM or zero.
++# check for thread_db.h too (musl does not have it).
+
+ all:
+- if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
++ if [ -d $(AGENT_DIR) \
++ -a -f /usr/include/thread_db.h \
++ -a "$(SRCARCH)" != "ia64" \
+ -a "$(SRCARCH)" != "arm" \
+ -a "$(SRCARCH)" != "ppc" \
+ -a "$(SRCARCH)" != "zero" ] ; then \
+--- openjdk.orig/hotspot/make/linux/makefiles/saproc.make
++++ openjdk/hotspot/make/linux/makefiles/saproc.make
+@@ -54,10 +54,13 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium, PPC, ARM or zero.
++# check for thread_db.h too (musl does not have it).
+
++ifneq ($(wildcard /usr/include/thread_db.h),)
+ ifneq ($(wildcard $(AGENT_DIR)),)
+ ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
+ BUILDLIBSAPROC = $(LIBSAPROC)
++endif
+ endif
+ endif
+
+--- openjdk.orig/hotspot/make/linux/makefiles/defs.make
++++ openjdk/hotspot/make/linux/makefiles/defs.make
+@@ -144,10 +144,17 @@
+
+ # Serviceability Binaries
+ # No SA Support for PPC, IA64, ARM or zero
+-ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
+- $(EXPORT_LIB_DIR)/sa-jdi.jar
+-ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
+- $(EXPORT_LIB_DIR)/sa-jdi.jar
++# or if thread_db.h missing (musl)
++
++ifneq ($(wildcard /usr/include/thread_db.h),)
++SA_BINARY_LIST = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.so \
++ $(EXPORT_LIB_DIR)/sa-jdi.jar
++else
++SA_BINARY_LIST =
++endif
++
++ADD_SA_BINARIES/x86 = $(SA_BINARY_LIST)
++ADD_SA_BINARIES/sparc = $(SA_BINARY_LIST)
+ ADD_SA_BINARIES/ppc =
+ ADD_SA_BINARIES/ia64 =
+ ADD_SA_BINARIES/arm =
diff --git a/main/openjdk6/icedtea-hotspot-uclibc-fixes.patch b/main/openjdk6/icedtea-hotspot-uclibc-fixes.patch
index fb75ffc340..0cf4eade04 100644
--- a/main/openjdk6/icedtea-hotspot-uclibc-fixes.patch
+++ b/main/openjdk6/icedtea-hotspot-uclibc-fixes.patch
@@ -1,6 +1,6 @@
--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
-@@ -53,7 +53,6 @@
+@@ -109,7 +109,6 @@
# include <string.h>
# include <syscall.h>
# include <sys/sysinfo.h>
@@ -8,18 +8,29 @@
# include <sys/ipc.h>
# include <sys/shm.h>
# include <link.h>
-@@ -553,9 +552,7 @@
- os::Linux::set_glibc_version(str);
- } else {
- // _CS_GNU_LIBC_VERSION is not supported, try gnu_get_libc_version()
-- static char _gnu_libc_version[32];
-- jio_snprintf(_gnu_libc_version, sizeof(_gnu_libc_version),
-- "glibc %s %s", gnu_get_libc_version(), gnu_get_libc_release());
-+ static char _gnu_libc_version[32] = "2.9";
- os::Linux::set_glibc_version(_gnu_libc_version);
+@@ -601,6 +600,13 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if 1
++ // Hard code Alpine Linux supported uclibc/musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++ os::Linux::set_is_NPTL();
++ os::Linux::set_is_floating_stack();
++#else
+ // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION
+ // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a
+ // generic name for earlier versions.
+@@ -659,6 +665,7 @@
+ if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
+ os::Linux::set_is_floating_stack();
}
++#endif
+ }
-@@ -2434,11 +2431,7 @@
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2604,11 +2611,7 @@
// If we are running with earlier version, which did not have symbol versions,
// we should use the base version.
void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
@@ -32,12 +43,11 @@
}
bool os::Linux::libnuma_init() {
-@@ -4446,7 +4439,22 @@
+@@ -4783,7 +4786,25 @@
// Linux doesn't yet have a (official) notion of processor sets,
// so just return the system wide load average.
int os::loadavg(double loadavg[], int nelem) {
-- return ::getloadavg(loadavg, nelem);
-+
++#ifdef __UCLIBC__
+ FILE *LOADAVG;
+ double avg[3] = { 0.0, 0.0, 0.0 };
+ int i, res = -1;;
@@ -53,18 +63,20 @@
+ }
+
+ return res;
++#else
+ return ::getloadavg(loadavg, nelem);
++#endif
}
void os::pause() {
-Only in openjdk: hotspot/src/os/linux/vm/os_linux.cpp.orig
--- openjdk.orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
-@@ -231,14 +231,14 @@
+@@ -238,14 +238,14 @@
// checking for nanness
#ifdef SOLARIS
#ifdef SPARC
-inline int g_isnan(float f) { return isnanf(f); }
-+inline int g_isnan(float f) { return __isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
#else
// isnanf() broken on Intel Solaris use isnand()
inline int g_isnan(float f) { return isnand(f); }
@@ -72,11 +84,11 @@ Only in openjdk: hotspot/src/os/linux/vm/os_linux.cpp.orig
inline int g_isnan(double f) { return isnand(f); }
#elif LINUX
-inline int g_isnan(float f) { return isnanf(f); }
-+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"
-@@ -252,8 +252,8 @@
+@@ -259,8 +259,8 @@
// Checking for finiteness
@@ -87,4 +99,3 @@ Only in openjdk: hotspot/src/os/linux/vm/os_linux.cpp.orig
// Wide characters
-Only in openjdk: hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp.orig
diff --git a/main/openjdk6/icedtea-jdk-execinfo.patch b/main/openjdk6/icedtea-jdk-execinfo.patch
index fb17ab6927..a6499dcb03 100644
--- a/main/openjdk6/icedtea-jdk-execinfo.patch
+++ b/main/openjdk6/icedtea-jdk-execinfo.patch
@@ -5,7 +5,7 @@
#include <X11/Xatom.h>
#include <Xm/MwmUtil.h>
-#ifdef __linux__
-+#if defined(__linux__) && ! defined(__UCLIBC__)
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
#include <execinfo.h>
#endif
#include <stdio.h>
@@ -14,7 +14,7 @@
}
-#ifdef __linux__
-+#if defined(__linux__) && ! defined(__UCLIBC__)
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
void
print_stack (void)
{
@@ -25,7 +25,7 @@
#include <X11/Xos.h>
#include <X11/Xatom.h>
-#ifdef __linux__
-+#if defined(__linux__) && ! defined(__UCLIBC__)
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
#include <execinfo.h>
#endif
@@ -34,7 +34,7 @@
}
-#ifdef __linux__
-+#if defined(__linux__) && ! defined(__UCLIBC__)
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
void print_stack(void)
{
void *array[10];
diff --git a/main/openjdk6/icedtea-jdk-musl.patch b/main/openjdk6/icedtea-jdk-musl.patch
new file mode 100644
index 0000000000..d0710b646d
--- /dev/null
+++ b/main/openjdk6/icedtea-jdk-musl.patch
@@ -0,0 +1,196 @@
+--- openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h
++++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h
+@@ -27,6 +27,7 @@
+ #ifndef MLIB_TYPES_H
+ #define MLIB_TYPES_H
+
++#include <stddef.h> /* for NULL */
+ #include <limits.h>
+ #if defined(_MSC_VER)
+ #include <float.h> /* for FLT_MAX and DBL_MAX */
+--- openjdk.orig/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
++++ openjdk/jdk/src/solaris/hpi/native_threads/src/sys_api_td.c
+@@ -64,11 +64,11 @@
+ #endif /* NO_INTERRUPTIBLE_IO */
+
+ /*
+- * Linux <sys/resource.h> does not define rlim_t (solaris
++ * GLIBC <sys/resource.h> does not define rlim_t (solaris
+ * does). THIS IS PROBABLY NOT THE RIGHT THING TO DO, so
+ * somebody please fix this.
+ */
+-#ifdef __linux__
++#ifdef __GLIBC__
+ typedef int rlim_t ;
+ #else
+ #include <sys/resource.h>
+--- openjdk.orig/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
++++ openjdk/jdk/src/solaris/native/java/io/UnixFileSystem_md.c
+@@ -66,7 +66,7 @@
+ * linux_largefile.h with a good stat64 structure to compile on
+ * glibc2.0 based systems.
+ */
+-#if defined(__solaris__) && !defined(_LFS_LARGEFILE) || !_LFS_LARGEFILE
++#if defined(__solaris__) && (!defined(_LFS_LARGEFILE) || !_LFS_LARGEFILE)
+
+ /* The stat64 structure must be provided for systems without large-file support
+ (e.g., Solaris 2.5.1). These definitions are copied from the Solaris 2.6
+--- openjdk.orig/jdk/src/solaris/native/java/lang/java_props_md.c
++++ openjdk/jdk/src/solaris/native/java/lang/java_props_md.c
+@@ -45,11 +45,13 @@
+ #include "locale_str.h"
+ #include "java_props.h"
+
++#if !defined(CODESET)
+ #ifdef __linux__
+ #define CODESET _NL_CTYPE_CODESET_NAME
+ #else
+ #ifdef ALT_CODESET_KEY
+ #define CODESET ALT_CODESET_KEY
++#endif
+ #endif
+ #endif
+
+--- openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
++++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+@@ -45,6 +45,11 @@
+ #define HENT_BUF_SIZE 1024
+ #define BIG_HENT_BUF_SIZE 10240 /* a jumbo-sized one */
+
++/* glibc vs. linux confusion, define glibc locally to fix musl build */
++#if defined(__linux__) && !defined(__GLIBC__)
++#define __GLIBC__
++#endif
++
+ #ifndef __GLIBC__
+ /* gethostname() is in libc.so but I can't find a header file for it */
+ extern int gethostname(char *buf, int buf_len);
+--- openjdk.orig/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
++++ openjdk/jdk/src/solaris/native/java/net/Inet6AddressImpl.c
+@@ -48,6 +48,11 @@
+ #define NI_MAXHOST 1025
+ #endif
+
++/* glibc vs. linux confusion, define glibc locally to fix musl build */
++#if defined(__linux__) && !defined(__GLIBC__)
++#define __GLIBC__
++#endif
++
+ #ifndef __GLIBC__
+ /* gethostname() is in libc.so but I can't find a header file for it */
+ extern int gethostname(char *buf, int buf_len);
+--- openjdk.orig/jdk/src/solaris/native/java/net/NetworkInterface.c
++++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
+@@ -40,7 +40,6 @@
+ #endif
+ #ifdef __linux__
+ #include <sys/ioctl.h>
+-#include <bits/ioctls.h>
+ #include <linux/sockios.h>
+ #include <sys/utsname.h>
+ #include <stdio.h>
+--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c
++++ openjdk/jdk/src/solaris/native/java/net/linux_close.c
+@@ -59,7 +59,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * The fd table and the number of file descriptors
+@@ -98,6 +98,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- openjdk.orig/jdk/src/solaris/native/java/util/FileSystemPreferences.c
++++ openjdk/jdk/src/solaris/native/java/util/FileSystemPreferences.c
+@@ -47,7 +47,6 @@
+ return (jint) result;
+ }
+
+-
+ typedef struct flock64 FLOCK;
+
+ /**
+--- openjdk.orig/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_config.h
++++ openjdk/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_config.h
+@@ -32,7 +32,7 @@
+ #include <X11/Xutil.h>
+ #include <X11/extensions/shape.h>
+ #include <sys/types.h>
+-#include <sys/unistd.h>
++#include <unistd.h>
+ #include <pthread.h>
+ #include <signal.h>
+ #include <inttypes.h>
+--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
++++ openjdk/jdk/src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
+@@ -34,7 +34,9 @@
+ #include <unistd.h>
+ #include <sys/resource.h>
+ #include <sys/time.h>
++#include <sys/epoll.h>
+
++#if 0
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+@@ -63,6 +65,7 @@
+
+ #ifdef __cplusplus
+ }
++#endif
+ #endif
+
+ #define RESTARTABLE(_cmd, _result) do { \
+--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
++++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+@@ -38,7 +38,7 @@
+ #include <sys/signal.h>
+
+ /* Also defined in src/solaris/native/java/net/linux_close.c */
+-#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++#define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+
+ static void
+ nullHandler(int sig)
+--- openjdk.orig/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h
++++ openjdk/jdk/src/solaris/native/sun/java2d/opengl/OGLFuncs_md.h
+@@ -27,6 +27,7 @@
+ #define OGLFuncs_md_h_Included
+
+ #include <stdlib.h>
++#include <dlfcn.h>
+ #include <link.h>
+ #include "J2D_GL/glx.h"
+ #include "OGLFuncMacros.h"
+--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h
++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h
+@@ -23,9 +23,7 @@
+ * questions.
+ */
+
+-#define ushort unsigned short
+-#define uint unsigned int
+-#define uchar unsigned char
++#include <sys/types.h>
+
+ struct unpacker;
+
+--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
+@@ -46,6 +46,8 @@
+
+ #include "zip.h"
+
++#define uchar unsigned char
++
+ #ifdef NO_ZLIB
+
+ inline bool jar::deflate_bytes(bytes& head, bytes& tail) {