Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
introduce support for sdkroot and sysroot to support cross-builds
To allow building for another location rather the final install prefix,
regardless whether chroot based builds, cross-compile or canadian cross sdk
is the goal, realize the difference between prefix, the sdk-root and the
system root for final target.

Signed-off-by: Jens Rehsack <sno@netbsd.org>
  • Loading branch information
rehsack committed Nov 10, 2015
1 parent 326a744 commit bb49e08
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
14 changes: 10 additions & 4 deletions Configure.pl
Expand Up @@ -33,7 +33,8 @@

my %options;
GetOptions(\%options, 'help!', 'prefix=s',
'backends=s', 'no-clean!',
'sysroot=s', 'sdkroot=s',
'backends=s', 'no-clean!',
'gen-nqp:s',
'gen-moar:s', 'moar-option=s@',
'git-protocol=s',
Expand All @@ -51,9 +52,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});
my $prefix = $options{'prefix'};
Expand Down Expand Up @@ -123,6 +124,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 @@ -321,6 +324,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 (or ALL for all of them)
--gen-nqp[=branch]
Expand Down
1 change: 1 addition & 0 deletions tools/build/Makefile-common.in
Expand Up @@ -8,6 +8,7 @@ CP = $(PERL) -MExtUtils::Command -e cp
RM_F = $(PERL) -MExtUtils::Command -e rm_f
RM_RF = $(PERL) -MExtUtils::Command -e rm_rf

SYSROOT= @sysroot@
PREFIX = @prefix@
PERL6_LANG_DIR = $(PREFIX)/share/perl6

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 @@ -214,6 +215,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 $git_protocol = $options{'git-protocol'} // 'https';
my @moar_options = @{ $options{'moar-option'} // [] };
Expand All @@ -223,7 +225,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 @@ -289,13 +291,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 = "$prefix/bin/moar$exe";
my $moar_exe = 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 bb49e08

Please sign in to comment.