Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #53 from rehsack/master
add staging dir support for building
  • Loading branch information
moritz committed Nov 10, 2015
2 parents 12d32ac + f0def6d commit dc1ba76
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
12 changes: 9 additions & 3 deletions Configure.pl
Expand Up @@ -32,6 +32,7 @@

my %options;
GetOptions(\%options, 'help!', 'prefix=s',
'sysroot=s', 'sdkroot=s',
'backends=s', 'no-clean!',
'gen-nqp:s', 'gen-moar:s',
'make-install!', 'makefile-timing!',
Expand Down Expand Up @@ -59,9 +60,9 @@
}

unless (defined $options{prefix}) {
my $dir = getcwd;
print "ATTENTION: no --prefix supplied, building and installing to $dir/install\n";
$options{prefix} = 'install';
my $default = defined($options{sysroot}) ? '/usr' : File::Spec->catdir(getcwd, 'install');
print "ATTENTION: no --prefix supplied, building and installing to $default\n";
$options{prefix} = $default;
}
$options{prefix} = File::Spec->rel2abs($options{prefix});

Expand Down Expand Up @@ -148,6 +149,8 @@
}

$config{prefix} = $prefix;
$config{sdkroot} = $options{sdkroot};
$config{sysroot} = $options{sysroot};
$config{slash} = $slash;
$config{'makefile-timing'} = $options{'makefile-timing'};
$config{'stagestats'} = '--stagestats' if $options{'makefile-timing'};
Expand Down Expand Up @@ -263,6 +266,9 @@ sub print_help {
General Options:
--help Show this text
--prefix=dir Install files in dir; also look for executables there
--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=jvm,moar
Which backend(s) to use
--gen-moar[=branch]
Expand Down
4 changes: 3 additions & 1 deletion tools/build/Makefile.in
Expand Up @@ -7,6 +7,8 @@ STAR_VERSION = 2015.09

# install location
PREFIX_DIR = @prefix@
SDKROOT_DIR = @sdkroot@
SYSROOT_DIR = @sysroot@

# JVM install location
JVM_BIN_DIR = $(PREFIX_DIR)/bin
Expand Down Expand Up @@ -40,7 +42,7 @@ rakudo: @backend_exes@

@backend_exes@:
@echo "== Configuring and building Rakudo"
cd $(RAKUDO_DIR) && $(PERL) Configure.pl --prefix=$(PREFIX_DIR) --backends=@backends@ && $(MAKE)
cd $(RAKUDO_DIR) && $(PERL) Configure.pl --sysroot=$(SYSROOT_DIR) --sdkroot=$(SDKROOT_DIR) --prefix=$(PREFIX_DIR) --backends=@backends@ && $(MAKE)

rakudo-test: rakudo
cd $(RAKUDO_DIR) && $(MAKE) test
Expand Down
7 changes: 5 additions & 2 deletions tools/lib/NQP/Configure.pm
Expand Up @@ -3,6 +3,7 @@ use strict;
use warnings;
use Cwd;
use File::Copy qw(copy);
use File::Spec qw();

use base qw(Exporter);
our @EXPORT_OK = qw(sorry slurp system_or_die
Expand Down Expand Up @@ -217,6 +218,7 @@ sub gen_nqp {
my $gen_nqp = $options{'gen-nqp'};
my $gen_moar = $options{'gen-moar'};
my $prefix = $options{'prefix'} || cwd().'/install';
my $sdkroot = $options{'sdkroot'} || '';
my $startdir = cwd();

my $PARROT_REVISION = 'nqp/tools/build/PARROT_REVISION';
Expand All @@ -227,7 +229,7 @@ sub gen_nqp {
for my $b (qw/jvm moar/) {
if ($backends =~ /$b/) {
my $postfix = substr $b, 0, 1;
my $bin = "$prefix/bin/nqp-$postfix$bat";
my $bin = File::Spec->catfile( $sdkroot, $prefix, 'bin', "nqp-$postfix$bat" );
$impls{$b}{bin} = $bin;
my %c = read_config($bin);
my $nqp_have = $c{'nqp::version'} || '';
Expand Down Expand Up @@ -280,12 +282,13 @@ 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 $moar_exe = "$prefix/bin/moar$exe";
my $moar_exe = File::Spec->catfile( $sdkroot, $prefix, 'bin', "moar$exe" );
my $moar_have = -e $moar_exe ? qx{ $moar_exe --version } : undef;
if ($moar_have) {
$moar_have = $moar_have =~ /version (\S+)/ ? $1 : undef;
Expand Down

0 comments on commit dc1ba76

Please sign in to comment.