Skip to content

Commit d380395

Browse files
committed
Merge pull request #252 from rehsack/master
introduce support for staging directories during build
2 parents 052389b + 9f87bb9 commit d380395

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

Configure.pl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
my %options;
3131
GetOptions(\%options, 'help!', 'prefix=s',
32+
'sysroot=s', 'sdkroot=s',
3233
'backends=s',
3334
'no-clean',
3435
'with-parrot=s', 'gen-parrot:s', 'parrot-config=s', 'parrot-option=s@',
@@ -82,9 +83,16 @@
8283
$default_backend = 'moar';
8384
}
8485

86+
# XXX mkpath instead?
8587
mkdir($options{'prefix'}) if $options{'prefix'} && $^O =~ /Win32/ && !-d $options{'prefix'};
86-
my $prefix = ($options{'prefix'} && abs_path($options{'prefix'})) || cwd().'/install';
88+
my $prefix = $options{'prefix'}
89+
? abs_path($options{'prefix'})
90+
: ($options{sysroot}
91+
? '/usr'
92+
: File::Spec->catdir(cwd, 'install'));
8793
$config{prefix} = $prefix;
94+
$config{sysroot} = $options{sysroot};
95+
$config{sdkroot} = $options{sdkroot};
8896

8997
# Save options in config.status
9098
unlink('config.status');
@@ -336,6 +344,9 @@ sub print_help {
336344
General Options:
337345
--help Show this text
338346
--prefix=dir Install files in dir
347+
--sdkroot=dir When given, use for searching build tools here, e.g.
348+
nqp, java etc.
349+
--sysroot=dir When given, use for searching runtime components here
339350
--backends=list Backends to use: $backends
340351
--with-parrot=path/to/bin/parrot
341352
Parrot executable to use to build NQP

tools/build/Makefile-common.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ CP = $(PERL) -MExtUtils::Command -e cp
9999
RM_RF = $(PERL) -MExtUtils::Command -e rm_rf
100100
RM_F = $(PERL) -MExtUtils::Command -e rm_f
101101

102+
SYSROOT = @sysroot@
102103
PREFIX = @prefix@
103104
BIN_DIR = $(PREFIX)/bin
104105
NQP_LANG_DIR = $(PREFIX)/share/nqp

tools/build/install-jvm-runner.pl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
$prefix = File::Spec->rel2abs($prefix);
1414
}
1515

16-
my $jar_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'runtime');
17-
my $lib_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'lib');
18-
1916
if ($^O eq 'MSWin32') {
17+
my $jar_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'runtime');
18+
my $lib_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'lib');
2019
my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j.bat');
20+
2121
open my $fh, ">", $install_to
2222
or die "Could not open $install_to: $!";
2323
print $fh '@java -Xss1m -Xmx512m -Xbootclasspath/a:' . $jar_dir . '\\nqp-runtime.jar;' .
@@ -26,12 +26,18 @@
2626
or die "Could not close $install_to: $!";
2727
}
2828
else {
29+
my $nqp_dir = File::Spec->catfile($prefix, qw/share nqp/);
30+
my $jar_dir = File::Spec->catfile('${NQP_DIR}', 'runtime');
31+
my $lib_dir = File::Spec->catfile('${NQP_DIR}', 'lib');
32+
my $jars = "$jar_dir/nqp-runtime.jar:$jar_dir/asm-4.1.jar:$jar_dir/jline-1.0.jar:$lib_dir/nqp.jar";
2933
my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j');
34+
3035
open my $fh, ">", $install_to
3136
or die "Could not open $install_to: $!";
3237
print $fh "#!/bin/sh\n";
33-
print $fh "exec java -Xss1m -Xmx512m -Xbootclasspath/a:$jar_dir/nqp-runtime.jar:" .
34-
"$jar_dir/asm-4.1.jar:$jar_dir/jline-1.0.jar:$lib_dir/nqp.jar -cp $lib_dir nqp \"\$\@\"\n";
38+
print $fh ": \${NQP_DIR:=\"$nqp_dir\"}\n";
39+
print $fh ": \${NQP_JARS:=\"$jars\"}\n";
40+
print $fh "exec java -Xss1m -Xmx512m -Xbootclasspath/a:\${NQP_JARS} -cp $lib_dir nqp \"\$\@\"\n";
3541
close $fh
3642
or die "Could not close $install_to: $!";
3743
chmod 0755, $install_to;

tools/lib/NQP/Configure.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,14 @@ sub gen_moar {
437437
my %options = @_;
438438

439439
my $prefix = $options{'prefix'} || cwd()."/install";
440+
my $sdkroot = $options{'sdkroot'} || '';
440441
my $gen_moar = $options{'gen-moar'};
441442
my @opts = @{ $options{'moar-option'} || [] };
442443
push @opts, "--optimize";
443444
my $startdir = cwd();
444445
my $git_protocol = $options{'git-protocol'} || 'https';
445446

446-
my $moar_exe = $options{'with-moar'} || "$prefix/bin/moar$exe";
447+
my $moar_exe = $options{'with-moar'} || File::Spec->catfile( $sdkroot, $prefix, 'bin', "moar$exe" );
447448
my $moar_have = qx{ $moar_exe --version };
448449
if ($moar_have) {
449450
$moar_have = $moar_have =~ /version (\S+)/ ? $1 : undef;

0 commit comments

Comments
 (0)