-
Notifications
You must be signed in to change notification settings - Fork 130
/
gen-jvm-properties.pl
executable file
·57 lines (46 loc) · 1.66 KB
/
gen-jvm-properties.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env perl
# Copyright (C) 2008-2011, The Perl Foundation.
use strict;
use warnings;
use v5.10;
use Config;
use File::Spec;
binmode STDOUT, ':utf8';
my ($prefix, $nqp_home, $thirdPartyJars) = @ARGV;
my $cpsep = $^O eq 'MSWin32' ? ';' : ':';
my $jardir = ".";
my $libdir = ".";
my $slash = File::Spec->catdir('', '');
if ($prefix ne '.') {
$jardir = File::Spec->catdir($nqp_home, 'runtime');
$libdir = File::Spec->catdir($nqp_home, 'lib');
my @jars = grep { s/^.*\Q${slash}\E// } split($cpsep, $thirdPartyJars);
$thirdPartyJars = join($cpsep, grep { s/^/${jardir}${slash}/ } @jars);
}
$thirdPartyJars .= "${cpsep}${jardir}${slash}nqp-runtime.jar${cpsep}${libdir}${slash}nqp.jar";
s/\\/\\\\/g for ($prefix, $thirdPartyJars, $libdir);
# We extract information from Perl's config to know how to compile shared
# libraries (which is needed for nativecall stuff). If this has to be tweaked
# in the future, I found this to be an invaluable reference:
# http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary
my $ccdlflags = "$Config{cccdlflags} $Config{ccdlflags}";
my $ldout = $^O eq 'MSWin32'? '-out:' : '-o';
print <<"END";
# This file automatically generated by $0
prefix=${prefix}
runtime.bootclasspath=-Xbootclasspath/a:.${cpsep}${thirdPartyJars}
runtime.classpath=${libdir}
runtime.jars=${thirdPartyJars}
nativecall.o=$Config{_o}
nativecall.so=$Config{so}
nativecall.cc=$Config{cc}
nativecall.ccflags=$Config{ccflags}
nativecall.ccdlflags=$ccdlflags
nativecall.ld=$Config{ld}
nativecall.ldout=$ldout
nativecall.ldflags=$Config{ldflags}
nativecall.lddlflags=$Config{lddlflags}
nativecall.libs=$Config{libs}
nativecall.perllibs=$Config{perllibs}
osname=$^O
END