Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #580 from rehsack/nom
add staging dir support for building
  • Loading branch information
moritz committed Nov 10, 2015
2 parents 326a744 + 253e633 commit fa50048
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 26 deletions.
15 changes: 11 additions & 4 deletions Configure.pl
Expand Up @@ -33,7 +33,8 @@

my %options;
GetOptions(\%options, 'help!', 'prefix=s',
'backends=s', 'no-clean!',
'sysroot=s', 'sdkroot=s',
'backends=s', 'no-clean!',
'gen-nqp:s',
'gen-moar:s', 'moar-option=s@',
'git-protocol=s',
Expand All @@ -51,9 +52,9 @@
}

unless (defined $options{prefix}) {
my $dir = getcwd;
print "ATTENTION: no --prefix supplied, building and installing to $dir/install\n";
$options{prefix} = 'install';
my $default = defined($options{sysroot}) ? '/usr' : File::Spec->catdir(getcwd, 'install');
print "ATTENTION: no --prefix supplied, building and installing to $default\n";
$options{prefix} = $default;
}
$options{prefix} = File::Spec->rel2abs($options{prefix});
my $prefix = $options{'prefix'};
Expand Down Expand Up @@ -123,6 +124,8 @@
}

$config{prefix} = $prefix;
$config{sdkroot} = $options{sdkroot};
$config{sysroot} = $options{sysroot};
$config{slash} = $slash;
$config{'makefile-timing'} = $options{'makefile-timing'};
$config{'stagestats'} = '--stagestats' if $options{'makefile-timing'};
Expand Down Expand Up @@ -221,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';

Expand Down Expand Up @@ -321,6 +325,9 @@ sub print_help {
General Options:
--help Show this text
--prefix=dir Install files in dir; also look for executables there
--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
--backends=jvm,moar
Which backend(s) to use (or ALL for all of them)
--gen-nqp[=branch]
Expand Down
14 changes: 9 additions & 5 deletions tools/build/Makefile-JVM.in
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions tools/build/Makefile-common.in
Expand Up @@ -8,6 +8,8 @@ CP = $(PERL) -MExtUtils::Command -e cp
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

Expand Down
34 changes: 19 additions & 15 deletions tools/build/create-jvm-runner.pl
Expand Up @@ -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) = @_;
Expand All @@ -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
Expand All @@ -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: $!";
}
7 changes: 5 additions & 2 deletions tools/lib/NQP/Configure.pm
Expand Up @@ -3,6 +3,7 @@ use strict;
use warnings;
use Cwd;
use File::Copy qw(copy);
use File::Spec qw();

use base qw(Exporter);
our @EXPORT_OK = qw(sorry slurp system_or_die
Expand Down Expand Up @@ -214,6 +215,7 @@ sub gen_nqp {
my $gen_nqp = $options{'gen-nqp'};
my $gen_moar = $options{'gen-moar'};
my $prefix = $options{'prefix'} || cwd().'/install';
my $sdkroot = $options{'sdkroot'} || '';
my $startdir = cwd();
my $git_protocol = $options{'git-protocol'} // 'https';
my @moar_options = @{ $options{'moar-option'} // [] };
Expand All @@ -223,7 +225,7 @@ sub gen_nqp {
for my $b (qw/jvm moar/) {
if ($backends =~ /$b/) {
my $postfix = substr $b, 0, 1;
my $bin = "$prefix/bin/nqp-$postfix$bat";
my $bin = File::Spec->catfile( $sdkroot, $prefix, 'bin', "nqp-$postfix$bat" );
$impls{$b}{bin} = $bin;
my %c = read_config($bin);
my $nqp_have = $c{'nqp::version'} || '';
Expand Down Expand Up @@ -289,13 +291,14 @@ sub gen_moar {
my %options = @_;

my $prefix = $options{'prefix'} || cwd()."/install";
my $sdkroot = $options{'sdkroot'} || '';
my $gen_moar = $options{'gen-moar'};
my @opts = @{ $options{'moar-option'} || [] };
push @opts, "--optimize";
my $startdir = cwd();
my $git_protocol = $options{'git-protocol'} || 'https';

my $moar_exe = "$prefix/bin/moar$exe";
my $moar_exe = File::Spec->catfile( $sdkroot, $prefix, 'bin', "moar$exe" );
my $moar_have = qx{ $moar_exe --version };
if ($moar_have) {
$moar_have = $moar_have =~ /version (\S+)/ ? $1 : undef;
Expand Down

0 comments on commit fa50048

Please sign in to comment.