aboutsummaryrefslogtreecommitdiff
blob: cf5d4bd206e94a9edf5f6458739cddb0a9272ae8 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
diff --git a/Configure.pl b/Configure.pl
index 2064ac8..73e2d27 100755
--- a/Configure.pl
+++ b/Configure.pl
@@ -34,6 +34,7 @@ MAIN: {
                'no-clean',
                'with-parrot=s', 'gen-parrot:s', 'parrot-config=s', 'parrot-option=s@',
                'with-moar=s', 'gen-moar:s', 'moar-option=s@',
+               'with-asm=s', 'with-asm-tree=s', 'with-jline=s', 'with-jna=s',
                'make-install!', 'makefile-timing!',
                'git-protocol=s',
                'git-depth=s', 'git-reference=s',);
@@ -50,6 +51,53 @@ MAIN: {
               "Use --prefix to specify a directory in which parrot is installed.";
     }
 
+    if ($options{'with-asm'}) {
+        if ($options{'with-asm'} ne '-') {
+            $config{'asm'} = $options{'with-asm'};
+        }
+    } else {
+        $config{'asm'} = "3rdparty/asm/asm-4.1.jar";
+    }
+    if ($options{'with-asm-tree'}) {
+        if ($options{'with-asm-tree'} ne '-') {
+            $config{'asmtree'} = $options{'with-asm-tree'};
+        }
+    } else {
+        $config{'asmtree'} = "3rdparty/asm/asm-tree-4.1.jar";
+    }
+    if ($options{'with-jline'}) {
+        if ($options{'with-jline'} ne '-') {
+            $config{'jline'} = $options{'with-jline'};
+        }
+    } else {
+        $config{'jline'} = "3rdparty/jline/jline-1.0.jar";
+    }
+    if ($options{'with-jna'}) {
+        if ($options{'with-jna'} ne '-') {
+            $config{'jna'} = $options{'with-jna'};
+        }
+    } else {
+        $config{'jna'} = "3rdparty/jna/jna.jar";
+    }
+
+    if ($^O eq 'MSWin32') {
+        $config{'asmfile'} = $config{'asm'};
+        $config{'asmfile'} =~ s/.*\\//;
+        $config{'jlinefile'} = $config{'jline'};
+        $config{'jlinefile'} =~ s/.*\\//;
+    } else {
+        $config{'asmfile'} = $config{'asm'};
+        $config{'asmfile'} =~ s/.*\///;
+        $config{'jlinefile'} = $config{'jline'};
+        $config{'jlinefile'} =~ s/.*\///;
+    }
+
+    fill_template_file(
+        'tools/build/install-jvm-runner.pl.in',
+        'tools/build/install-jvm-runner.pl',
+        %config,
+    );
+
     my $default_backend;
     my @backends;
     my %backends;
@@ -357,6 +405,11 @@ General Options:
     --gen-moar         Download and build a copy of MoarVM to use
     --moar-option='--option=value'
                        Options to pass to MoarVM configuration for --gen-moar
+    --with-asm='/path/to/jar'
+    --with-asm-tree='/path/to/jar'
+    --with-jline='/path/to/jar'
+    --with-jna='/path/to/jar'
+                       Provide paths to already installed jars
     --git-protocol={ssh,https,git}
                        Protocol to use for git clone. Default: https
     --make-install     Immediately run `MAKE install` after configuring
diff --git a/tools/build/Makefile-JVM.in b/tools/build/Makefile-JVM.in
index 27959ad..c19965a 100644
--- a/tools/build/Makefile-JVM.in
+++ b/tools/build/Makefile-JVM.in
@@ -2,7 +2,6 @@ BAT    = @bat@
 JAVA   = java
 JAVAC  = javac
 JAR    = jar
-ASM    = 3rdparty/asm/
 J_RUNNER = nqp-j$(BAT)
 
 NQP_JAR_DIR = $(NQP_LANG_DIR)/runtime
@@ -18,7 +17,11 @@ RUNTIME_JAVAS = \
 
 RUNTIME_JAR = nqp-runtime.jar
 
-THIRDPARTY_JARS = $(ASM)asm-4.1.jar@cpsep@$(ASM)asm-tree-4.1.jar@cpsep@3rdparty/jline/jline-1.0.jar@cpsep@3rdparty/jna/jna.jar
+ASM = @asm@
+ASMTREE = @asmtree@
+JLINE = @jline@
+JNA = @jna@
+THIRDPARTY_JARS = $(ASM)@cpsep@$(ASMTREE)@cpsep@$(JLINE)@cpsep@$(JNA)
 J_STAGE0 = src/vm/jvm/stage0
 J_STAGE1 = $(JVM_BUILD_DIR)/stage1
 J_STAGE2 = $(JVM_BUILD_DIR)/stage2
@@ -80,8 +83,8 @@ j-install: j-all
 	$(MKPATH) $(DESTDIR)$(BIN_DIR)
 	$(MKPATH) $(DESTDIR)$(NQP_JAR_DIR)
 	$(MKPATH) $(DESTDIR)$(NQP_LIB_DIR)
-	$(CP) 3rdparty/asm/asm-4.1.jar 3rdparty/asm/asm-tree-4.1.jar  $(DESTDIR)$(NQP_JAR_DIR)
-	$(CP) 3rdparty/jline/jline-1.0.jar 3rdparty/jna/jna.jar $(DESTDIR)$(NQP_JAR_DIR)
+	$(CP) $(ASM) $(ASMTREE) $(DESTDIR)$(NQP_JAR_DIR)
+	$(CP) $(JLINE) $(JNA) $(DESTDIR)$(NQP_JAR_DIR)
 	$(CP) $(RUNTIME_JAR) $(DESTDIR)$(NQP_JAR_DIR)
 	$(CP) $(NQP_MO_JAR) $(MODULE_LOADER_JAR) $(DESTDIR)$(NQP_LIB_DIR)
 	$(CP) $(CORE_SETTING_JAR) $(QASTNODE_JAR) $(QREGEX_JAR) $(DESTDIR)$(NQP_LIB_DIR)
diff --git a/tools/build/install-jvm-runner.pl b/tools/build/install-jvm-runner.pl
deleted file mode 100644
index 14541d6..0000000
--- a/tools/build/install-jvm-runner.pl
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/perl
-# Copyright (C) 2013, The Perl Foundation.
-
-use strict;
-use warnings;
-use 5.008;
-use File::Spec;
-
-my ($destdir, $prefix) = @ARGV;
-my $realpath = $destdir.$prefix;
-
-unless (File::Spec->file_name_is_absolute($prefix)) {
-    $prefix = File::Spec->rel2abs($prefix);
-}
-
-if ($^O eq 'MSWin32') {
-    my $jar_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'runtime');
-    my $lib_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'lib');
-    my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j.bat');
-
-    open my $fh, ">", $install_to
-        or die "Could not open $install_to: $!";
-    print $fh '@java -Xss1m -Xmx512m -Xbootclasspath/a:' . $jar_dir . '\\nqp-runtime.jar;' .
-              "$jar_dir\\asm-4.1.jar;$jar_dir\\jline-1.0.jar;$lib_dir\\nqp.jar -cp $lib_dir nqp %*\n";
-    close $fh
-        or die "Could not close $install_to: $!";
-}
-else {
-    my $nqp_dir = File::Spec->catfile($prefix, qw/share nqp/);
-    my $jar_dir = File::Spec->catfile('${NQP_DIR}', 'runtime');
-    my $lib_dir = File::Spec->catfile('${NQP_DIR}', 'lib');
-    my $jars = "$jar_dir/nqp-runtime.jar:$jar_dir/asm-4.1.jar:$jar_dir/jline-1.0.jar:$lib_dir/nqp.jar";
-    my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j');
-
-    open my $fh, ">", $install_to
-        or die "Could not open $install_to: $!";
-    print $fh "#!/bin/sh\n";
-    print $fh ": \${NQP_DIR:=\"$nqp_dir\"}\n";
-    print $fh ": \${NQP_JARS:=\"$jars\"}\n";
-    print $fh "exec java -Xss1m -Xmx512m -Xbootclasspath/a:\${NQP_JARS} -cp $lib_dir nqp \"\$\@\"\n";
-    close $fh
-        or die "Could not close $install_to: $!";
-    chmod 0755, $install_to;
-}
diff --git a/tools/build/install-jvm-runner.pl.in b/tools/build/install-jvm-runner.pl.in
new file mode 100644
index 0000000..92a1109
--- /dev/null
+++ b/tools/build/install-jvm-runner.pl.in
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+# Copyright (C) 2013, The Perl Foundation.
+
+use strict;
+use warnings;
+use 5.008;
+use File::Spec;
+
+my ($destdir, $prefix) = @ARGV;
+my $realpath = $destdir.$prefix;
+
+unless (File::Spec->file_name_is_absolute($prefix)) {
+    $prefix = File::Spec->rel2abs($prefix);
+}
+
+if ($^O eq 'MSWin32') {
+    my $jar_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'runtime');
+    my $lib_dir = File::Spec->catfile($prefix, 'share', 'nqp', 'lib');
+    my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j.bat');
+
+    open my $fh, ">", $install_to
+        or die "Could not open $install_to: $!";
+    print $fh '@java -Xss1m -Xmx512m -Xbootclasspath/a:' . $jar_dir . '\\nqp-runtime.jar;' .
+              "$jar_dir\\@asmfile@;$jar_dir\\@jlinefile@;$lib_dir\\nqp.jar -cp $lib_dir nqp %*\n";
+    close $fh
+        or die "Could not close $install_to: $!";
+}
+else {
+    my $nqp_dir = File::Spec->catfile($prefix, qw/share nqp/);
+    my $jar_dir = File::Spec->catfile('${NQP_DIR}', 'runtime');
+    my $lib_dir = File::Spec->catfile('${NQP_DIR}', 'lib');
+    my $jars = "$jar_dir/nqp-runtime.jar:$jar_dir/@asmfile@:$jar_dir/@jlinefile@:$lib_dir/nqp.jar";
+    my $install_to = File::Spec->catfile($realpath, 'bin', 'nqp-j');
+
+    open my $fh, ">", $install_to
+        or die "Could not open $install_to: $!";
+    print $fh "#!/bin/sh\n";
+    print $fh ": \${NQP_DIR:=\"$nqp_dir\"}\n";
+    print $fh ": \${NQP_JARS:=\"$jars\"}\n";
+    print $fh "exec java -Xss1m -Xmx512m -Xbootclasspath/a:\${NQP_JARS} -cp $lib_dir nqp \"\$\@\"\n";
+    close $fh
+        or die "Could not close $install_to: $!";
+    chmod 0755, $install_to;
+}