aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Ammann <trilean@users.noreply.github.com>2016-03-18 18:06:22 +0100
committerAnthony G. Basile <blueness@gentoo.org>2016-03-18 13:18:05 -0400
commitd9d48f14bfb9b3ec9eae53e6d34e44598adb32b4 (patch)
tree08dff6b58d62218f05b56f38e931c016af17bdcf /dev-java
parentwww-client/firefox: use EAPI=5 on musl for now, see bug #571444 (diff)
downloadmusl-d9d48f14bfb9b3ec9eae53e6d34e44598adb32b4.tar.gz
musl-d9d48f14bfb9b3ec9eae53e6d34e44598adb32b4.tar.bz2
musl-d9d48f14bfb9b3ec9eae53e6d34e44598adb32b4.zip
dev-java/jamvm: fix build on musl
Diffstat (limited to 'dev-java')
-rw-r--r--dev-java/jamvm/Manifest7
-rw-r--r--dev-java/jamvm/files/jamvm-2.0.0-classes-location.patch27
-rw-r--r--dev-java/jamvm/files/jamvm-2.0.0-env.file16
-rw-r--r--dev-java/jamvm/files/jamvm-2.0.0-javac.in57
-rw-r--r--dev-java/jamvm/files/jamvm-2.0.0-musl.patch62
-rw-r--r--dev-java/jamvm/files/jamvm-2.0.0-noexecstack.patch48
-rw-r--r--dev-java/jamvm/jamvm-2.0.0-r99.ebuild133
7 files changed, 350 insertions, 0 deletions
diff --git a/dev-java/jamvm/Manifest b/dev-java/jamvm/Manifest
new file mode 100644
index 0000000..7502f4a
--- /dev/null
+++ b/dev-java/jamvm/Manifest
@@ -0,0 +1,7 @@
+AUX jamvm-2.0.0-classes-location.patch 1276 SHA256 98ecad3eeb0623b3dc01155c9cbd9aacf31e5d5854b183a7be11b64bfdd838a6 SHA512 c399cb8ebce0556a778a1511fec43eeedc2e8d4b1ca732ebd201faf49d6a607baef914fb54e34f2c5b494ace6f5c072d296fb30c65038461e97a518c9e1924bd WHIRLPOOL 91d9c75a260f6f5943d1221bfba77032fc1ce1f8d85217ec4a80aa50b826f36816aa4fe0e1a2ae7cb27c171ec029d8ee3ad512a506c1d31e02276a02b1858e42
+AUX jamvm-2.0.0-env.file 551 SHA256 27bda0e9663dba5ca099d2f26234d3fde1a14f1897edce65c2c421d15ad6dca9 SHA512 7d3aaf511d798bd9e9a56cce2b1e476b364f392e8b5062642054b335110d25a6e1e4e484e74743ffc945b29f92d31991942e3b06762232c3e7e624d7151655c2 WHIRLPOOL 9c71959c4be6c8d13110f0a18964ee5804e1a803cba82af71f8ac74924b2aa7651df5fc19fcb6301ea606ea85f461a471dbfbc5c4f0de1d4b7616933600523cc
+AUX jamvm-2.0.0-javac.in 1739 SHA256 3bb23cff0a6e5a7a820e19cce4b9b0f51a7b84ee9e0eeb048b463a5f3e996db0 SHA512 65170b747012e114b072cd28a688089cdf2f54ddd151ba0cea92241b9b75fd0c7c410bfa4186cf9d233af4328bf962e13e8838a0cc09a1fbf2c28d29b13e36cb WHIRLPOOL 2237edd6abffdfb762d178e611768396f0b93a38f8a70f83c986049b60e26bb7084e3a38b70ed29c09df739091cdbfbfdd688e5eccee6ca4ea4006c23cf2b7d8
+AUX jamvm-2.0.0-musl.patch 1733 SHA256 76fe550d2f376a29dd0a740adc3f9b5f6aa6ec2c16e1c843a83764d3ba4e2375 SHA512 d6a1f87f4546d9a9849672d970d401472d6c79a1fa87b193728df4c2ad6e9a1f3f1f4f48de045472e1288dea1b0a79c4fa016c99819b0f6e45f63cd3ead62747 WHIRLPOOL 50418776aa49dc52fa9c1c71de569613d70558156595dd4266a3a0ee843a2300d010eca10a0574e4c98444bb3b55b86fbae93ac4c54e3d391907bd36e1a908a1
+AUX jamvm-2.0.0-noexecstack.patch 1387 SHA256 6a6028e55532ba3debf1f170790cc609b0bbd0cfe7fd7b5a14f4513e6b46873b SHA512 17c38ad0017e5659295dea7ed57f263eb0eee673bbc1f5d1e44e0c8fe588f4172a8a05c832a1fd41f3dc094779fade66aa710c8ce48c754412b0b6afdea6551a WHIRLPOOL e06573fa48c98c29ae1f53ce19b511f21ee594d32c840a4649d3a6df7754e594e729551429610c4d04d5dc97aa42678a35e68fb17709125e60ae2c53c51c9fd4
+DIST jamvm-2.0.0.tar.gz 741459 SHA256 76428e96df0ae9dd964c7a7c74c1e9a837e2f312c39e9a357fa8178f7eff80da SHA512 8ac27787ee94fa8fde962635d3c08d1dc1e5244c9d56bb693e73f3fd9b58e944ad3f7a0127afeed727d7c00d904a775d2c483157f5ac87e7eab6ecade1aad21d WHIRLPOOL 7e80be683fafb444cd417502b96089ce4f6879a049ca49e33691b4d5d6755814654ab4ed7626b666dd48f9d6101567b2a12de43b916055ea1d067c5d4df06443
+EBUILD jamvm-2.0.0-r99.ebuild 3781 SHA256 9bd66bb52decce0eaff3f6d55dfd6e4d837a56910e3260a6c4c6dc83f5d9aef9 SHA512 ffa2dd87f16b2afb83f87af635ec1833a1eb15b9bb252f625520a387fae799fbe44fff30fcb8bf4cc63f8b15f337cc6132244bb8a3de03a5a4b79e839c2338e4 WHIRLPOOL 076c52c6c6b0f86e17f8525689f17921a096f46c7b065e560128e90558fe4b03b9e06b12ed22bec01b309de2b07f1be832a2305a2632cd62e69fc5852f794274
diff --git a/dev-java/jamvm/files/jamvm-2.0.0-classes-location.patch b/dev-java/jamvm/files/jamvm-2.0.0-classes-location.patch
new file mode 100644
index 0000000..6cf7611
--- /dev/null
+++ b/dev-java/jamvm/files/jamvm-2.0.0-classes-location.patch
@@ -0,0 +1,27 @@
+diff -Nru jamvm-2.0.0.old/configure.ac jamvm-2.0.0/configure.ac
+--- jamvm-2.0.0.old/configure.ac 2014-06-10 21:33:37.000000000 +0100
++++ jamvm-2.0.0/configure.ac 2014-11-28 19:22:12.183091414 +0000
+@@ -236,6 +236,7 @@
+ install_dir=$prefix
+ fi
+ AC_DEFINE_UNQUOTED(INSTALL_DIR, "$install_dir", [Installation directory (prefix)])
++AC_DEFINE_UNQUOTED(PKGDATADIR, "$datadir/$PACKAGE", [Package data directory (pkgdatadir)])
+
+ AC_ARG_ENABLE(zip,
+ [AS_HELP_STRING(--disable-zip,turn-off zip support in the bootstrap loader)],,)
+diff -Nru jamvm-2.0.0.old/src/classlib/gnuclasspath/class.c jamvm-2.0.0/src/classlib/gnuclasspath/class.c
+--- jamvm-2.0.0.old/src/classlib/gnuclasspath/class.c 2012-05-17 22:01:47.000000000 +0100
++++ jamvm-2.0.0/src/classlib/gnuclasspath/class.c 2014-11-28 19:23:27.312108240 +0000
+@@ -110,10 +110,10 @@
+ separate class files in a directory structure */
+
+ #ifdef USE_ZIP
+-#define JAMVM_CLASSES INSTALL_DIR"/share/jamvm/classes.zip"
++#define JAMVM_CLASSES PKGDATADIR"/classes.zip"
+ #define CLASSPATH_CLASSES CLASSPATH_INSTALL_DIR"/share/classpath/glibj.zip"
+ #else
+-#define JAMVM_CLASSES INSTALL_DIR"/share/jamvm/classes"
++#define JAMVM_CLASSES PKGDATADIR"/classes"
+ #define CLASSPATH_CLASSES CLASSPATH_INSTALL_DIR"/share/classpath"
+ #endif
+
diff --git a/dev-java/jamvm/files/jamvm-2.0.0-env.file b/dev-java/jamvm/files/jamvm-2.0.0-env.file
new file mode 100644
index 0000000..5eee6a9
--- /dev/null
+++ b/dev-java/jamvm/files/jamvm-2.0.0-env.file
@@ -0,0 +1,16 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+VERSION="JamVM JDK @PV@"
+JAVA_HOME="@GENTOO_PORTAGE_EPREFIX@/usr/@LIBDIR@/@PN@-jdk"
+JDK_HOME="@GENTOO_PORTAGE_EPREFIX@/usr/@LIBDIR@/@PN@-jdk"
+BOOTCLASSPATH="@GENTOO_PORTAGE_EPREFIX@/usr/@LIBDIR@/@PN@/classes.zip:${JAVA_HOME}/lib/rt.jar"
+JAVAC="${JAVA_HOME}/bin/javac"
+PATH="${JAVA_HOME}/bin"
+ROOTPATH="${JAVA_HOME}/bin"
+PROVIDES_TYPE="JRE"
+PROVIDES_VERSION="1.5"
+GENERATION="2"
+ENV_VARS="JAVA_HOME JAVAC PATH"
+LDPATH="${JAVA_HOME}/lib"
diff --git a/dev-java/jamvm/files/jamvm-2.0.0-javac.in b/dev-java/jamvm/files/jamvm-2.0.0-javac.in
new file mode 100644
index 0000000..8eeda68
--- /dev/null
+++ b/dev-java/jamvm/files/jamvm-2.0.0-javac.in
@@ -0,0 +1,57 @@
+#!/usr/bin/perl -w
+use strict;
+use constant NO_DUP_ARGS => qw(-source -target -d -encoding);
+use constant STRIP_ARGS => qw(-Werror -implicit:none -J-Xbootclasspath/p:);
+
+my $ECJ_WARNINGS="-nowarn";
+
+my ( @bcoption, @source15, @target15, @cp );
+push @bcoption, '-bootclasspath', '@RT_JAR@:@TOOLS_JAR@'
+ unless grep {$_ eq '-bootclasspath'} @ARGV;
+push @source15, '-source', '1.5'
+ unless grep {$_ eq '-source'} @ARGV;
+push @target15, '-target', '1.5'
+ unless grep {$_ eq '-target'} @ARGV;
+push @cp, '-cp', '.'
+ unless grep {$_ =~ '\-c(p|lasspath)'} @ARGV or $ENV{CLASSPATH};
+my @ecj_parms = ($ECJ_WARNINGS, @bcoption, @source15, @target15, @cp);
+
+# Work around ecj's inability to handle duplicate command-line
+# options and unknown javac options.
+sub gen_ecj_opts
+{
+ my @new_args = @{$_[0]};
+
+ for my $opt (NO_DUP_ARGS)
+ {
+ my @indices = reverse grep {$new_args[$_] eq $opt} 0..$#new_args;
+ if (@indices > 1) {
+ shift @indices; # keep last instance only
+ splice @new_args, $_, 2 for @indices;
+ }
+ }
+
+ for my $opt (STRIP_ARGS)
+ {
+ my @indices = reverse grep {$new_args[$_] eq $opt} 0..$#new_args;
+ splice @new_args, $_, 1 for @indices;
+ }
+
+ return \@new_args;
+}
+
+sub split_vm_args
+{
+ my @new_args = @{$_[0]};
+
+ my @vm_args = map { substr $_, 2 } grep $_ =~ /^-J/, @new_args;
+ my @javac_args = grep $_ !~ /^-J/, @new_args;
+
+ return (\@vm_args, \@javac_args);
+}
+
+my ($vm_args, $javac_args) = split_vm_args (gen_ecj_opts( \@ARGV ));
+my @CLASSPATH = ('@ECJ_JAR@');
+push @CLASSPATH, split /:/, $ENV{"CLASSPATH"} if exists $ENV{"CLASSPATH"};
+$ENV{"CLASSPATH"} = join ':', @CLASSPATH;
+exec '@JAVA@', @$vm_args, 'org.eclipse.jdt.internal.compiler.batch.Main', @ecj_parms, @$javac_args;
diff --git a/dev-java/jamvm/files/jamvm-2.0.0-musl.patch b/dev-java/jamvm/files/jamvm-2.0.0-musl.patch
new file mode 100644
index 0000000..6872a6e
--- /dev/null
+++ b/dev-java/jamvm/files/jamvm-2.0.0-musl.patch
@@ -0,0 +1,62 @@
+diff -rupN a/src/os/linux/i386/init.c b/src/os/linux/i386/init.c
+--- a/src/os/linux/i386/init.c 2012-05-17 21:01:47.000000000 +0000
++++ b/src/os/linux/i386/init.c 2016-03-18 16:41:12.578719722 +0000
+@@ -19,18 +19,18 @@
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+-#include <fpu_control.h>
++#include <fenv.h>
+
+ /* Change floating point precision to double (64-bit) from
+ * the extended (80-bit) Linux default. */
+
+ void setDoublePrecision() {
+- fpu_control_t cw;
++ fenv_t fenv;
+
+- _FPU_GETCW(cw);
+- cw &= ~_FPU_EXTENDED;
+- cw |= _FPU_DOUBLE;
+- _FPU_SETCW(cw);
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /* _FPU_DOUBLE */
++ fesetenv(&fenv);
+ }
+
+ void initialisePlatform() {
+diff -rupN a/src/os/linux/x86_64/init.c b/src/os/linux/x86_64/init.c
+--- a/src/os/linux/x86_64/init.c 2012-05-17 21:01:47.000000000 +0000
++++ b/src/os/linux/x86_64/init.c 2016-03-18 16:42:41.498722575 +0000
+@@ -19,9 +19,7 @@
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+-#ifdef __linux__
+-#include <fpu_control.h>
+-#endif
++#include <fenv.h>
+
+ /* Change the x87 FPU precision to double (64-bit) from the extended
+ (80-bit) Linux default. Note, unlike on i386, my testcases pass
+@@ -30,14 +28,12 @@
+ */
+
+ void setDoublePrecision() {
+-#ifdef __linux__
+- fpu_control_t cw;
++ fenv_t fenv;
+
+- _FPU_GETCW(cw);
+- cw &= ~_FPU_EXTENDED;
+- cw |= _FPU_DOUBLE;
+- _FPU_SETCW(cw);
+-#endif
++ fegetenv(&fenv);
++ fenv.__control_word &= ~0x300; /*_FPU_EXTENDED */
++ fenv.__control_word |= 0x200; /*_FPU_DOUBLE */
++ fesetenv(&fenv);
+ }
+
+ void initialisePlatform() {
diff --git a/dev-java/jamvm/files/jamvm-2.0.0-noexecstack.patch b/dev-java/jamvm/files/jamvm-2.0.0-noexecstack.patch
new file mode 100644
index 0000000..2a0f14c
--- /dev/null
+++ b/dev-java/jamvm/files/jamvm-2.0.0-noexecstack.patch
@@ -0,0 +1,48 @@
+diff --git a/src/os/linux/arm/callNative.S b/src/os/linux/arm/callNative.S
+index 245afd1..1583023 100644
+--- a/src/os/linux/arm/callNative.S
++++ b/src/os/linux/arm/callNative.S
+@@ -36,3 +36,7 @@
+ #include "callNativeOABI.S"
+ #endif
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+diff --git a/src/os/linux/mips/callNative.S b/src/os/linux/mips/callNative.S
+index cede343..90d9163 100644
+--- a/src/os/linux/mips/callNative.S
++++ b/src/os/linux/mips/callNative.S
+@@ -184,3 +184,7 @@ return:
+ j $31
+ .end callJNIMethod
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+diff --git a/src/os/linux/powerpc/callNative.S b/src/os/linux/powerpc/callNative.S
+index aa47f6a..763dc0a 100644
+--- a/src/os/linux/powerpc/callNative.S
++++ b/src/os/linux/powerpc/callNative.S
+@@ -281,3 +281,7 @@ return:
+ mr 1,11
+ blr
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+diff --git a/src/os/linux/x86_64/callNative.S b/src/os/linux/x86_64/callNative.S
+index 26404e6..9fb5cdf 100644
+--- a/src/os/linux/x86_64/callNative.S
++++ b/src/os/linux/x86_64/callNative.S
+@@ -267,3 +267,7 @@ float_ret:
+ addq $8, %rcx
+ jmp return
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
diff --git a/dev-java/jamvm/jamvm-2.0.0-r99.ebuild b/dev-java/jamvm/jamvm-2.0.0-r99.ebuild
new file mode 100644
index 0000000..af734a6
--- /dev/null
+++ b/dev-java/jamvm/jamvm-2.0.0-r99.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic multilib java-vm-2 autotools
+
+DESCRIPTION="An extremely small and specification-compliant virtual machine"
+HOMEPAGE="http://jamvm.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="debug libffi"
+
+DEPEND="dev-java/gnu-classpath:0.98
+ || ( dev-java/eclipse-ecj:* dev-java/ecj-gcj:* )
+ libffi? ( virtual/libffi )
+ ppc64? ( virtual/libffi )
+ sparc? ( virtual/libffi )"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/"${P}-classes-location.patch"
+ "${FILESDIR}"/"${P}-noexecstack.patch"
+)
+
+src_prepare() {
+ # without this patch, classes.zip is not found at runtime
+ epatch "${PATCHES[@]}"
+
+ if use elibc_musl ; then
+ epatch "${FILESDIR}"/"${P}-musl.patch"
+ fi
+
+ eautoreconf
+
+ # These come precompiled.
+ # configure script uses detects the compiler
+ # from PATH. I guess we should compile this from source.
+ # Then just make sure not to hit
+ # https://bugs.gentoo.org/show_bug.cgi?id=163801
+ #
+ #rm -v lib/classes.zip || die
+}
+
+src_configure() {
+ filter-flags "-fomit-frame-pointer"
+
+ if use ppc64 || use sparc || use libffi; then
+ append-cflags "$(pkg-config --cflags-only-I libffi)"
+ fi
+
+ local fficonf="--enable-ffi"
+ if { ! use ppc64 && ! use sparc; }; then
+ fficonf="$(use_enable libffi ffi)"
+ fi
+
+ econf ${fficonf} \
+ --disable-dependency-tracking \
+ $(use_enable debug trace) \
+ --libdir="${EPREFIX}"/usr/$(get_libdir)/${PN} \
+ --includedir="${EPREFIX}"/usr/include/${PN} \
+ --with-classpath-install-dir=/usr
+}
+
+create_launcher() {
+ local script="${D}/${INSTALL_DIR}/bin/${1}"
+ cat > "${script}" <<-EOF
+ #!/bin/sh
+ exec /usr/bin/jamvm \
+ -Xbootclasspath/p:/usr/share/classpath/tools.zip" \
+ gnu.classpath.tools.${1}.Main "\$@"
+ EOF
+ chmod +x "${script}" || die
+}
+
+src_install() {
+ local libdir=$(get_libdir)
+ local CLASSPATH_DIR=/usr/libexec/gnu-classpath-0.98
+ local JDK_DIR=/usr/${libdir}/${PN}-jdk
+
+ emake DESTDIR="${D}" install
+
+ dodoc ACKNOWLEDGEMENTS AUTHORS ChangeLog NEWS README
+
+ set_java_env "${FILESDIR}/${P}-env.file"
+
+ dodir ${JDK_DIR}/bin
+ dosym /usr/bin/jamvm ${JDK_DIR}/bin/java
+ for files in ${CLASSPATH_DIR}/g*; do
+ if [ $files = "${CLASSPATH_DIR}/bin/gjdoc" ] ; then
+ dosym $files ${JDK_DIR}/bin/javadoc || die
+ else
+ dosym $files \
+ ${JDK_DIR}/bin/$(echo $files|sed "s#$(dirname $files)/g##") || die
+ fi
+ done
+
+ dodir ${JDK_DIR}/jre/lib
+ dosym /usr/share/classpath/glibj.zip ${JDK_DIR}/jre/lib/rt.jar
+ dodir ${JDK_DIR}/lib
+ dosym /usr/share/classpath/tools.zip ${JDK_DIR}/lib/tools.jar
+
+ local ecj_jar="$(readlink "${EPREFIX}"/usr/share/eclipse-ecj/ecj.jar)"
+ exeinto ${JDK_DIR}/bin
+ sed -e "s#@JAVA@#/usr/bin/jamvm#" \
+ -e "s#@ECJ_JAR@#${ecj_jar}#" \
+ -e "s#@RT_JAR@#/usr/share/classpath/glibj.zip#" \
+ -e "s#@TOOLS_JAR@#/usr/share/classpath/tools.zip#" \
+ "${FILESDIR}"/"${P}-javac.in" | newexe - javac
+
+ local libarch="${ARCH}"
+ [ ${ARCH} == x86 ] && libarch="i386"
+ [ ${ARCH} == x86_64 ] && libarch="amd64"
+ dodir ${JDK_DIR}/jre/lib/${libarch}/client
+ dodir ${JDK_DIR}/jre/lib/${libarch}/server
+ dosym /usr/${libdir}/${PN}/libjvm.so ${JDK_DIR}/jre/lib/${libarch}/client/libjvm.so
+ dosym /usr/${libdir}/${PN}/libjvm.so ${JDK_DIR}/jre/lib/${libarch}/server/libjvm.so
+ dosym /usr/${libdir}/classpath/libjawt.so ${JDK_DIR}/jre/lib/${libarch}/libjawt.so
+
+ # Can't use java-vm_set-pax-markings as doesn't work with symbolic links
+ # Ensure a PaX header is created.
+ local pax_markings="C"
+ # Usally disabeling MPROTECT is sufficent.
+ local pax_markings+="m"
+ # On x86 for heap sizes over 700MB disable SEGMEXEC and PAGEEXEC as well.
+ use x86 && pax_markings+="sp"
+
+ pax-mark ${pax_markings} "${ED}"/usr/bin/jamvm
+}