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 052389b commit b3c4902
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 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
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 b3c4902

Please sign in to comment.