summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/openjdk7/APKBUILD285
-rw-r--r--user/openjdk7/icedtea-cpio.patch11
-rw-r--r--user/openjdk7/icedtea-hotspot-musl-ppc.patch169
-rw-r--r--user/openjdk7/icedtea-hotspot-musl.patch79
-rw-r--r--user/openjdk7/icedtea-hotspot-noagent-musl.patch54
-rw-r--r--user/openjdk7/icedtea-hotspot-uclibc-fixes.patch93
-rw-r--r--user/openjdk7/icedtea-jdk-execinfo.patch40
-rw-r--r--user/openjdk7/icedtea-jdk-fix-build.patch56
-rw-r--r--user/openjdk7/icedtea-jdk-fix-ipv6-init.patch42
-rw-r--r--user/openjdk7/icedtea-jdk-musl.patch116
-rw-r--r--user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch84
-rw-r--r--user/openjdk7/icedtea-jdk-no-soname.patch12
-rw-r--r--user/openjdk7/icedtea-remove-gawk.patch22
-rw-r--r--user/openjdk7/icedtea-tar.patch22
-rw-r--r--user/openjdk7/icedtea-xattr.patch11
-rw-r--r--user/openjdk7/remove-gawk.patch125
-rw-r--r--user/openjdk7/xattr.patch11
17 files changed, 1232 insertions, 0 deletions
diff --git a/user/openjdk7/APKBUILD b/user/openjdk7/APKBUILD
new file mode 100644
index 000000000..536fb54fb
--- /dev/null
+++ b/user/openjdk7/APKBUILD
@@ -0,0 +1,285 @@
+# Contributor: Timo Teras <timo.teras@iki.fi>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Timo Teras <timo.teras@iki.fi>
+pkgname=openjdk7
+_icedteaver=2.6.16
+# pkgver is <JDK version>.<JDK update>
+# check icedtea JDK when updating
+pkgver=7.201.$_icedteaver
+pkgrel=0
+pkgdesc="OpenJDK 7 via IcedTea"
+url="https://icedtea.classpath.org/"
+arch="all"
+license="GPL-2.0-only WITH Classpath-exception-2.0"
+depends="$pkgname-jre java-cacerts"
+options="sover-namecheck"
+makedepends="bash findutils zip file mawk util-linux libxslt
+ autoconf automake linux-headers coreutils cmd:which
+ ca-certificates
+ nss-dev cups-dev libjpeg-turbo-dev giflib-dev libpng-dev libxt-dev
+ lcms2-dev libxp-dev libxtst-dev libxinerama-dev zlib-dev
+ libxrender-dev alsa-lib-dev freetype-dev fontconfig-dev
+ gtk+2.0-dev krb5-dev attr-dev pcsc-lite-dev lksctp-tools-dev
+ libxcomposite-dev nss-static"
+install=""
+
+# upstream binary versions
+RHINO_VER=1.7.7.2
+ANT_VER=1.9.11
+
+case $CARCH in
+x86) _jarch=i386;;
+x86_64) _jarch=amd64;;
+aarch64) _jarch=aarch64;;
+arm*) _jarch=arm
+ # openjdk has quite a bit of arm assembly producing textrels
+ # and it's non trivial to fix. allow it for now.
+ options="$options textrels";;
+s390x) _jarch=s390x;;
+ppc64le) _jarch=ppc64le;;
+ppc64) _jarch=ppc64
+ export CFLAGS="$CFLAGS -DABI_ELFv2";;
+esac
+
+INSTALL_BASE=/usr/lib/jvm/java-1.7-openjdk
+_jrelib="$INSTALL_BASE/jre/lib/$_jarch"
+
+# exclude xawt from ldpath to avoid duplicate provides for libmawt.so
+# (also in headless). in future this should be a virtual provides.
+ldpath="$_jrelib:$_jrelib/native_threads:$_jrelib/headless:$_jrelib/server:$_jrelib/jli"
+sonameprefix="$pkgname:"
+
+subpackages="$pkgname-jre-lib:jrelib:noarch $pkgname-jre $pkgname-jre-base:jrebase
+ $pkgname-doc:doc"
+
+if [ "$BOOTSTRAP" != "no" ]; then
+ makedepends="$makedepends java-gcj-compat"
+ BOOTSTRAP_JAVA_HOME=/usr/lib/jvm/java-1.5-gcj/
+else
+ makedepends="$makedepends $pkgname"
+ BOOTSTRAP_JAVA_HOME="$INSTALL_BASE"
+fi
+
+_dropsver=$_icedteaver
+_dropsurl=https://icedtea.classpath.org/download/drops/icedtea7/$_dropsver
+
+source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaver.tar.gz
+ openjdk-$_dropsver.tar.bz2::$_dropsurl/openjdk.tar.bz2
+ corba-$_dropsver.tar.bz2::$_dropsurl/corba.tar.bz2
+ jaxp-$_dropsver.tar.bz2::$_dropsurl/jaxp.tar.bz2
+ jaxws-$_dropsver.tar.bz2::$_dropsurl/jaxws.tar.bz2
+ jdk-$_dropsver.tar.bz2::$_dropsurl/jdk.tar.bz2
+ langtools-$_dropsver.tar.bz2::$_dropsurl/langtools.tar.bz2
+ hotspot-$_dropsver.tar.bz2::$_dropsurl/hotspot.tar.bz2
+ https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VER-bin.tar.gz
+ https://github.com/mozilla/rhino/releases/download/Rhino${RHINO_VER//./_}_Release/rhino-$RHINO_VER.zip
+
+ icedtea-hotspot-musl.patch
+ icedtea-hotspot-musl-ppc.patch
+ icedtea-hotspot-noagent-musl.patch
+ icedtea-hotspot-uclibc-fixes.patch
+ icedtea-jdk-fix-build.patch
+ icedtea-jdk-execinfo.patch
+ icedtea-jdk-fix-ipv6-init.patch
+ icedtea-jdk-musl.patch
+ icedtea-jdk-no-soname.patch
+ icedtea-cpio.patch
+ icedtea-tar.patch
+ icedtea-remove-gawk.patch
+ icedtea-xattr.patch
+ remove-gawk.patch
+ xattr.patch
+ "
+
+# secfixes:
+# 7.201.2.6.16-r0:
+# - CVE-2018-3136
+# - CVE-2018-3139
+# - CVE-2018-3149
+# - CVE-2018-3169
+# - CVE-2018-3180
+# - CVE-2018-3214
+# - CVE-2018-13785
+
+builddir="$srcdir/icedtea-$_icedteaver"
+
+unpack() {
+ if [ -z "$force" ]; then
+ verify
+ initdcheck
+ fi
+ mkdir -p "$srcdir"
+ msg "Unpacking sources..."
+ tar -C "$srcdir" -zxf icedtea-$_icedteaver.tar.gz
+ tar -C "$srcdir" -zxf apache-ant-$ANT_VER-bin.tar.gz
+ unzip -o -q "rhino-$RHINO_VER.zip" -d "$srcdir"
+}
+
+prepare() {
+ cd "$builddir"
+
+ # Busybox sha256 does not support longopts
+ sed -e "s/--check/-c/g" -i Makefile.am
+
+ for patch in $source; do
+ case $patch in
+ icedtea-*.patch)
+ cp ../$patch patches
+ ;;
+ *.patch)
+ msg "Applying patch $patch"
+ patch -p1 -i "$srcdir"/$patch
+ ;;
+ esac
+ done
+
+ ./autogen.sh
+}
+
+build() {
+ [ -z "$JOBS" ] && export JOBS=$(echo $MAKEFLAGS | sed -n -e 's/.*-j\([0-9]\+\).*/\1/p')
+ export ALT_PARALLEL_COMPILE_JOBS="${JOBS:-2}"
+ export HOTSPOT_BUILD_JOBS="${JOBS:-2}"
+
+ export JAVA_HOME=$BOOTSTRAP_JAVA_HOME
+ export PATH=$JAVA_HOME/bin:$srcdir/apache-ant-$ANT_VER/bin:$PATH
+ export DISTRIBUTION_PATCHES=""
+
+ # Explicitly set the C++ standard as the default has changed on GCC 6+
+ # and disable optimizations that lead to a broken JVM. These options
+ # has been adopted from the Fedora package.
+ export EXTRA_CPP_FLAGS="$CXXFLAGS -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
+ # CXXFLAGS doesn't make it to all calls, so we set the C++ standard
+ # version for C too.
+ export EXTRA_CFLAGS="$CFLAGS -std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
+
+ local patch
+ for patch in $source; do
+ case $patch in
+ icedtea-*.patch)
+ export DISTRIBUTION_PATCHES="$DISTRIBUTION_PATCHES patches/$patch"
+ ;;
+ esac
+ done
+ echo "icedtea patches: $DISTRIBUTION_PATCHES"
+
+ # --disable-arm32-jit: https://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2942
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=$INSTALL_BASE \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --with-parallel-jobs=${JOBS:-2} \
+ --disable-dependency-tracking \
+ --disable-downloading \
+ --disable-arm32-jit \
+ --with-rhino=$srcdir/rhino$RHINO_VER/lib/rhino-$RHINO_VER.jar \
+ --with-openjdk-src-zip=$srcdir/openjdk-$_dropsver.tar.bz2 \
+ --with-hotspot-src-zip=$srcdir/hotspot-$_dropsver.tar.bz2 \
+ --with-corba-src-zip=$srcdir/corba-$_dropsver.tar.bz2 \
+ --with-jaxp-src-zip=$srcdir/jaxp-$_dropsver.tar.bz2 \
+ --with-jaxws-src-zip=$srcdir/jaxws-$_dropsver.tar.bz2 \
+ --with-jdk-src-zip=$srcdir/jdk-$_dropsver.tar.bz2 \
+ --with-langtools-src-zip=$srcdir/langtools-$_dropsver.tar.bz2 \
+ --with-jdk-home=$BOOTSTRAP_JAVA_HOME \
+ --with-pkgversion="Adelie ${pkgver}-r${pkgrel}"
+
+ msg "Icedtea boot"
+ make -j1 icedtea-boot SHELL=/bin/bash
+ msg "Icedtea boot done"
+ make
+}
+
+package() {
+ mkdir -p "$pkgdir"/$INSTALL_BASE
+ cp -a "$builddir"/openjdk.build/j2sdk-image/* "$pkgdir"/$INSTALL_BASE
+ rm "$pkgdir"/$INSTALL_BASE/src.zip
+
+ # symlink to shared java cacerts store
+ rm -f "$pkgdir"/$INSTALL_BASE/jre/lib/security/cacerts
+ ln -sf /etc/ssl/certs/java/cacerts \
+ "$pkgdir"/$INSTALL_BASE/jre/lib/security/cacerts
+}
+
+jrelib() {
+ pkgdesc="OpenJDK 7 Java Runtime (class libraries)"
+ depends=""
+
+ local A; for A in jre/lib/zi jre/lib/images jre/lib/*.jar \
+ jre/lib/security jre/lib/ext/*.jar jre/lib/cmm \
+ jre/ASSEMBLY_EXCEPTION jre/THIRD_PARTY_README jre/LICENSE; do
+
+ local dirname=${A%/*}
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/$dirname
+ mv "$pkgdir"/$INSTALL_BASE/$A "$subpkgdir"/$INSTALL_BASE/$dirname
+ done
+}
+
+jrebase() {
+ pkgdesc="OpenJDK 7 Java Runtime (no GUI support)"
+ depends="$pkgname-jre-lib java-common java-cacerts"
+
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/bin
+
+ local A; for A in java orbd rmid servertool unpack200 keytool \
+ pack200 rmiregistry tnameserv; do
+ mv "$pkgdir"/$INSTALL_BASE/bin/$A "$subpkgdir"/$INSTALL_BASE/bin
+ done
+
+ # rest of the jre subdir (which were not taken by -jre subpkg)
+ mv "$pkgdir"/$INSTALL_BASE/jre "$subpkgdir"/$INSTALL_BASE
+}
+
+jre() {
+ pkgdesc="OpenJDK 7 Java Runtime"
+ # manually depend to avoid clash with libgcj's libjvm.so
+ depends="so:openjdk7:libjvm.so=0"
+
+ mkdir -p "$subpkgdir"
+ local A; for A in jre/bin/policytool \
+ bin/appletviewer \
+ bin/policytool \
+ jre/lib/$_jarch/xawt \
+ jre/lib/$_jarch/libsplashscreen.so; do
+
+ local dirname=${A%/*}
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/$dirname
+ mv "$pkgdir"/$INSTALL_BASE/$A "$subpkgdir"/$INSTALL_BASE/$dirname
+ done
+}
+
+doc() {
+ default_doc
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/
+ mv "$pkgdir"/$INSTALL_BASE/man "$subpkgdir"/$INSTALL_BASE/
+}
+
+sha512sums="cc782e1c5b1ce158be315cff5be61676373870c2062eb34688583a875ab68413bbabd909ce83e79a9c46c3d0c8ec10aad3c015276ddf782ce2079cb5a7098f82 icedtea-2.6.16.tar.gz
+ee2443da63ab6b1a525d0633a577f28d28d3916cb47b312d61d71b4795ae3bde4a70478017b7639133fb65cfb63aa0fcbc397afbde18f20d605a50286163e4a2 openjdk-2.6.16.tar.bz2
+3926a1c889d0ff5386dd78e8fb1ff71b553744fe574ab9655d9e1677da9aea3306d65e631866afcbb533b8e0fefbb34ae655400c9bc7c2058aaa34f8fb0a04d8 corba-2.6.16.tar.bz2
+2b37ba6f235b684682d9590c292b6af5fb6f41d4001f92dcf4945570e13fe760f91bbc7068d071e3e935829c9719936ae96940874ee211fd32cba187e05f0255 jaxp-2.6.16.tar.bz2
+41dc2b7a610cd5f4c9155c14670bb97f1c57924af2737faf6beb7b284c0ad7c0f0b33f4276cde5674a57db3f88ba4503f94f2dff7a52db3273ee53ed0b14be64 jaxws-2.6.16.tar.bz2
+2703b7bf7455aa3997426f2ce3d4c2285ee44640a940d15c1c3434414c295d87b44e749fece5a7b966661910c8768a79774fb03b43ab5605df9dc8965b600fd7 jdk-2.6.16.tar.bz2
+192dd5fac399c52bcb547617832428b40af493089b4bb63159cd9363c78af76c7acdc051d461eb4e4692b2090e05ed769b9fec460a328973b36b57bbb28cee39 langtools-2.6.16.tar.bz2
+73b0338ec293d0d87cc7251f63ef453ec10c7de978c56d8ff455b16ee0506175aed681a9a95fbdcc8b747ba00ef6cf914f63d0c5d22268b40620d4dbc7390a98 hotspot-2.6.16.tar.bz2
+0da12cb0f761b8cb76e042449e7d93f43236e7bc948e337215470a70031f0a2dda6d1b508f9397b283808d84c4ebddb31558fe1cd8e6e6469c1dd390d69ec6e7 apache-ant-1.9.11-bin.tar.gz
+1b9e8721749e81c5420a00af1e00ee0e4f48624ccb4e9aa969032114116ad50f59b254d4d16d74feff74de64157cc8b0a2ead9b555907c84b7055b796fba9a75 rhino-1.7.7.2.zip
+f62b942f0bacda8e37d0f1876d8ba14ddb4fc55a7d5fd1019463744927f40f422a85e9ee051948d566242f5a785aa28f275eb58768611283cba89af91235f43c icedtea-hotspot-musl.patch
+e5cf4d70f96fc1e72ae8b97a887adb96092ff36584711cbb8de9d9fa9e859cb8731d638838de0d9591239fc44ffe5c74422d1842bd9f10a0c00dff1627bdeeef icedtea-hotspot-musl-ppc.patch
+e7a2c1771bb582d427041f8d22e48c0daf8f20d7c0926cbce3549d49c4e949359ee25a35682b486e82f3e390535c950c5beee3bd8d06fb5a717b50f2d9b2a6bc icedtea-hotspot-noagent-musl.patch
+822eee0dc4d3ba677a289dfeb3668b536d2d626708390a9d9702fb4144a481fd443a215a0d2041c6026113837aafa4ba0b5e9ead8589d2da6717a238bbc95a5a icedtea-hotspot-uclibc-fixes.patch
+213a537de5f011cb39d608515c3413513ac75fb93593f9a9ef4205f71d72bdd8b097c80db185f7b26021d5bb85045b866f34f3478482dc4189972d8614a13458 icedtea-jdk-fix-build.patch
+0391970e6a32946aa3cccf38fdef9c0fe2af26cd0df824b98aa2fcfa1bf661d4a68e339bffcfd16f386c565fc68bb28a29208a67d4bad8a0e847ad02bd8becbb icedtea-jdk-execinfo.patch
+48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774 icedtea-jdk-fix-ipv6-init.patch
+44a35941c80f408d0607e32763b3b6ccee21e1d39886309327d3d74d2900117e4346ef59e77c663fd022fec10ee8f365eeb46c1260014d5765d226ce175ce3c5 icedtea-jdk-musl.patch
+bf4b184e170f7b0ff64ab30d2162784fe2bd5460d1fa31973259f7065fd4c511c46f97724fe2bd72bb94e9006cb568d0e0c87d1a9c90819e65880f8f44830bb1 icedtea-jdk-no-soname.patch
+a54c79c82afa1bc95265397b274260584c8b8c6be1651ddfb907d9523a809ea4581409e0d3fb0bbb63ef5a204e8ce29b7940e78cd640af1f490ae938c59129b6 icedtea-cpio.patch
+dc5f59068395e9501b17308c91ec80670c195117e22cb7bef78d551d118f180a11d7f0b5d47f4c7106909d9a9a8c060ddd60b78f251fd35afa6c72a1515af53e icedtea-tar.patch
+049061b97d6e744b7ad9bad4a3dbfa1d236400003175e49740830dcb78a1f164b5c67b066e76c970eb27e09707f948cac0f5b7073abe0f49bcecfdd747f0107d icedtea-remove-gawk.patch
+b9950ddf9c5ebb53d1e029a1fe8ef843860128ceb05872313b33fd2696a4acadbc8291110ca6513ce7531e0f943e42b167068e603f7ecd0e36f5b16d6bb827ab icedtea-xattr.patch
+fda1ba46276475cced16c4f380dbc0a0ac07ae2d66a8da10e88455a299bd40ff04a63dae1c5f3d3de6adbb3c6c240db5d37df0be2fc3391764cb21c9ad83eb8b remove-gawk.patch
+3dd758e04e3b852398d81356c02a89afce0c664938d3f0179ee32e358d7057f5f969379329dd1ebcbf4bc3d37bd5e0d94102cd3f023326db5175968cfbbc9c35 xattr.patch"
diff --git a/user/openjdk7/icedtea-cpio.patch b/user/openjdk7/icedtea-cpio.patch
new file mode 100644
index 000000000..c66c1ca60
--- /dev/null
+++ b/user/openjdk7/icedtea-cpio.patch
@@ -0,0 +1,11 @@
+--- openjdk/jdk/make/common/shared/Defs-utils.gmk.orig
++++ openjdk/jdk/make/common/shared/Defs-utils.gmk
+@@ -104,7 +104,7 @@
+ COMM = $(UTILS_USR_BIN_PATH)comm
+ COMPRESS = $(UTILS_USR_BIN_PATH)compress
+ CP = $(UTILS_COMMAND_PATH)cp
+-CPIO = $(UTILS_COMMAND_PATH)cpio
++CPIO = $(UTILS_USR_BIN_PATH)cpio
+ CUT = $(UTILS_USR_BIN_PATH)cut
+ DATE = $(UTILS_COMMAND_PATH)date
+ DF = $(UTILS_COMMAND_PATH)df
diff --git a/user/openjdk7/icedtea-hotspot-musl-ppc.patch b/user/openjdk7/icedtea-hotspot-musl-ppc.patch
new file mode 100644
index 000000000..eca684884
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-musl-ppc.patch
@@ -0,0 +1,169 @@
+--- openjdk.orig/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
++++ openjdk/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
+@@ -110,11 +110,19 @@
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(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(ucontext_t * uc) {
+@@ -213,7 +221,11 @@
+ if (uc) {
+ address const pc = os::Linux::ucontext_get_pc(uc);
+ if (pc && StubRoutines::is_safefetch_fault(pc)) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = (unsigned long)StubRoutines::continuation_for_safefetch_fault(pc);
++#else // Musl
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)StubRoutines::continuation_for_safefetch_fault(pc);
++#endif
+ return true;
+ }
+ }
+@@ -364,7 +376,11 @@
+ // continue at the next instruction after the faulting read. Returning
+ // garbage from this read is ok.
+ thread->set_pending_unsafe_access_error();
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = ((unsigned long)pc) + 4;
++#else // Musl
++ uc->uc_mcontext.gp_regs[32] = ((unsigned long)pc) + 4;
++#endif
+ return true;
+ }
+ }
+@@ -383,7 +399,11 @@
+ // continue at the next instruction after the faulting read. Returning
+ // garbage from this read is ok.
+ thread->set_pending_unsafe_access_error();
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = ((unsigned long)pc) + 4;
++#else // Musl
++ uc->uc_mcontext.gp_regs[32] = ((unsigned long)pc) + 4;
++#endif
+ return true;
+ }
+ }
+@@ -406,7 +426,11 @@
+ if (stub != NULL) {
+ // Save all thread context in case we need to restore it.
+ if (thread != NULL) thread->set_saved_exception_pc(pc);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = (unsigned long)stub;
++#else
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)stub;
++#endif
+ return true;
+ }
+
+@@ -564,6 +588,7 @@
+ ucontext_t* uc = (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);
+@@ -572,8 +597,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));
+@@ -600,7 +635,11 @@
+ // this is only for the "general purpose" registers
+ 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();
+ }
+--- openjdk.orig/hotspot.orig/src/cpu/ppc/vm/macroAssembler_ppc.cpp
++++ openjdk/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
+@@ -1242,7 +1242,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;
+ }
+@@ -1263,15 +1267,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;
+@@ -1334,11 +1347,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
+ }
diff --git a/user/openjdk7/icedtea-hotspot-musl.patch b/user/openjdk7/icedtea-hotspot-musl.patch
new file mode 100644
index 000000000..1da903148
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-musl.patch
@@ -0,0 +1,79 @@
+--- openjdk.orig/hotspot/src/os/linux/vm/jvm_linux.cpp
++++ openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp
+@@ -154,7 +154,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
+@@ -52,7 +52,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/os_linux_x86.cpp
++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+@@ -73,7 +73,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+@@ -533,6 +532,9 @@
+ ShouldNotReachHere();
+ return true; // Mute compiler
+ }
++
++#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
+--- 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
+@@ -32,7 +32,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)];
+
+ public:
+--- openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp.orig
++++ openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
+@@ -76,7 +76,7 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
++# include <linux/types.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
+--- openjdk/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp.orig
++++ openjdk/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
+@@ -194,10 +194,6 @@
+ return (r->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
+ }
+
+-template <class T> static const T& min (const T& a, const T& b) {
+- return (a > b) ? b : a;
+-}
+-
+ // ---------------------------------------------------------------------------
+ // Read the array of BasicTypes from a signature, and compute where the
+ // arguments should go. Values in the VMRegPair regs array refer to 4-byte
diff --git a/user/openjdk7/icedtea-hotspot-noagent-musl.patch b/user/openjdk7/icedtea-hotspot-noagent-musl.patch
new file mode 100644
index 000000000..37604acca
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-noagent-musl.patch
@@ -0,0 +1,54 @@
+--- openjdk.orig/hotspot/make/linux/makefiles/defs.make
++++ openjdk/hotspot/make/linux/makefiles/defs.make
+@@ -327,6 +327,9 @@
+
+ # Serviceability Binaries
+ # No SA Support for PPC, IA64, ARM or zero
++# or if thread_db.h missing (musl)
++
++ifneq ($(wildcard /usr/include/thread_db.h),)
+ ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
+ $(EXPORT_LIB_DIR)/sa-jdi.jar
+ ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
+@@ -343,6 +346,10 @@
+ endif
+ endif
+ endif
++endif
++else
++ADD_SA_BINARIES/x86 =
++ADD_SA_BINARIES/sparc =
+ endif
+ ADD_SA_BINARIES/ppc =
+ ADD_SA_BINARIES/ppc64 =
+--- openjdk.orig/hotspot/make/linux/makefiles/sa.make
++++ openjdk/hotspot/make/linux/makefiles/sa.make
+@@ -59,9 +59,11 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium 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)" != "zero" \
+ -a "$(SRCARCH)" != "aarch64" ] ; then \
+ $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
+--- openjdk.orig/hotspot/make/linux/makefiles/saproc.make
++++ openjdk/hotspot/make/linux/makefiles/saproc.make
+@@ -65,10 +65,13 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium 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 zero aarch64,$(SRCARCH)),)
+ BUILDLIBSAPROC = $(LIBSAPROC)
++endif
+ endif
+ endif
+
diff --git a/user/openjdk7/icedtea-hotspot-uclibc-fixes.patch b/user/openjdk7/icedtea-hotspot-uclibc-fixes.patch
new file mode 100644
index 000000000..1c1d82276
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-uclibc-fixes.patch
@@ -0,0 +1,93 @@
+--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp
++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
+@@ -112,7 +112,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>
+@@ -632,6 +631,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.
+@@ -690,6 +696,7 @@
+ if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
+ os::Linux::set_is_floating_stack();
+ }
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2951,11 +2958,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) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlsym(handle, name);
+ }
+
+ bool os::Linux::libnuma_init() {
+@@ -5312,7 +5315,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) {
++#ifdef __UCLIBC__
++ FILE *LOADAVG;
++ double avg[3] = { 0.0, 0.0, 0.0 };
++ int i, res = -1;;
++
++ if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
++ fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]);
++ res = 0;
++ fclose(LOADAVG);
++ }
++
++ for (i = 0; (i < nelem) && (i < 3); i++) {
++ loadavg[i] = avg[i];
++ }
++
++ return res;
++#else
+ return ::getloadavg(loadavg, nelem);
++#endif
+ }
+
+ void os::pause() {
+--- openjdk.orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
++++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+@@ -253,7 +253,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"
+@@ -267,8 +267,8 @@
+
+ // Checking for finiteness
+
+-inline int g_isfinite(jfloat f) { return finite(f); }
+-inline int g_isfinite(jdouble f) { return finite(f); }
++inline int g_isfinite(jfloat f) { return isfinite(f); }
++inline int g_isfinite(jdouble f) { return isfinite(f); }
+
+
+ // Wide characters
diff --git a/user/openjdk7/icedtea-jdk-execinfo.patch b/user/openjdk7/icedtea-jdk-execinfo.patch
new file mode 100644
index 000000000..a6499dcb0
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-execinfo.patch
@@ -0,0 +1,40 @@
+--- openjdk.orig/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
++++ openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
+@@ -35,7 +35,7 @@
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+ #include <Xm/MwmUtil.h>
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ #include <execinfo.h>
+ #endif
+ #include <stdio.h>
+@@ -835,7 +835,7 @@
+ AWT_UNLOCK();
+ }
+
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ void
+ print_stack (void)
+ {
+--- openjdk.orig/jdk/src/solaris/native/sun/xawt/XToolkit.c
++++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
+@@ -27,7 +27,7 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ #include <execinfo.h>
+ #endif
+
+@@ -689,7 +689,7 @@
+ return ret;
+ }
+
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ void print_stack(void)
+ {
+ void *array[10];
diff --git a/user/openjdk7/icedtea-jdk-fix-build.patch b/user/openjdk7/icedtea-jdk-fix-build.patch
new file mode 100644
index 000000000..9fae895b6
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-fix-build.patch
@@ -0,0 +1,56 @@
+Fixes three issues:
+ - so's should not be linked to -ljvm as dlopen(/abs/name) is
+ used by the launcher to load libjvm.so; it is thus not available
+ (musl/uclibc) ld.so to satisfy NEEDED dependency inserted by
+ -ljvm. Fix to not link against -ljvm, and disable -z defs so
+ undefined symbols are allowed in sos
+ - the previous makes ldd generate errors on unresolved symbols (musl)
+ remove it altogether as it's used for informative purposes only
+ (display things - not check anything useful)
+ - Don't delete the generated directory $(GENCSEXT), this can
+ confuse make in highly parallel builds with:
+ make[6]: *** INTERNAL: readdir: No such file or directory. Stop.
+ make[6]: Leaving directory '.../openjdk-boot/jdk/make/sun/nio/cs'
+
+--- openjdk.orig/jdk/make/common/Defs-linux.gmk
++++ openjdk/jdk/make/common/Defs-linux.gmk
+@@ -350,7 +350,7 @@
+
+ EXTRA_LIBS += -lc
+
+-LDFLAGS_DEFS_OPTION = -Xlinker -z -Xlinker defs
++LDFLAGS_DEFS_OPTION =
+ LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
+
+ #
+@@ -407,7 +407,7 @@
+ # the library itself should not.
+ #
+ VM_NAME = server
+-JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
++JVMLIB =
+ JAVALIB = -ljava $(JVMLIB)
+
+ #
+--- openjdk.orig/jdk/make/sun/nio/cs/Makefile
++++ openjdk/jdk/make/sun/nio/cs/Makefile
+@@ -107,7 +107,7 @@
+ $(GENCSDATASRC)/DoubleByte-X.java.template \
+ $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs
+ @$(prep-target)
+- $(RM) -r $(GENCSEXT)
++ $(RM) -f "$(GENCSEXT)"/*
+ $(MKDIR) -p $(GENCSEXT)
+ $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs
+ $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \
+--- openjdk.orig/jdk/make/common/shared/Defs-linux.gmk
++++ openjdk/jdk/make/common/shared/Defs-linux.gmk
+@@ -207,8 +207,6 @@
+ if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
+ $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \
+ fi && \
+- $(ECHO) "Library loads for: $1" && \
+- $(LDD) $1 && \
+ $(ECHO) "RUNPATH for: $1" && \
+ ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
+ )
diff --git a/user/openjdk7/icedtea-jdk-fix-ipv6-init.patch b/user/openjdk7/icedtea-jdk-fix-ipv6-init.patch
new file mode 100644
index 000000000..11f3bf6dd
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-fix-ipv6-init.patch
@@ -0,0 +1,42 @@
+--- openjdk/jdk/src/solaris/native/java/net/net_util_md.c.orig
++++ openjdk/jdk/src/solaris/native/java/net/net_util_md.c
+@@ -561,7 +561,7 @@
+
+ static struct localinterface *localifs = 0;
+ static int localifsSize = 0; /* size of array */
+-static int nifs = 0; /* number of entries used in array */
++static int nifs = -1; /* number of entries used in array */
+
+ /* not thread safe: make sure called once from one thread */
+
+@@ -573,6 +573,10 @@
+ int index, x1, x2, x3;
+ unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
+
++ if (nifs >= 0)
++ return ;
++ nifs = 0;
++
+ if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) {
+ return ;
+ }
+@@ -601,7 +605,7 @@
+ localifs = (struct localinterface *) realloc (
+ localifs, sizeof (struct localinterface)* (localifsSize+5));
+ if (localifs == 0) {
+- nifs = 0;
++ nifs = -1;
+ fclose (f);
+ return;
+ }
+@@ -624,9 +628,7 @@
+ static int getLocalScopeID (char *addr) {
+ struct localinterface *lif;
+ int i;
+- if (localifs == 0) {
+- initLocalIfs();
+- }
++ initLocalIfs();
+ for (i=0, lif=localifs; i<nifs; i++, lif++) {
+ if (memcmp (addr, lif->localaddr, 16) == 0) {
+ return lif->index;
diff --git a/user/openjdk7/icedtea-jdk-musl.patch b/user/openjdk7/icedtea-jdk-musl.patch
new file mode 100644
index 000000000..49c16d73a
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-musl.patch
@@ -0,0 +1,116 @@
+diff -ru 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
+--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2014-07-15 07:19:52.186682096 +0000
+@@ -46,6 +46,8 @@
+
+ #include "zip.h"
+
++#define uchar unsigned char
++
+ #ifdef NO_ZLIB
+
+ inline bool jar::deflate_bytes(bytes& head, bytes& tail) {
+diff -ru 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
+--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2014-07-15 07:19:52.186682096 +0000
+@@ -23,9 +23,7 @@
+ * questions.
+ */
+
+-#define ushort unsigned short
+-#define uint unsigned int
+-#define uchar unsigned char
++#include <sys/types.h>
+
+ struct unpacker;
+
+diff -ru openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h
+--- openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2014-07-15 07:19:52.186682096 +0000
+@@ -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 */
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2014-07-15 07:19:52.186682096 +0000
+@@ -47,7 +47,7 @@
+
+ #include "java_net_Inet4AddressImpl.h"
+
+-#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
++#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
+ #define HAS_GLIBC_GETHOSTBY_R 1
+ #endif
+
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/NetworkInterface.c openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/NetworkInterface.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c 2014-07-15 07:19:52.186682096 +0000
+@@ -47,7 +47,6 @@
+
+ #ifdef __linux__
+ #include <sys/ioctl.h>
+-#include <bits/ioctls.h>
+ #include <sys/utsname.h>
+ #include <stdio.h>
+ #endif
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2014-07-15 07:19:52.190015524 +0000
+@@ -35,7 +35,6 @@
+ #endif
+ #ifdef __linux__
+ #include <unistd.h>
+-#include <sys/sysctl.h>
+ #include <sys/utsname.h>
+ #include <netinet/ip.h>
+
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2014-07-15 07:19:52.190015524 +0000
+@@ -43,7 +43,6 @@
+ #endif
+ #ifdef __linux__
+ #include <unistd.h>
+-#include <sys/sysctl.h>
+ #endif
+
+ #include "jvm.h"
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/linux_close.c 2014-07-15 07:22:17.609355950 +0000
+@@ -75,7 +75,7 @@
+ #ifdef _AIX
+ static int sigWakeup = (SIGRTMAX - 1);
+ #else
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+ #endif
+
+ /*
+@@ -148,6 +148,9 @@
+ /*
+ * Setup the signal handler
+ */
++#ifndef __AIX
++ sigWakeup = SIGRTMAX - 2;
++#endif
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+diff -ru openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2014-07-15 07:19:52.190015524 +0000
+@@ -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)
diff --git a/user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch b/user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch
new file mode 100644
index 000000000..26f89bb54
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch
@@ -0,0 +1,84 @@
+--- openjdk.orig/hotspot/agent/src/os/solaris/dbx/Makefile
++++ openjdk/hotspot/agent/src/os/solaris/dbx/Makefile
+@@ -50,7 +50,7 @@
+ CFLAGS_32bit := -xarch=v8
+ CFLAGS_64bit := -xarch=v9
+ CFLAGS := -PIC -xO3 $(INCLUDES)
+-LIBS := -lsocket -lnsl -lrtld_db
++LIBS := -lsocket -lrtld_db
+ LDFLAGS := -G
+
+ ifneq "$(ARCH)" "i486"
+--- openjdk.orig/jdk/make/java/hpi/hpi_common.gmk
++++ openjdk/jdk/make/java/hpi/hpi_common.gmk
+@@ -86,5 +86,5 @@
+ # Things that must be linked in.
+ #
+ ifneq ($(PLATFORM), windows)
+-OTHER_LDLIBS += $(LIBSOCKET) -lnsl $(LIBM) -ldl
++OTHER_LDLIBS += $(LIBSOCKET) $(LIBM) -ldl
+ endif
+--- openjdk.orig/jdk/make/java/java/Makefile
++++ openjdk/jdk/make/java/java/Makefile
+@@ -205,7 +205,7 @@
+ OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
+ -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib
+ else
+-OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -lnsl -ldl \
++OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -ldl \
+ -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
+ endif
+
+--- openjdk.orig/jdk/make/java/java_hprof_demo/Makefile
++++ openjdk/jdk/make/java/java_hprof_demo/Makefile
+@@ -83,7 +83,7 @@
+ ifeq ($(PLATFORM), windows)
+ OTHER_LDLIBS += wsock32.lib winmm.lib
+ else
+- OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl
++ OTHER_LDLIBS += $(LIBSOCKET) -ldl
+ endif
+
+ #
+--- openjdk.orig/jdk/make/java/net/Makefile
++++ openjdk/jdk/make/java/net/Makefile
+@@ -97,7 +97,7 @@
+ # Will not compile at warning level 3 if warnings are fatal
+ COMPILER_WARNINGS_FATAL=false
+ else
+- OTHER_LDLIBS = $(LIBSOCKET) -lnsl -ldl $(JVMLIB)
++ OTHER_LDLIBS = $(LIBSOCKET) -ldl $(JVMLIB)
+ endif
+ ifeq ($(PLATFORM), linux)
+ OTHER_LDLIBS += -lpthread
+--- openjdk.orig/jdk/make/jpda/transport/socket/Makefile
++++ openjdk/jdk/make/jpda/transport/socket/Makefile
+@@ -42,11 +42,11 @@
+ endif
+
+ ifeq ($(PLATFORM), linux)
+- OTHER_LDLIBS += -lnsl $(LIBSOCKET) -lpthread
++ OTHER_LDLIBS += $(LIBSOCKET) -lpthread
+ endif
+
+ ifeq ($(PLATFORM), solaris)
+- OTHER_LDLIBS += -lnsl $(LIBSOCKET)
++ OTHER_LDLIBS += $(LIBSOCKET)
+ endif
+
+ ifeq ($(PLATFORM), windows)
+--- openjdk.orig/jdk/make/mkdemo/jvmti/hprof/Makefile
++++ openjdk/jdk/make/mkdemo/jvmti/hprof/Makefile
+@@ -39,10 +39,10 @@
+ EXTRA_LIBS += wsock32.lib winmm.lib
+ endif
+ ifeq ($(PLATFORM), solaris)
+- OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl
++ OTHER_LDLIBS += $(LIBSOCKET) -ldl
+ endif
+ ifeq ($(PLATFORM), linux)
+- OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl -lpthread
++ OTHER_LDLIBS += $(LIBSOCKET) -ldl -lpthread
+ endif
+
+ #
diff --git a/user/openjdk7/icedtea-jdk-no-soname.patch b/user/openjdk7/icedtea-jdk-no-soname.patch
new file mode 100644
index 000000000..fe6bbb732
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-no-soname.patch
@@ -0,0 +1,12 @@
+--- ./openjdk/jdk/make/common/Defs-linux.gmk.orig
++++ ./openjdk/jdk/make/common/Defs-linux.gmk
+@@ -248,7 +248,9 @@
+ #
+ LDFLAGS_OPT = -Xlinker -O1
+ LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
++ifdef LIBRARY
+ LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)
++endif
+
+ #
+ # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always
diff --git a/user/openjdk7/icedtea-remove-gawk.patch b/user/openjdk7/icedtea-remove-gawk.patch
new file mode 100644
index 000000000..98e9878b7
--- /dev/null
+++ b/user/openjdk7/icedtea-remove-gawk.patch
@@ -0,0 +1,22 @@
+--- openjdk/corba/make/common/shared/Defs-utils.gmk.old 2018-10-22 05:22:47.000000000 +0000
++++ openjdk/corba/make/common/shared/Defs-utils.gmk 2019-02-27 00:44:26.900000000 +0000
+@@ -182,7 +182,7 @@
+ # others have it in /usr/bin.
+ SORT=$(firstword $(wildcard $(UTILS_COMMAND_PATH)sort) \
+ $(wildcard $(UTILS_USR_BIN_PATH)sort))
+- NAWK = $(USRBIN_PATH)gawk
++ NAWK = $(USRBIN_PATH)mawk
+ # Intrinsic unix command, with backslash-escaped character interpretation
+ ECHO = /bin/echo -e
+ # These are really in UTILS_USR_BIN_PATH on Linux (only sccs is not)
+--- openjdk/jdk/make/common/shared/Defs-utils.gmk.old 2019-02-27 00:40:12.430000000 +0000
++++ openjdk/jdk/make/common/shared/Defs-utils.gmk 2019-02-27 00:43:49.520000000 +0000
+@@ -207,7 +207,7 @@
+ # others have it in /usr/bin.
+ SORT=$(firstword $(wildcard $(UTILS_COMMAND_PATH)sort) \
+ $(wildcard $(UTILS_USR_BIN_PATH)sort))
+- NAWK = $(USRBIN_PATH)gawk
++ NAWK = $(USRBIN_PATH)mawk
+ # Intrinsic unix command, with backslash-escaped character interpretation
+ ECHO = /bin/echo -e
+ # These are really in UTILS_USR_BIN_PATH on Linux
diff --git a/user/openjdk7/icedtea-tar.patch b/user/openjdk7/icedtea-tar.patch
new file mode 100644
index 000000000..98c280184
--- /dev/null
+++ b/user/openjdk7/icedtea-tar.patch
@@ -0,0 +1,22 @@
+--- openjdk/jdk/make/common/shared/Defs-utils.gmk.old 2019-02-27 01:45:10.950000000 +0000
++++ openjdk/jdk/make/common/shared/Defs-utils.gmk 2019-02-27 02:26:55.870000000 +0000
+@@ -150,7 +150,7 @@
+ SHOWREV = $(UTILS_USR_BIN_PATH)showrev
+ SORT = $(UTILS_COMMAND_PATH)sort
+ TAIL = $(UTILS_USR_BIN_PATH)tail
+-TAR = $(UTILS_COMMAND_PATH)tar
++TAR = $(UTILS_USR_BIN_PATH)tar
+ TEST = $(UTILS_USR_BIN_PATH)test
+ TOUCH = $(UTILS_COMMAND_PATH)touch
+ TR = $(UTILS_USR_BIN_PATH)tr
+--- openjdk/corba/make/common/shared/Defs-utils.gmk.old 2019-02-27 02:27:38.910000000 +0000
++++ openjdk/corba/make/common/shared/Defs-utils.gmk 2019-02-27 02:28:00.210000000 +0000
+@@ -129,7 +129,7 @@
+ SORT = $(UTILS_COMMAND_PATH)sort
+ STRIP = $(UTILS_CCS_BIN_PATH)strip
+ TAIL = $(UTILS_USR_BIN_PATH)tail
+-TAR = $(UTILS_COMMAND_PATH)tar
++TAR = $(UTILS_USR_BIN_PATH)tar
+ TEST = $(UTILS_USR_BIN_PATH)test
+ TOUCH = $(UTILS_COMMAND_PATH)touch
+ TR = $(UTILS_USR_BIN_PATH)tr
diff --git a/user/openjdk7/icedtea-xattr.patch b/user/openjdk7/icedtea-xattr.patch
new file mode 100644
index 000000000..51aee48c4
--- /dev/null
+++ b/user/openjdk7/icedtea-xattr.patch
@@ -0,0 +1,11 @@
+--- openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c.old 2018-10-22 05:32:13.000000000 +0000
++++ openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c 2019-02-27 01:37:00.950000000 +0000
+@@ -38,7 +38,7 @@
+
+ #ifdef COMPILE_AGAINST_SYSCALLS
+ #include <sys/types.h>
+-#include <attr/xattr.h>
++#include <sys/xattr.h>
+ #else
+ #include <syscalls_fp.h>
+ #endif
diff --git a/user/openjdk7/remove-gawk.patch b/user/openjdk7/remove-gawk.patch
new file mode 100644
index 000000000..dccddbab9
--- /dev/null
+++ b/user/openjdk7/remove-gawk.patch
@@ -0,0 +1,125 @@
+--- icedtea-2.6.16/configure.old 2019-01-01 20:11:07.846602426 +0000
++++ icedtea-2.6.16/configure 2019-02-27 00:23:41.230000000 +0000
+@@ -6881,108 +6881,7 @@
+ LDD="$ac_cv_prog_LDD"
+ fi
+
+-if test -n "$ac_tool_prefix"; then
+- # Extract the first word of "${ac_tool_prefix}gawk", so it can be a program name with args.
+-set dummy ${ac_tool_prefix}gawk; ac_word=$2
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+-$as_echo_n "checking for $ac_word... " >&6; }
+-if ${ac_cv_path_GAWK+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- case $GAWK in
+- [\\/]* | ?:[\\/]*)
+- ac_cv_path_GAWK="$GAWK" # Let the user override the test with a path.
+- ;;
+- *)
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+- ac_cv_path_GAWK="$as_dir/$ac_word$ac_exec_ext"
+- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+- break 2
+- fi
+-done
+- done
+-IFS=$as_save_IFS
+-
+- ;;
+-esac
+-fi
+-GAWK=$ac_cv_path_GAWK
+-if test -n "$GAWK"; then
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GAWK" >&5
+-$as_echo "$GAWK" >&6; }
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-fi
+-
+-
+-fi
+-if test -z "$ac_cv_path_GAWK"; then
+- ac_pt_GAWK=$GAWK
+- # Extract the first word of "gawk", so it can be a program name with args.
+-set dummy gawk; ac_word=$2
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+-$as_echo_n "checking for $ac_word... " >&6; }
+-if ${ac_cv_path_ac_pt_GAWK+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- case $ac_pt_GAWK in
+- [\\/]* | ?:[\\/]*)
+- ac_cv_path_ac_pt_GAWK="$ac_pt_GAWK" # Let the user override the test with a path.
+- ;;
+- *)
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+- ac_cv_path_ac_pt_GAWK="$as_dir/$ac_word$ac_exec_ext"
+- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+- break 2
+- fi
+-done
+- done
+-IFS=$as_save_IFS
+-
+- ;;
+-esac
+-fi
+-ac_pt_GAWK=$ac_cv_path_ac_pt_GAWK
+-if test -n "$ac_pt_GAWK"; then
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_GAWK" >&5
+-$as_echo "$ac_pt_GAWK" >&6; }
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-fi
+-
+- if test "x$ac_pt_GAWK" = x; then
+- GAWK=""
+- else
+- case $cross_compiling:$ac_tool_warned in
+-yes:)
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+-ac_tool_warned=yes ;;
+-esac
+- GAWK=$ac_pt_GAWK
+- fi
+-else
+- GAWK="$ac_cv_path_GAWK"
+-fi
+-
+- if test x"$GAWK" = x ; then
+- as_fn_error $? "The following program was not found on the PATH: gawk" "$LINENO" 5
+- fi
+-
++GAWK="$AWK"
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args.
+--- icedtea-2.6.16/configure.ac.old 2019-01-01 20:09:39.139994680 +0000
++++ icedtea-2.6.16/configure.ac 2019-02-27 00:25:01.960000000 +0000
+@@ -39,9 +39,7 @@
+ IT_FIND_TOOLS([FASTJAR], [fastjar jar])
+ IT_FIND_TOOLS([SED],[gsed sed])
+ AC_CHECK_TOOL([LDD], [ldd])
+-dnl OpenJDK's README-builds.html lists gawk as a build dependency so we
+-dnl check for it explicitly rather than using AC_PROG_AWK.
+-IT_FIND_TOOL([GAWK], [gawk])
++IT_FIND_TOOL([GAWK], [awk])
+ IT_FIND_TOOL([PERL], [perl])
+ IT_CHECK_FOR_MERCURIAL
+ IT_OBTAIN_HG_REVISIONS
diff --git a/user/openjdk7/xattr.patch b/user/openjdk7/xattr.patch
new file mode 100644
index 000000000..258f9f12d
--- /dev/null
+++ b/user/openjdk7/xattr.patch
@@ -0,0 +1,11 @@
+--- icedtea-2.6.16/acinclude.m4.old 2019-01-01 20:09:39.127994868 +0000
++++ icedtea-2.6.16/acinclude.m4 2019-02-27 00:35:33.320000000 +0000
+@@ -2271,7 +2271,7 @@
+ dnl Check for syscalls
+ AC_CHECK_FUNCS([openat64 fstatat64 fgetxattr fsetxattr fremovexattr flistxattr unlinkat renameat futimesat fdopendir epoll_create epoll_ctl epoll_wait],,
+ [AC_MSG_ERROR([Could not find required syscalls; check config.log and use --disable-compile-against-syscalls if necessary.])])
+- AC_CHECK_HEADERS([sys/epoll.h attr/xattr.h],
++ AC_CHECK_HEADERS([sys/epoll.h sys/xattr.h],
+ , [AC_MSG_ERROR([Could not find required system headers; install the appropriate files from glibc-headers, libc6-dev and/or libattr-devel, libattr1-dev or use --disable-compile-against-syscalls if necessary.])])
+ ENABLE_SYSCALL_COMPILATION=true
+ fi