Skip to content

Commit

Permalink
Merge pull request #1107 from gerd/nom
Browse files Browse the repository at this point in the history
add the option --libdir to rakudo Configuration
  • Loading branch information
niner committed Jul 22, 2017
2 parents d151d8a + 278e291 commit e4d65ac
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
8 changes: 7 additions & 1 deletion Configure.pl
Expand Up @@ -32,7 +32,7 @@
my $exe = $NQP::Configure::exe;

my %options;
GetOptions(\%options, 'help!', 'prefix=s',
GetOptions(\%options, 'help!', 'prefix=s', 'libdir=s',
'sysroot=s', 'sdkroot=s',
'backends=s', 'no-clean!',
'with-nqp=s', 'gen-nqp:s',
Expand All @@ -57,6 +57,10 @@
$options{prefix} = $default;
}
$options{prefix} = File::Spec->rel2abs($options{prefix});
unless (defined $options{libdir}) {
my $default = File::Spec->catdir($options{prefix}, 'share');
$options{libdir} = $default;
}
my $prefix = $options{'prefix'};
my @known_backends = qw/moar jvm/;
my %known_backends = map { $_, 1; } @known_backends;
Expand Down Expand Up @@ -129,6 +133,7 @@
}

$config{prefix} = $prefix;
$config{libdir} = $options{libdir};
$config{sdkroot} = $options{sdkroot} || '';
$config{sysroot} = $options{sysroot} || '';
$config{slash} = $slash;
Expand Down Expand Up @@ -375,6 +380,7 @@ sub print_help {
General Options:
--help Show this text
--prefix=dir Install files in dir; also look for executables there
--libdir=dir Install architecture-specific files in dir; Perl6 modules included
--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
Expand Down
2 changes: 1 addition & 1 deletion src/Perl6/ModuleLoader.nqp
Expand Up @@ -52,7 +52,7 @@ class Perl6::ModuleLoader does Perl6::ModuleLoaderVMConfig {
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<prefix> ~ '/share/nqp/lib/') ~ $file;
$file := ($include ?? $include ~ '/' !! nqp::getcomp('perl6').config<libdir> ~ '/nqp/lib/') ~ $file;

if nqp::existskey(%modules_loaded, $file) {
return nqp::ctxlexpad(%modules_loaded{$file});
Expand Down
4 changes: 2 additions & 2 deletions src/core/CompUnit/RepositoryRegistry.pm
Expand Up @@ -67,8 +67,8 @@ class CompUnit::RepositoryRegistry {
my $prefix := nqp::existskey($ENV,'RAKUDO_PREFIX')
?? nqp::atkey($ENV,'RAKUDO_PREFIX')
!! nqp::concat(
nqp::atkey(nqp::getcomp('perl6').config,'prefix'),
'/share/perl6'
nqp::atkey(nqp::getcomp('perl6').config,'libdir'),
'/perl6'
);

# XXX Various issues with this stuff on JVM , TEMPORARY
Expand Down
4 changes: 3 additions & 1 deletion src/vm/moar/ModuleLoaderVMConfig.nqp
@@ -1,8 +1,10 @@
role Perl6::ModuleLoaderVMConfig {
method vm_search_paths() {
my @search_paths;
@search_paths.push(nqp::backendconfig<prefix> ~ '/share/perl6/lib');
@search_paths.push(nqp::backendconfig<libdir> ~ '/perl6/lib');
# XXX CHEAT: Goes away when we implement :from<nqp>.
@search_paths.push(nqp::backendconfig<libdir> ~ '/nqp/lib');
# Keep share dir, moarvm has some files there
@search_paths.push(nqp::backendconfig<prefix> ~ '/share/nqp/lib');
@search_paths
}
Expand Down
7 changes: 4 additions & 3 deletions tools/build/Makefile-Moar.in
Expand Up @@ -10,7 +10,8 @@ M_BUILD_DIR = gen/moar
MOAR_PREFIX = @moar::prefix@
MOAR = @moar::bindir@@slash@moar@exe@
M_NQP = @m_nqp@
M_LIBPATH = $(PREFIX)@slash@share@slash@nqp@slash@lib
M_LIBDEFPATH = $(PREFIX)@slash@share@slash@nqp@slash@lib
M_LIBPATH = $(LIBDIR)@slash@nqp@slash@lib
M_INCPATH = $(MOAR_PREFIX)@slash@include
NQP_LIBPATH = @nqp::libdir@

Expand Down Expand Up @@ -150,7 +151,7 @@ $(PERL6_C_MOAR): src/Perl6/Compiler.nqp $(PERL6_O_MOAR)
src/Perl6/Compiler.nqp

$(PERL6_MOAR): src/main.nqp $(PERL6_G_MOAR) $(PERL6_A_MOAR) $(PERL6_C_MOAR) $(PERL6_P_MOAR) $(PERL6_DP_MOAR)
$(PERL5) tools/build/gen-version.pl $(PREFIX) > $(M_BUILD_DIR)/main-version.nqp
$(PERL5) tools/build/gen-version.pl $(PREFIX) $(LIBDIR) > $(M_BUILD_DIR)/main-version.nqp
$(M_NQP) $(M_GEN_CAT) src/main.nqp $(M_BUILD_DIR)/main-version.nqp > $(M_BUILD_DIR)/main.nqp
$(M_NQP) --target=mbc --output=$(PERL6_MOAR) \
--vmlibs=$(M_PERL6_OPS_DLL)=Rakudo_ops_init $(M_BUILD_DIR)/main.nqp
Expand Down Expand Up @@ -198,7 +199,7 @@ $(M_DEBUG_RUNNER): tools/build/create-moar-runner.pl $(PERL6_DEBUG_MOAR) $(SETTI

$(M_GDB_RUNNER): tools/build/create-moar-runner.pl $(PERL6_MOAR) $(SETTING_MOAR)
$(RM_F) $(M_GDB_RUNNER)
$(M_RUN_PERL6) tools/build/create-moar-runner.pl "$(MOAR)" perl6.moarvm perl6-gdb-m . "gdb" --nqp-lib=blib "$(M_LIBPATH)" "$(NQP_LIBPATH)" .
$(M_RUN_PERL6) tools/build/create-moar-runner.pl "$(MOAR)" perl6.moarvm perl6-gdb-m . "gdb" --nqp-lib=blib "$(M_LIBDEFPATH)" "$(M_LIBPATH)" "$(NQP_LIBPATH)" .
-$(CHMOD) 755 $(M_GDB_RUNNER)

$(M_LLDB_RUNNER): tools/build/create-moar-runner.pl $(PERL6_MOAR) $(SETTING_MOAR)
Expand Down
3 changes: 2 additions & 1 deletion tools/build/Makefile-common-macros.in
Expand Up @@ -12,7 +12,8 @@ SHELL = @shell@
SYSROOT= @sysroot@
SDKROOT= @sdkroot@
PREFIX = @prefix@
PERL6_LANG_DIR = $(PREFIX)/share/perl6
LIBDIR = @libdir@
PERL6_LANG_DIR = $(LIBDIR)/perl6

BOOTSTRAP_SOURCES = \
src/Perl6/Metamodel/BOOTSTRAP.nqp \
Expand Down
2 changes: 2 additions & 0 deletions tools/build/gen-version.pl
Expand Up @@ -9,6 +9,7 @@ =head1 TITLE
use POSIX 'strftime';

my $prefix = shift;
my $libdir = shift;

open(my $fh, '<', 'VERSION') or die $!;
my $VERSION = <$fh>;
Expand All @@ -34,6 +35,7 @@ =head1 TITLE
\$config<build-date> := '$builddate';
\$config<language_version> := '6.c';
\$config<prefix> := '$prefix';
\$config<libdir> := '$libdir';
}
END_VERSION

Expand Down

0 comments on commit e4d65ac

Please sign in to comment.