Skip to content

Commit

Permalink
Fix --rakudo-home Configure.pl parameter
Browse files Browse the repository at this point in the history
`Perl6::SysConfig` object construction was broken in so far as the
%rakudo-build-config hash was initialized externally after object
construction and thus wasn't available in the `BUILD()` method itself but
was used there. This is fixed by passing a pre-populated
%rakudo-build-config hash to the Perl6::SysConfig constructor.
  • Loading branch information
patrickbkr committed Sep 15, 2020
1 parent 80aabbd commit c33221d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
12 changes: 10 additions & 2 deletions src/Perl6/SysConfig.nqp
Expand Up @@ -2,8 +2,16 @@ class Perl6::SysConfig is HLL::SysConfig {
has %!rakudo-build-config;
has $!rakudo-home;

method BUILD() {
%!rakudo-build-config := nqp::hash();
method new(%rakudo-build-config) {
my $obj := nqp::create(self);
$obj.BUILD(%rakudo-build-config);
$obj
}

method BUILD(%rakudo-build-config) {
self.build-hll-sysconfig();

%!rakudo-build-config := %rakudo-build-config;

# Determine Rakudo home.
my $execname := nqp::execname();
Expand Down
5 changes: 3 additions & 2 deletions src/main.nqp
Expand Up @@ -7,8 +7,9 @@ use Perl6::SysConfig;
# Initialize Rakudo runtime support.
nqp::p6init();

nqp::bindhllsym('default', 'SysConfig', Perl6::SysConfig.new());
hll-config(nqp::gethllsym('default', 'SysConfig').rakudo-build-config);
my %rakudo-build-config := nqp::hash();
hll-config(%rakudo-build-config);
nqp::bindhllsym('default', 'SysConfig', Perl6::SysConfig.new(%rakudo-build-config));

# Create and configure compiler object.
my $comp := Perl6::Compiler.new();
Expand Down
5 changes: 3 additions & 2 deletions src/rakudo-debug.nqp
Expand Up @@ -454,8 +454,9 @@ sub MAIN(*@ARGS) {
# Initialize dynops.
nqp::p6init();

nqp::bindhllsym('default', 'SysConfig', Perl6::SysConfig.new());
hll-config(nqp::gethllsym('default', 'SysConfig').rakudo-build-config);
my %rakudo-build-config := nqp::hash();
hll-config(%rakudo-build-config);
nqp::bindhllsym('default', 'SysConfig', Perl6::SysConfig.new(%rakudo-build-config));

# Create and configure compiler object.
my $comp := Perl6::Debugger.new();
Expand Down
5 changes: 3 additions & 2 deletions src/vm/js/load-compiler.nqp
Expand Up @@ -3,8 +3,9 @@ use Perl6::Actions;
use Perl6::Compiler;
use Perl6::SysConfig;

nqp::bindhllsym('default', 'SysConfig', Perl6::SysConfig.new());
hll-config(nqp::gethllsym('default', 'SysConfig').rakudo-build-config);
my %rakudo-build-config := nqp::hash();
hll-config(%rakudo-build-config);
nqp::bindhllsym('default', 'SysConfig', Perl6::SysConfig.new(%rakudo-build-config));

# Create and configure compiler object.
my $comp := Perl6::Compiler.new();
Expand Down

0 comments on commit c33221d

Please sign in to comment.