Skip to content

Commit

Permalink
Clean up JVM runner creation script
Browse files Browse the repository at this point in the history
Now that we have PERL6_HOME we can make use of it!
  • Loading branch information
PatZim committed Sep 22, 2019
1 parent cdd57cd commit ff9272b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
26 changes: 12 additions & 14 deletions tools/build/create-jvm-runner.pl
Expand Up @@ -7,9 +7,9 @@
use File::Spec;
use File::Copy 'cp';

my $USAGE = "Usage: $0 <type> <destdir> <prefix> <nqp prefix> <blib> <third party jars>\n";
my $USAGE = "Usage: $0 <type> <destdir> <prefix> <nqp-home> <perl6-home> <blib> <third party jars>\n";

my ($type, $destdir, $prefix, $nqpprefix, $blib, $thirdpartyjars) = @ARGV
my ($type, $destdir, $prefix, $nqp_home, $perl6_home, $blib, $thirdpartyjars) = @ARGV
or die $USAGE;

my $debugger = 0;
Expand All @@ -23,16 +23,14 @@
my $cpsep = $^O eq 'MSWin32' ? ';' : ':';
my $bat = $^O eq 'MSWin32' ? '.bat' : '';

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 $nqplibdir = $^O eq 'MSWin32' ? File::Spec->catfile($nqp_home, 'lib') : File::Spec->catfile('${NQP_HOME}', 'lib');
my $nqpjars = $^O eq 'MSWin32' ? $thirdpartyjars : join( $cpsep, map { $_ =~ s,$nqp_home,\${NQP_HOME},g; $_ } split($cpsep, $thirdpartyjars) );
my $bindir = $type eq 'install' ? File::Spec->catfile($prefix, 'bin') : $prefix;
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 $jardir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $perl6_home : '${PERL6_HOME}', 'runtime') : $prefix;
my $libdir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $perl6_home : '${PERL6_HOME}', 'lib') : 'blib';
my $sharedir = File::Spec->catfile(
($type eq 'install' && $^O ne 'MSWin32' ? '$DIR/..' : $prefix),
'share', 'perl6', 'site', 'lib');
($type eq 'install' && $^O ne 'MSWin32' ? '${PERL6_HOME}' : 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'),
Expand Down Expand Up @@ -78,15 +76,15 @@

my $preamble = $^O eq 'MSWin32' ? '@' :
$type eq 'install'
? $preamble_unix . ": \${NQP_DIR:=\"\$DIR/../share/nqp\"}
? $preamble_unix . ": \${NQP_HOME=\"\$DIR/../share/nqp\"}
: \${NQP_JARS:=\"$nqpjars\"}
: \${PERL6_DIR:=\"\$DIR/../share/perl6\"}
: \${PERL6_HOME:=\"\$DIR/../share/perl6\"}
: \${PERL6_JARS:=\"$perl6jars\"}
exec "
: $preamble_unix . "$NQP_LIB
: \${NQP_DIR:=\"$nqpdir\"}
: \${NQP_HOME:=\"$nqp_home\"}
: \${NQP_JARS:=\"$nqpjars\"}
: \${PERL6_DIR:=\"$perl6dir\"}
: \${PERL6_HOME:=\"$prefix\"}
: \${PERL6_JARS:=\"$perl6jars\"}
exec ";
my $postamble = $^O eq 'MSWin32' ? ' %*' : ' "$@"';
Expand Down
6 changes: 3 additions & 3 deletions tools/templates/jvm/Makefile.in
Expand Up @@ -44,14 +44,14 @@ $(RUNTIME_JAR): $(RUNTIME_JAVAS)
@noecho@$(JAR) cf0 rakudo-runtime.jar -C bin@slash@ .

$(J_RUNNER): @@script(create-jvm-runner.pl)@@
$(PERL5) @shquot(@script(create-jvm-runner.pl)@)@ dev . . @q($(NQP_PREFIX))@ --nqp-lib=blib @q($(NQP_JARS))@
$(PERL5) @shquot(@script(create-jvm-runner.pl)@)@ dev . . @q($(NQP_HOME))@ @q($(PERL6_HOME))@ --nqp-lib=blib @q($(NQP_JARS))@

j-runner-default: j-all
$(CP) $(J_RUNNER) perl6$(J_BAT)
$(CHMOD) 755 perl6$(J_BAT)

@bpm(DEBUG_RUNNER)@: @@script(create-jvm-runner.pl)@@ @bsm(PERL6_DEBUG)@
$(PERL5) @shquot(@script(create-jvm-runner.pl)@)@ dev-debug . . @q($(NQP_PREFIX))@ --nqp-lib=blib @q($(NQP_JARS))@
$(PERL5) @shquot(@script(create-jvm-runner.pl)@)@ dev-debug . . @q($(NQP_HOME))@ @q($(PERL6_HOME))@ --nqp-lib=blib @q($(NQP_JARS))@

eval-client.pl:
$(CP) @nfpq($(SDKROOT)$(NQP_PREFIX)/bin/eval-client.pl)@ .
Expand Down Expand Up @@ -79,7 +79,7 @@ sometests: j-all
@$(J_HARNESS5_WITH_FUDGE) $(TESTFILES)

j-runner-default-install: j-install
$(PERL5) @shquot(@script(create-jvm-runner.pl)@)@ install @q($(DESTDIR))@ @q($(PREFIX))@ @q($(NQP_PREFIX))@ "" @q($(NQP_JARS))@
$(PERL5) @shquot(@script(create-jvm-runner.pl)@)@ install @q($(DESTDIR))@ @q($(PREFIX))@ @q($(NQP_HOME))@ @q($(PERL6_HOME))@ "" @q($(NQP_JARS))@
$(CP) @nfpq($(DESTDIR)$(PREFIX)/bin/perl6-j$(J_BAT))@ @nfpq($(DESTDIR)$(PREFIX)/bin/perl6$(J_BAT))@
$(CHMOD) 755 @nfpq($(DESTDIR)$(PREFIX)/bin/perl6$(J_BAT))@

Expand Down

0 comments on commit ff9272b

Please sign in to comment.