Skip to content

Commit

Permalink
Implement --perl6-home and --nqp-home forwarding
Browse files Browse the repository at this point in the history
These options allow putting the *-home directories into arbitrary places.
  • Loading branch information
PatZim committed Sep 22, 2019
1 parent c1e0e38 commit e16e61a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Configure.pl
Expand Up @@ -64,6 +64,7 @@ BEGIN
GetOptions(
$cfg->options, 'help!',
'prefix=s', 'libdir=s',
'perl6-home=s', 'nqp-home=s',
'sysroot=s', 'sdkroot=s',
'relocatable', 'backends=s',
'no-clean', 'with-nqp=s',
Expand Down Expand Up @@ -153,6 +154,8 @@ sub print_help {
--prefix=<path> Install files in dir; also look for executables there
--libdir=<path> Install architecture-specific files in dir; Perl6 modules
included
--nqp-home=dir Directory to install NQP files to
--perl6-home=dir Directory to install Perl 6 files to
--relocatable
Dynamically locate NQP and Perl6 home dirs instead of
statically compiling them in. (On AIX and OpenBSD Rakudo
Expand Down
19 changes: 11 additions & 8 deletions tools/lib/NQP/Config/Rakudo.pm
Expand Up @@ -120,6 +120,7 @@ sub configure_backends {
sub configure_refine_vars {
my $self = shift;

my $config = $self->{config};
my $nqp_bin = $self->cfg('nqp_default');
if ($nqp_bin) {
my ( $vol, $dir, undef ) = File::Spec->splitpath($nqp_bin);
Expand Down Expand Up @@ -152,6 +153,13 @@ sub configure_refine_vars {
}

$self->SUPER::configure_refine_vars(@_);

$config->{perl6_home} = $self->nfp(
File::Spec->rel2abs(
$config->{perl6_home} ||
File::Spec->catdir( $config->{'prefix'}, 'share', 'perl6' )
)
);
}

sub parse_lang_specs {
Expand Down Expand Up @@ -340,13 +348,8 @@ sub configure_moar_backend {
}
else {
my $qchar = $config->{quote};
$nqp_config->{static_nqp_home} =
File::Spec->rel2abs(
File::Spec->catdir( $nqp_config->{'nqp::prefix'}, 'share', 'nqp' )
);
$nqp_config->{static_perl6_home} =
File::Spec->rel2abs(
File::Spec->catdir( $config->{prefix}, 'share', 'perl6' ) );
$nqp_config->{static_nqp_home} = $nqp_config->{'nqp::nqp_home'};
$nqp_config->{static_perl6_home} = $config->{perl6_home};
$nqp_config->{static_nqp_home_define} =
'-DSTATIC_NQP_HOME='
. $qchar
Expand Down Expand Up @@ -661,7 +664,7 @@ sub gen_nqp {
# Append only the options we'd like to pass down to NQP's Configure.pl
for my $opt (
qw<git-depth git-reference github-user nqp-repo moar-repo
relocatable ignore-errors with-moar>
nqp-home relocatable ignore-errors with-moar>
)
{
my $opt_str = $self->make_option( $opt, no_quote => 1 );
Expand Down
5 changes: 3 additions & 2 deletions tools/templates/Makefile-backend-common.in
Expand Up @@ -193,13 +193,14 @@ check_@backend_abbr@_nqp_version: @@script(check-nqp-version.pl)@@

@backend_prefix@-install:: @backend_prefix@-all @@script(install-core-dist.p6)@@@for_specs( @bsm(SETTING_@ucspec@)@)@
$(MKPATH) @nfpq($(DESTDIR)$(PREFIX)/bin)@
$(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME))@
$(MKPATH) @nfpq(@nop($(DESTDIR))@@bpm(LIBDIR)@)@
$(MKPATH) @nfpq(@nop($(DESTDIR))@@bpm(LIBDIR)@/Perl6)@
$(MKPATH) @nfpq(@nop($(DESTDIR))@@bpm(LIBDIR)@/Perl6/BOOTSTRAP)@
$(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME)/vendor)@
$(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME)/site)@
$(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
@if(backend==moar $(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME)/lib)@
$(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime/dynext)@
@if(backend==moar $(MKPATH) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime/dynext)@
@bpm(RUN_CLEAN_TARGET_FILES)@ @bpm(PERL6_PRECOMPS)@ @nfpq(@nop($(DESTDIR))@@bpm(LIBDIR)@/Perl6)@
@bpm(RUN_CLEAN_TARGET_FILES)@ @bpm(PERL6_BOOTSTRAP_PRECOMPS)@ @nfpq(@nop($(DESTDIR))@@bpm(LIBDIR)@/Perl6/BOOTSTRAP)@
@bpm(RUN_CLEAN_TARGET_FILES)@ @for_specs($(SETTING_@ucspec@_MOAR) )@$(R_SETTING_MOAR) @nfpq($(DESTDIR)$(PERL6_HOME)/runtime)@
Expand Down
2 changes: 1 addition & 1 deletion tools/templates/Makefile-common-macros.in
Expand Up @@ -14,7 +14,7 @@ SYSROOT = @nfp(@sysroot@)@
SDKROOT = @nfp(@sdkroot@)@
PREFIX = @nfp(@prefix@)@
LIBDIR = @nfp(@libdir@)@
PERL6_HOME = $(LIBDIR)@nfp(/perl6)@
PERL6_HOME = @nfp(@perl6_home@)@
BASE_DIR = @base_dir@

BOOTSTRAP_SOURCES = \
Expand Down
2 changes: 2 additions & 0 deletions tools/templates/main-version.in
Expand Up @@ -34,7 +34,9 @@ sub hll-config($config) {
)@
);
$config<prefix> := '@prefix@';
$config<nqp-home> := '@nqp_home@';
$config<libdir> := '@libdir@';
$config<perl6-home> := '@perl6_home@';
$config<source-digest> := '@source_digest()@';
}

0 comments on commit e16e61a

Please sign in to comment.