Skip to content

Commit

Permalink
dev-lang/nqp: revbump nqp-2016.04-r1
Browse files Browse the repository at this point in the history
- update ebuild to reflect the build-system
  - inherit java-pkg-2.eclass
  - enable choice between gcc (default) and clang (use clang)
  - make MoarVM default backend (use +moar java)
  - enable optional use of system-provided jars (use +system-libs)
  - enable testing (use test)
- update to EAPI6
- add tomboy64 as secondary maintainer

Package-Manager: portage-2.2.28
  • Loading branch information
Marshall Brewer (Gentoo Key) authored and Amynka committed May 8, 2016
1 parent 19c2e3b commit 2c293c6
Show file tree
Hide file tree
Showing 3 changed files with 313 additions and 0 deletions.
214 changes: 214 additions & 0 deletions dev-lang/nqp/files/enable-external-jars.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
diff --git a/Configure.pl b/Configure.pl
index 2064ac8..73e2d27 100755
--- a/Configure.pl
+++ b/Configure.pl
@@ -34,6 +34,7 @@ MAIN: {
'no-clean',
'with-parrot=s', 'gen-parrot:s', 'parrot-config=s', 'parrot-option=s@',
'with-moar=s', 'gen-moar:s', 'moar-option=s@',
+ 'with-asm=s', 'with-asm-tree=s', 'with-jline=s', 'with-jna=s',
'make-install!', 'makefile-timing!',
'git-protocol=s',
'git-depth=s', 'git-reference=s',);
@@ -50,6 +51,53 @@ MAIN: {
"Use --prefix to specify a directory in which parrot is installed.";
}

+ if ($options{'with-asm'}) {
+ if ($options{'with-asm'} ne '-') {
+ $config{'asm'} = $options{'with-asm'};
+ }
+ } else {
+ $config{'asm'} = "3rdparty/asm/asm-4.1.jar";
+ }
+ if ($options{'with-asm-tree'}) {
+ if ($options{'with-asm-tree'} ne '-') {
+ $config{'asmtree'} = $options{'with-asm-tree'};
+ }
+ } else {
+ $config{'asmtree'} = "3rdparty/asm/asm-tree-4.1.jar";
+ }
+ if ($options{'with-jline'}) {
+ if ($options{'with-jline'} ne '-') {
+ $config{'jline'} = $options{'with-jline'};
+ }
+ } else {
+ $config{'jline'} = "3rdparty/jline/jline-1.0.jar";
+ }
+ if ($options{'with-jna'}) {
+ if ($options{'with-jna'} ne '-') {
+ $config{'jna'} = $options{'with-jna'};
+ }
+ } else {
+ $config{'jna'} = "3rdparty/jna/jna.jar";
+ }
+
+ if ($^O eq 'MSWin32') {
+ $config{'asmfile'} = $config{'asm'};
+ $config{'asmfile'} =~ s/.*\\//;
+ $config{'jlinefile'} = $config{'jline'};
+ $config{'jlinefile'} =~ s/.*\\//;
+ } else {
+ $config{'asmfile'} = $config{'asm'};
+ $config{'asmfile'} =~ s/.*\///;
+ $config{'jlinefile'} = $config{'jline'};
+ $config{'jlinefile'} =~ s/.*\///;
+ }
+
+ fill_template_file(
+ 'tools/build/install-jvm-runner.pl.in',
+ 'tools/build/install-jvm-runner.pl',
+ %config,
+ );
+
my $default_backend;
my @backends;
my %backends;
@@ -357,6 +405,11 @@ General Options:
--gen-moar Download and build a copy of MoarVM to use
--moar-option='--option=value'
Options to pass to MoarVM configuration for --gen-moar
+ --with-asm='/path/to/jar'
+ --with-asm-tree='/path/to/jar'
+ --with-jline='/path/to/jar'
+ --with-jna='/path/to/jar'
+ Provide paths to already installed jars
--git-protocol={ssh,https,git}
Protocol to use for git clone. Default: https
--make-install Immediately run `MAKE install` after configuring
diff --git a/tools/build/Makefile-JVM.in b/tools/build/Makefile-JVM.in
index 27959ad..c19965a 100644
--- a/tools/build/Makefile-JVM.in
+++ b/tools/build/Makefile-JVM.in
@@ -2,7 +2,6 @@ BAT = @bat@
JAVA = java
JAVAC = javac
JAR = jar
-ASM = 3rdparty/asm/
J_RUNNER = nqp-j$(BAT)

NQP_JAR_DIR = $(NQP_LANG_DIR)/runtime
@@ -18,7 +17,11 @@ RUNTIME_JAVAS = \

RUNTIME_JAR = nqp-runtime.jar

-THIRDPARTY_JARS = $(ASM)asm-4.1.jar@cpsep@$(ASM)asm-tree-4.1.jar@cpsep@3rdparty/jline/jline-1.0.jar@cpsep@3rdparty/jna/jna.jar
+ASM = @asm@
+ASMTREE = @asmtree@
+JLINE = @jline@
+JNA = @jna@
+THIRDPARTY_JARS = $(ASM)@cpsep@$(ASMTREE)@cpsep@$(JLINE)@cpsep@$(JNA)
J_STAGE0 = src/vm/jvm/stage0
J_STAGE1 = $(JVM_BUILD_DIR)/stage1
J_STAGE2 = $(JVM_BUILD_DIR)/stage2
@@ -80,8 +83,8 @@ j-install: j-all
$(MKPATH) $(DESTDIR)$(BIN_DIR)
$(MKPATH) $(DESTDIR)$(NQP_JAR_DIR)
$(MKPATH) $(DESTDIR)$(NQP_LIB_DIR)
- $(CP) 3rdparty/asm/asm-4.1.jar 3rdparty/asm/asm-tree-4.1.jar $(DESTDIR)$(NQP_JAR_DIR)
- $(CP) 3rdparty/jline/jline-1.0.jar 3rdparty/jna/jna.jar $(DESTDIR)$(NQP_JAR_DIR)
+ $(CP) $(ASM) $(ASMTREE) $(DESTDIR)$(NQP_JAR_DIR)
+ $(CP) $(JLINE) $(JNA) $(DESTDIR)$(NQP_JAR_DIR)
$(CP) $(RUNTIME_JAR) $(DESTDIR)$(NQP_JAR_DIR)
$(CP) $(NQP_MO_JAR) $(MODULE_LOADER_JAR) $(DESTDIR)$(NQP_LIB_DIR)
$(CP) $(CORE_SETTING_JAR) $(QASTNODE_JAR) $(QREGEX_JAR) $(DESTDIR)$(NQP_LIB_DIR)
diff --git a/tools/build/install-jvm-runner.pl b/tools/build/install-jvm-runner.pl
deleted file mode 100644
index 14541d6..0000000
--- a/tools/build/install-jvm-runner.pl
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/perl
-# Copyright (C) 2013, The Perl Foundation.
-
-use strict;
-use warnings;
-use 5.008;
-use File::Spec;
-
-my ($destdir, $prefix) = @ARGV;
-my $realpath = $destdir.$prefix;
-
-unless (File::Spec->file_name_is_absolute($prefix)) {
- $prefix = File::Spec->rel2abs($prefix);
-}
-
-if ($^O eq 'MSWin32') {
- my $jar_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'runtime');
- my $lib_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'lib');
- my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j.bat');
-
- open my $fh, ">", $install_to
- or die "Could not open $install_to: $!";
- print $fh '@java -Xss1m -Xmx512m -Xbootclasspath/a:' . $jar_dir . '\\nqp-runtime.jar;' .
- "$jar_dir\\asm-4.1.jar;$jar_dir\\jline-1.0.jar;$lib_dir\\nqp.jar -cp $lib_dir nqp %*\n";
- close $fh
- or die "Could not close $install_to: $!";
-}
-else {
- my $nqp_dir = File::Spec->catfile($prefix, qw/share nqp/);
- my $jar_dir = File::Spec->catfile('${NQP_DIR}', 'runtime');
- my $lib_dir = File::Spec->catfile('${NQP_DIR}', 'lib');
- my $jars = "$jar_dir/nqp-runtime.jar:$jar_dir/asm-4.1.jar:$jar_dir/jline-1.0.jar:$lib_dir/nqp.jar";
- my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j');
-
- open my $fh, ">", $install_to
- or die "Could not open $install_to: $!";
- print $fh "#!/bin/sh\n";
- print $fh ": \${NQP_DIR:=\"$nqp_dir\"}\n";
- print $fh ": \${NQP_JARS:=\"$jars\"}\n";
- print $fh "exec java -Xss1m -Xmx512m -Xbootclasspath/a:\${NQP_JARS} -cp $lib_dir nqp \"\$\@\"\n";
- close $fh
- or die "Could not close $install_to: $!";
- chmod 0755, $install_to;
-}
diff --git a/tools/build/install-jvm-runner.pl.in b/tools/build/install-jvm-runner.pl.in
new file mode 100644
index 0000000..92a1109
--- /dev/null
+++ b/tools/build/install-jvm-runner.pl.in
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+# Copyright (C) 2013, The Perl Foundation.
+
+use strict;
+use warnings;
+use 5.008;
+use File::Spec;
+
+my ($destdir, $prefix) = @ARGV;
+my $realpath = $destdir.$prefix;
+
+unless (File::Spec->file_name_is_absolute($prefix)) {
+ $prefix = File::Spec->rel2abs($prefix);
+}
+
+if ($^O eq 'MSWin32') {
+ my $jar_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'runtime');
+ my $lib_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'lib');
+ my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j.bat');
+
+ open my $fh, ">", $install_to
+ or die "Could not open $install_to: $!";
+ print $fh '@java -Xss1m -Xmx512m -Xbootclasspath/a:' . $jar_dir . '\\nqp-runtime.jar;' .
+ "$jar_dir\\@asmfile@;$jar_dir\\@jlinefile@;$lib_dir\\nqp.jar -cp $lib_dir nqp %*\n";
+ close $fh
+ or die "Could not close $install_to: $!";
+}
+else {
+ my $nqp_dir = File::Spec->catfile($prefix, qw/share nqp/);
+ my $jar_dir = File::Spec->catfile('${NQP_DIR}', 'runtime');
+ my $lib_dir = File::Spec->catfile('${NQP_DIR}', 'lib');
+ my $jars = "$jar_dir/nqp-runtime.jar:$jar_dir/@asmfile@:$jar_dir/@jlinefile@:$lib_dir/nqp.jar";
+ my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j');
+
+ open my $fh, ">", $install_to
+ or die "Could not open $install_to: $!";
+ print $fh "#!/bin/sh\n";
+ print $fh ": \${NQP_DIR:=\"$nqp_dir\"}\n";
+ print $fh ": \${NQP_JARS:=\"$jars\"}\n";
+ print $fh "exec java -Xss1m -Xmx512m -Xbootclasspath/a:\${NQP_JARS} -cp $lib_dir nqp \"\$\@\"\n";
+ close $fh
+ or die "Could not close $install_to: $!";
+ chmod 0755, $install_to;
+}
6 changes: 6 additions & 0 deletions dev-lang/nqp/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@
<email>[email protected]</email>
<name>Patrick Lauer</name>
</maintainer>
<maintainer type="person">
<email>[email protected]</email>
<name>Matthew Brewer</name>
</maintainer>
<maintainer type="project">
<email>[email protected]</email>
<name>Gentoo Perl Project</name>
</maintainer>
<use>
<flag name="clang">Toggle usage of the clang compiler in conjunction with MoarVM</flag>
<flag name="moar">Build the MoarVM backend (experimental/broken)</flag>
<flag name="system-libs">Use jars provided by the system instead of upstream</flag>
</use>
<upstream>
<remote-id type="github">perl6/nqp</remote-id>
Expand Down
93 changes: 93 additions & 0 deletions dev-lang/nqp/nqp-2016.04-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit java-pkg-2

if [[ ${PV} == "9999" ]]; then
EGIT_REPO_URI="https://github.com/perl6/${PN}.git"
inherit git-r3
KEYWORDS=""
else
SRC_URI="https://github.com/perl6/${PN}/tarball/${PV} -> ${P}.tar.gz"
KEYWORDS="~x86 ~amd64"
fi

DESCRIPTION="Not Quite Perl, a Perl 6 bootstrapping compiler"
HOMEPAGE="http://rakudo.org/"

LICENSE="Artistic-2"
SLOT="0"
IUSE="doc clang java +moar +system-libs test"
REQUIRED_USE="|| ( java moar )"

RDEPEND="java? ( >=virtual/jre-1.7:*
system-libs? (
dev-java/asm:4
dev-java/jline:0
)
)
moar? ( ~dev-lang/moarvm-${PV}[clang=] )
dev-libs/libffi"
DEPEND="${RDEPEND}
clang? ( sys-devel/clang )
java? ( >=virtual/jdk-1.7:* )
dev-lang/perl"
PATCHES=( "${FILESDIR}/enable-external-jars.patch" )

pkg_setup() {
use java && java-pkg-2_pkg_setup
}

src_prepare() {
eapply "${PATCHES[@]}"
eapply_user
use java && java-pkg-2_src_prepare
}

src_unpack() {
if [[ ${PV} == "9999" ]]; then
git-r3_src_unpack
else
unpack ${A}
mv "${WORKDIR}/perl6-nqp-"* "${WORKDIR}/${P}" || die
fi
}

src_configure() {
local backends
use java && backends+="jvm,"
use moar && backends+="moar"
local myconfargs=(
"--backend=${backends}"
"--prefix=/usr" )

# 2016.04 doesn't like our jna-3.4.1
# keep testing against it
use system-libs && myconfargs+=(
"--with-asm=$(echo $(java-pkg_getjars asm-4) | tr : '\n' | grep '/asm\.jar$')"
"--with-asm-tree=$(echo $(java-pkg_getjars asm-4) | tr : '\n' | grep '/asm-tree\.jar$')"
"--with-jline=$(echo $(java-pkg_getjars jline) | tr : '\n' | grep '/jline\.jar$')" )

perl Configure.pl "${myconfargs[@]}" || die
}

src_compile() {
MAKEOPTS=-j1 emake
}

src_test() {
MAKEOPTS=-j1 emake test
}

src_install() {
emake DESTDIR="${ED}" install || die

dodoc CREDITS README.pod || die

if use doc; then
dodoc -r docs/* || die
fi
}

0 comments on commit 2c293c6

Please sign in to comment.