create-jvm-runner.pl (rakudo-2020.08.2) | : | create-jvm-runner.pl (rakudo-2020.09) | ||
---|---|---|---|---|
#!/usr/bin/perl | #!/usr/bin/perl | |||
# Copyright (C) 2013, The Perl Foundation. | # Copyright (C) 2013, The Perl Foundation. | |||
use strict; | use strict; | |||
use warnings; | use warnings; | |||
use 5.008; | use 5.008; | |||
use File::Spec; | use File::Spec; | |||
use File::Copy 'cp'; | use File::Copy 'cp'; | |||
use Cwd 'abs_path'; | use Cwd 'abs_path'; | |||
my $USAGE = "Usage: $0 <type> <destdir> <prefix> <nqp-home> <rakudo-home> <third party jars>\n"; | my $USAGE = "Usage: $0 <type> <basedir> <destdir> <prefix> <build-time-nqp-home> <nqp-home> <rakudo-home> <third party jars>\n"; | |||
my ($type, $destdir, $prefix, $static_nqp_home, $static_rakudo_home, $thirdparty jars) = @ARGV | my ($type, $basedir, $destdir, $prefix, $nqp_home, $static_nqp_home, $static_rak udo_home, $thirdpartyjars) = @ARGV | |||
or die $USAGE; | or die $USAGE; | |||
my $relocatable = $static_nqp_home eq '' && $static_rakudo_home eq ''; | my $relocatable = $static_nqp_home eq '' && $static_rakudo_home eq ''; | |||
my $debugger = 0; | my $debugger = 0; | |||
if ($type =~ /^(\w+)\-debug$/) { | if ($type =~ /^(\w+)\-debug$/) { | |||
$type = $1; | $type = $1; | |||
$debugger = 1; | $debugger = 1; | |||
} | } | |||
die "Invalid target type $type" unless $type eq 'dev' || $type eq 'install'; | die "Invalid target type $type" unless $type eq 'dev' || $type eq 'install'; | |||
my $cpsep = $^O eq 'MSWin32' ? ';' : ':'; | my $cpsep = $^O eq 'MSWin32' ? ';' : ':'; | |||
my $bat = $^O eq 'MSWin32' ? '.bat' : ''; | my $bat = $^O eq 'MSWin32' ? '.bat' : ''; | |||
my $nqplibdir = $^O eq 'MSWin32' ? File::Spec->catfile($static_nqp_home, 'lib') : File::Spec->catfile('${NQP_HOME}', 'lib'); | my $nqplibdir = $^O eq 'MSWin32' ? File::Spec->catfile($static_nqp_home, 'lib') : File::Spec->catfile('${NQP_HOME}', 'lib'); | |||
my $nqpjars; | my $nqpjars; | |||
if ($^O eq 'MSWin32' || !$relocatable) { | if ($^O eq 'MSWin32' || $type ne 'install') { | |||
$nqpjars = $thirdpartyjars; | $nqpjars = $thirdpartyjars; | |||
} | } | |||
elsif ($relocatable) { | else { | |||
# The following is a workaround turning the third-party JARS into relative | ||||
# paths. The clean solution would be to pass in relative paths and only | ||||
# prefix those with ${NQP_HOME} here. | ||||
my @thirdpartyjars = map { abs_path($_) } split($cpsep, $thirdpartyjars); | my @thirdpartyjars = map { abs_path($_) } split($cpsep, $thirdpartyjars); | |||
my $nqp_home = abs_path(File::Spec->catpath($prefix, 'share', 'nqp')); | ||||
@thirdpartyjars = map { $_ =~ s,$nqp_home,\${NQP_HOME},; $_ } @thirdparty jars; | @thirdpartyjars = map { $_ =~ s,$nqp_home,\${NQP_HOME},; $_ } @thirdparty jars; | |||
$nqpjars = join($cpsep, @thirdpartyjars); | $nqpjars = join($cpsep, @thirdpartyjars); | |||
} | } | |||
my $bindir = $type eq 'install' ? File::Spec->catfile($prefix, 'bin') : $prefix; | my $bindir = $type eq 'install' ? File::Spec->catfile($prefix, 'bin') : $prefix; | |||
my $jardir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $static _rakudo_home : '${RAKUDO_HOME}', 'runtime') : $prefix; | my $jardir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $static _rakudo_home : '${RAKUDO_HOME}', 'runtime') : $prefix; | |||
my $libdir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $static _rakudo_home : '${RAKUDO_HOME}', 'lib') : 'blib'; | my $libdir = $type eq 'install' ? File::Spec->catfile($^O eq 'MSWin32' ? $static _rakudo_home : '${RAKUDO_HOME}', 'lib') : 'blib'; | |||
my $sharedir = File::Spec->catfile( | my $sharedir = File::Spec->catfile( | |||
($type eq 'install' && $^O ne 'MSWin32' ? '${RAKUDO_HOME}' : File::Spec->cat file($prefix, 'share', 'perl6') ), | ($type eq 'install' && $^O ne 'MSWin32' ? '${RAKUDO_HOME}' : File::Spec->cat file($prefix, 'share', 'perl6') ), | |||
'site', 'lib'); | 'site', 'lib'); | |||
skipping to change at line 99 | skipping to change at line 101 | |||
my $preamble; | my $preamble; | |||
if ($^O eq 'MSWin32') { | if ($^O eq 'MSWin32') { | |||
$preamble = '@'; | $preamble = '@'; | |||
} | } | |||
elsif ($type eq 'install') { | elsif ($type eq 'install') { | |||
if ($relocatable) { | if ($relocatable) { | |||
$preamble = join("\n", | $preamble = join("\n", | |||
$preamble_unix, | $preamble_unix, | |||
": \${NQP_HOME:=\"\$DIR/../share/nqp\"}", | ": \${NQP_HOME:=\"\$DIR/../share/nqp\"}", | |||
": \${NQP_JARS:=\"$nqpjars\"}", | ": \${NQP_JARS:=\"$nqpjars\"}", | |||
": \${RAKUDO_HOME:=\"\$PERL6_HOME\"}", | ||||
": \${RAKUDO_HOME:=\"\$DIR/../share/perl6\"}", | ": \${RAKUDO_HOME:=\"\$DIR/../share/perl6\"}", | |||
": \${RAKUDO_JARS:=\"$rakudo_jars\"}", | ": \${RAKUDO_JARS:=\"$rakudo_jars\"}", | |||
"exec " | "exec " | |||
); | ); | |||
} | } | |||
else { | else { | |||
$preamble = join("\n", | $preamble = join("\n", | |||
$preamble_unix, | $preamble_unix, | |||
": \${NQP_HOME:=\"$static_nqp_home\"}", | ": \${NQP_HOME:=\"$static_nqp_home\"}", | |||
": \${NQP_JARS:=\"$nqpjars\"}", | ": \${NQP_JARS:=\"$nqpjars\"}", | |||
": \${RAKUDO_HOME:=\"\$PERL6_HOME\"}", | ||||
": \${RAKUDO_HOME:=\"$static_rakudo_home\"}", | ": \${RAKUDO_HOME:=\"$static_rakudo_home\"}", | |||
": \${RAKUDO_JARS:=\"$rakudo_jars\"}", | ": \${RAKUDO_JARS:=\"$rakudo_jars\"}", | |||
"exec " | "exec " | |||
); | ); | |||
} | } | |||
} | } | |||
else { | else { | |||
# Hack: Explicitly set a dummy RAKUDO_HOME, so the autogenerated | ||||
# CompUnitRepo folder structure does not end up in the build directories | ||||
# parent folder. | ||||
my $rakudo_home = "$basedir/gen/build_rakudo_home"; | ||||
$preamble = join("\n", | $preamble = join("\n", | |||
$preamble_unix, | $preamble_unix, | |||
"$NQP_LIB", | "$NQP_LIB", | |||
": \${NQP_HOME:=\"$static_nqp_home\"}", | "NQP_HOME=\"$nqp_home\"", | |||
": \${NQP_JARS:=\"$nqpjars\"}", | ": \${NQP_JARS:=\"$nqpjars\"}", | |||
": \${RAKUDO_HOME:=\"$prefix\"}", | "RAKUDO_HOME=\"$rakudo_home\"", | |||
": \${RAKUDO_JARS:=\"$rakudo_jars\"}", | ": \${RAKUDO_JARS:=\"$rakudo_jars\"}", | |||
"exec " | "exec " | |||
); | ); | |||
} | } | |||
my $postamble = $^O eq 'MSWin32' ? ' %*' : ' "$@"'; | my $postamble = $^O eq 'MSWin32' ? ' %*' : ' "$@"'; | |||
sub install { | sub install { | |||
my ($name, $command) = @_; | my ($name, $command) = @_; | |||
End of changes. 10 change blocks. | ||||
7 lines changed or deleted | 16 lines changed or added |