Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #252 from rehsack/master
introduce support for staging directories during build
  • Loading branch information
moritz committed Nov 10, 2015
2 parents 052389b + 9f87bb9 commit d380395
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
13 changes: 12 additions & 1 deletion Configure.pl
Expand Up @@ -29,6 +29,7 @@

my %options;
GetOptions(\%options, 'help!', 'prefix=s',
'sysroot=s', 'sdkroot=s',
'backends=s',
'no-clean',
'with-parrot=s', 'gen-parrot:s', 'parrot-config=s', 'parrot-option=s@',
Expand Down Expand Up @@ -82,9 +83,16 @@
$default_backend = 'moar';
}

# XXX mkpath instead?
mkdir($options{'prefix'}) if $options{'prefix'} && $^O =~ /Win32/ && !-d $options{'prefix'};
my $prefix = ($options{'prefix'} && abs_path($options{'prefix'})) || cwd().'/install';
my $prefix = $options{'prefix'}
? abs_path($options{'prefix'})
: ($options{sysroot}
? '/usr'
: File::Spec->catdir(cwd, 'install'));
$config{prefix} = $prefix;
$config{sysroot} = $options{sysroot};
$config{sdkroot} = $options{sdkroot};

# Save options in config.status
unlink('config.status');
Expand Down Expand Up @@ -336,6 +344,9 @@ sub print_help {
General Options:
--help Show this text
--prefix=dir Install files in dir
--sdkroot=dir When given, use for searching build tools here, e.g.
nqp, java etc.
--sysroot=dir When given, use for searching runtime components here
--backends=list Backends to use: $backends
--with-parrot=path/to/bin/parrot
Parrot executable to use to build NQP
Expand Down
1 change: 1 addition & 0 deletions tools/build/Makefile-common.in
Expand Up @@ -99,6 +99,7 @@ CP = $(PERL) -MExtUtils::Command -e cp
RM_RF = $(PERL) -MExtUtils::Command -e rm_rf
RM_F = $(PERL) -MExtUtils::Command -e rm_f

SYSROOT = @sysroot@
PREFIX = @prefix@
BIN_DIR = $(PREFIX)/bin
NQP_LANG_DIR = $(PREFIX)/share/nqp
Expand Down
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
3 changes: 2 additions & 1 deletion tools/lib/NQP/Configure.pm
Expand Up @@ -437,13 +437,14 @@ sub gen_moar {
my %options = @_;

my $prefix = $options{'prefix'} || cwd()."/install";
my $sdkroot = $options{'sdkroot'} || '';
my $gen_moar = $options{'gen-moar'};
my @opts = @{ $options{'moar-option'} || [] };
push @opts, "--optimize";
my $startdir = cwd();
my $git_protocol = $options{'git-protocol'} || 'https';

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

0 comments on commit d380395

Please sign in to comment.