From 253e633911d71cf35cc1c9ca5a7b9d12e79ab840 Mon Sep 17 00:00:00 2001 From: Jens Rehsack Date: Mon, 9 Nov 2015 21:10:58 +0100 Subject: [PATCH] builder: add capability to work with staging directories To allow building for a staging root which might differ from host and tools to be used, be more careful about the PATH's to be used. This will allow cross-compiling rakudo using two builds of nqp: a native one in SDKROOT and a cross-compiled one in SYSROOT. Using host one remains untouched when run without --sysroot or --sdkroot, respectively. Signed-off-by: Jens Rehsack --- Configure.pl | 1 + tools/build/Makefile-JVM.in | 14 ++++++++----- tools/build/Makefile-common.in | 1 + tools/build/create-jvm-runner.pl | 34 ++++++++++++++++++-------------- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Configure.pl b/Configure.pl index 6f792006967..59eb0985ac8 100644 --- a/Configure.pl +++ b/Configure.pl @@ -224,6 +224,7 @@ $config{'nqp_prefix'} = $nqp_config{'jvm::prefix'}; $config{'nqp_jars'} = $nqp_config{'jvm::runtime.jars'}; + $config{'bld_nqp_jars'} = join( $config{'cpsep'}, map { $config{'sysroot'} . $_ } split( $config{'cpsep'}, $nqp_config{'jvm::runtime.jars'} ) ); $config{'nqp_classpath'} = $nqp_config{'jvm::runtime.classpath'}; $config{'j_runner'} = $win ? 'perl6-j.bat' : 'perl6-j'; diff --git a/tools/build/Makefile-JVM.in b/tools/build/Makefile-JVM.in index 617a51a4192..868e9bf6236 100644 --- a/tools/build/Makefile-JVM.in +++ b/tools/build/Makefile-JVM.in @@ -11,8 +11,10 @@ J_BUILD_DIR = gen/jvm PERL6_LANG_DIR = $(PREFIX)/share/perl6 NQP_JARS = @nqp_jars@ +BLD_NQP_JARS = @bld_nqp_jars@ -J_RUN_PERL6 = $(JAVA) -Xss1m -Xms500m -Xmx2000m -Xbootclasspath/a:.@cpsep@$(NQP_JARS)@cpsep@rakudo-runtime.jar@cpsep@perl6.jar -cp @nqp_classpath@ perl6 +J_RUN_NQP_RR = $(JAVA) -Xss1m -Xms500m -Xmx2000m -Xbootclasspath/a:.@cpsep@$(BLD_NQP_JARS)@cpsep@rakudo-runtime.jar -cp $(SYSROOT)@nqp_classpath@ nqp +J_RUN_PERL6 = $(JAVA) -Xss1m -Xms500m -Xmx2000m -Xbootclasspath/a:.@cpsep@$(BLD_NQP_JARS)@cpsep@rakudo-runtime.jar@cpsep@perl6.jar -cp $(SYSROOT)@nqp_classpath@ perl6 RUNTIME_JAVAS = src/vm/jvm/runtime/org/perl6/rakudo/*.java @@ -248,7 +250,7 @@ j-all: $(PERL6_JAR) $(SETTING_JAR) $(J_RUNNER) lib/Test.pm.jar lib/lib.pm6.jar l $(RUNTIME_JAR): $(RUNTIME_JAVAS) $(PERL) -MExtUtils::Command -e mkpath bin - $(JAVAC) -source 1.7 -cp $(NQP_JARS) -g -d bin -encoding UTF8 $(RUNTIME_JAVAS) + $(JAVAC) -source 1.7 -cp $(BLD_NQP_JARS) -g -d bin -encoding UTF8 $(RUNTIME_JAVAS) $(JAR) cf0 rakudo-runtime.jar -C bin/ . $(PERL6_ML_JAR): src/Perl6/ModuleLoader.nqp src/vm/jvm/ModuleLoaderVMConfig.nqp src/vm/jvm/Perl6/JavaModuleLoader.nqp @@ -299,8 +301,7 @@ $(PERL6_M_JAR): $(J_METAMODEL_SOURCES) $(PERL6_OPS_JAR) $(PERL6_B_JAR): $(BOOTSTRAP_SOURCES) $(PERL6_M_JAR) $(J_NQP) $(J_GEN_CAT) $(BOOTSTRAP_SOURCES) > $(J_BUILD_DIR)/BOOTSTRAP.nqp - $(PERL) tools/build/nqp-jvm-rr.pl $(J_NQP) --target=jar \ - --output=$(PERL6_B_JAR) --encoding=utf8 $(J_BUILD_DIR)/BOOTSTRAP.nqp + $(J_RUN_NQP_RR) --target=jar --output=$(PERL6_B_JAR) --encoding=utf8 $(J_BUILD_DIR)/BOOTSTRAP.nqp $(SETTING_JAR): $(PERL6_JAR) $(PERL6_B_JAR) $(J_CORE_SOURCES) $(J_NQP) $(J_GEN_CAT) $(J_CORE_SOURCES) > $(J_BUILD_DIR)/CORE.setting @@ -347,12 +348,15 @@ lib/Pod/To/Text.pm.jar: lib/Pod/To/Text.pm $(PERL6_JAR) $(SETTING_JAR) $(J_RUNNE lib/newline.pm6.jar: lib/newline.pm6 $(PERL6_JAR) $(SETTING_JAR) $(J_RUNNER) .@slash@$(J_RUNNER) --target=jar --output=lib/newline.pm6.jar lib/newline.pm6 +eval-client.pl: + $(CP) $(SDKROOT)$(NQP_PREFIX)/bin/eval-client.pl . + ## testing targets j-test : j-coretest j-fulltest: j-coretest j-stresstest -j-coretest: j-all +j-coretest: j-all eval-client.pl $(J_HARNESS) t/01-sanity t/03-jvm t/04-nativecall # Run the spectests that we know work. diff --git a/tools/build/Makefile-common.in b/tools/build/Makefile-common.in index bb0a52e3fab..cab8c8ad5db 100644 --- a/tools/build/Makefile-common.in +++ b/tools/build/Makefile-common.in @@ -9,6 +9,7 @@ RM_F = $(PERL) -MExtUtils::Command -e rm_f RM_RF = $(PERL) -MExtUtils::Command -e rm_rf SYSROOT= @sysroot@ +SDKROOT= @sdkroot@ PREFIX = @prefix@ PERL6_LANG_DIR = $(PREFIX)/share/perl6 diff --git a/tools/build/create-jvm-runner.pl b/tools/build/create-jvm-runner.pl index aa592e33122..ffb5818b677 100644 --- a/tools/build/create-jvm-runner.pl +++ b/tools/build/create-jvm-runner.pl @@ -23,15 +23,26 @@ my $cpsep = $^O eq 'MSWin32' ? ';' : ':'; my $bat = $^O eq 'MSWin32' ? '.bat' : ''; -my $preamble = $^O eq 'MSWin32' ? '@' : '#!/bin/sh -exec '; -my $postamble = $^O eq 'MSWin32' ? ' %*' : ' "$@"'; - +my $nqpdir = File::Spec->catfile($nqpprefix, 'share', 'nqp'); +my $nqplibdir = $^O eq 'MSWin32' ? File::Spec->catfile($nqpdir, 'lib') : File::Spec->catfile('${NQP_DIR}', 'lib'); +my $nqpjars = $^O eq 'MSWin32' ? $thirdpartyjars : join( $cpsep, map { $_ =~ s,$nqpdir,\${NQP_DIR},g; $_ } split($cpsep, $thirdpartyjars) ); my $bindir = $type eq 'install' ? File::Spec->catfile($prefix, 'bin') : $prefix; -my $jardir = $type eq 'install' ? File::Spec->catfile($prefix, 'share', 'perl6', 'runtime') : $prefix; -my $libdir = $type eq 'install' ? File::Spec->catfile($prefix, 'share', 'perl6', 'lib') : 'blib'; -my $nqplibdir = File::Spec->catfile($nqpprefix, 'share', 'nqp', 'lib'); +my $perl6dir = $type eq 'install' ? File::Spec->catfile($prefix, 'share', 'perl6') : $prefix; +my $jardir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $perl6dir : '${PERL6_DIR}', 'runtime') : $prefix; +my $libdir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $perl6dir : '${PERL6_DIR}', 'lib') : 'blib'; my $sharedir = File::Spec->catfile($prefix, 'share', 'perl6', 'site', 'lib'); +my $perl6jars = join( $cpsep, + $^O eq 'MSWin32' ? $nqpjars : '${NQP_JARS}', + File::Spec->catfile($jardir, 'rakudo-runtime.jar'), + File::Spec->catfile($jardir, $debugger ? 'perl6-debug.jar' : 'perl6.jar')); + +my $preamble = $^O eq 'MSWin32' ? '@' : "#!/bin/sh +: \${NQP_DIR:=\"$nqpdir\"} +: \${NQP_JARS:=\"$nqpjars\"} +: \${PERL6_DIR:=\"$perl6dir\"} +: \${PERL6_JARS:=\"$perl6jars\"} +exec "; +my $postamble = $^O eq 'MSWin32' ? ' %*' : ' "$@"'; sub install { my ($name, $command) = @_; @@ -48,13 +59,8 @@ sub install { chmod 0755, $install_to if $^O ne 'MSWin32'; } -my $bootclasspath = join($cpsep, - ($thirdpartyjars, - File::Spec->catfile($jardir, 'rakudo-runtime.jar'), - File::Spec->catfile($jardir, $debugger ? 'perl6-debug.jar' : 'perl6.jar'))); - my $classpath = join($cpsep, ($jardir, $libdir, $nqplibdir)); -my $jopts = '-noverify -Xms100m -Xbootclasspath/a:' . $bootclasspath +my $jopts = '-noverify -Xms100m -Xbootclasspath/a:' . $perl6jars . ' -cp ' . ($^O eq 'MSWin32' ? '"%CLASSPATH%";' : '$CLASSPATH:') . $classpath . ' -Dperl6.prefix=' . $prefix . ' -Djna.library.path=' . $sharedir @@ -67,6 +73,4 @@ sub install { install "perl6-j", "java $jopts perl6"; install "perl6-jdb-server", "java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y $jopts perl6"; install "perl6-eval-server", "java -Xmx3000m -XX:MaxPermSize=200m $jopts org.perl6.nqp.tools.EvalServer"; - cp(File::Spec->catfile($nqpprefix,'bin','eval-client.pl'), '.') - or die "Couldn't copy 'eval-client.pl' from $nqpprefix: $!"; }