Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
nqp-j: allow experienced user start with other libdir or jars
To allow dedicated use of another NQP_DIR or another NQP_JAR list for e.g.
cross-compiling NQP.

Signed-off-by: Jens Rehsack <sno@netbsd.org>
  • Loading branch information
rehsack committed Nov 10, 2015
1 parent b3c4902 commit 9f87bb9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tools/build/install-jvm-runner.pl
Expand Up @@ -13,11 +13,11 @@
$prefix = File::Spec->rel2abs($prefix);
}

my $jar_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'runtime');
my $lib_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'lib');

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;' .
Expand All @@ -26,12 +26,18 @@
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 "exec 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";
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;
Expand Down

0 comments on commit 9f87bb9

Please sign in to comment.