Skip to content
Permalink
Browse files

Make the BOOTSTRAP load logic independent of install location.

This makes the --nqp-lib fix in the relocatable runner superfluous.
  • Loading branch information...
patzim committed Jan 7, 2019
1 parent 171bb6e commit a11e9ab50e851f9b10431ff4ab1fbda834b48286
Showing with 9 additions and 4 deletions.
  1. +8 −3 src/Perl6/ModuleLoader.nqp
  2. +1 −1 tools/build/create-moar-runner.p6
@@ -49,8 +49,14 @@ class Perl6::ModuleLoader does Perl6::ModuleLoaderVMConfig {
my $*CTXSAVE := self;
my $*MAIN_CTX;
my $file := 'Perl6/BOOTSTRAP' ~ self.file-extension;
my $include := nqp::getcomp('perl6').cli-options<nqp-lib>;
$file := ($include ?? $include ~ '/' !! nqp::getcomp('perl6').config<libdir> ~ '/nqp/lib/') ~ $file;

my @prefixes := %language_module_loaders<NQP>.search_path('module-path');
for @prefixes -> $prefix {
if nqp::stat("$prefix/$file", 0) {
$file := "$prefix/$file";
last;
}
}

if nqp::existskey(%modules_loaded, $file) {
return nqp::ctxlexpad(%modules_loaded{$file});
@@ -67,7 +73,6 @@ class Perl6::ModuleLoader does Perl6::ModuleLoaderVMConfig {
}
return $UNIT;
}

if nqp::existskey(%language_module_loaders, %opts<from> // 'NQP') {
# We expect that custom module loaders will accept a Stash, only
# NQP expects a hash and therefor needs special handling.
@@ -80,7 +80,7 @@ else {
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
exec $DIR/moar --execname="$0" --libpath="$DIR/../share/nqp/lib" --libpath="$DIR/../share/perl6/lib" --libpath="$DIR/../share/perl6/runtime" $DIR/../share/perl6/runtime/perl6.moarvm --nqp-lib="$DIR/../share/nqp/lib" "$@"
exec $DIR/moar --execname="$0" --libpath="$DIR/../share/nqp/lib" --libpath="$DIR/../share/perl6/lib" --libpath="$DIR/../share/perl6/runtime" $DIR/../share/perl6/runtime/perl6.moarvm "$@"
EOS
}
else {

0 comments on commit a11e9ab

Please sign in to comment.
You can’t perform that action at this time.