-
-
Save MasterDuke17/d9ffae718e86ec3fe6f7e532f78aba5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --cc Configure.pl | |
index e1dfc0f0d,a07916e9b..000000000 | |
--- a/Configure.pl | |
+++ b/Configure.pl | |
@@@ -80,61 -46,265 +80,96 @@@ MAIN: | |
print_help(); | |
exit(0); | |
} | |
- if ($options{'ignore-errors'}) { | |
- print "===WARNING!===\nErrors are being ignored.\nIn the case of any errors the script may behave unexpectedly.\n"; | |
+ if ( $cfg->opt('ignore-errors') ) { | |
+"===WARNING!===\nErrors are being ignored.\nIn the case of any errors the script may behave unexpectedly.\n"; | |
} | |
- if ($options{'with-truffle-dsl-processor'}) { | |
- if ($options{'with-truffle-dsl-processor'} ne '-') { | |
- $config{'truffledslprocessor'} = $options{'with-truffle-dsl-processor'}; | |
- if ($options{'with-asm'}) { | |
- if ($options{'with-asm'} ne '-') { | |
- $config{'asm'} = $options{'with-asm'}; | |
++ if ($cfg->opt('with-asm')) { | |
++ if ($cfg->opt('with-asm') ne '-') { | |
++ $cfg->set('asm', $cfg->opt('with-asm')); | |
} | |
} else { | |
- $config{'truffledslprocessor'} = "3rdparty/truffle/truffle-dsl-processor-1.0.0-rc1.jar"; | |
- $config{'asm'} = "3rdparty/asm/asm-4.1.jar"; | |
++ $cfg->set('asm', "3rdparty/asm/asm-4.1.jar"); | |
+ } | |
- if ($options{'with-asm-tree'}) { | |
- if ($options{'with-asm-tree'} ne '-') { | |
- $config{'asmtree'} = $options{'with-asm-tree'}; | |
++ if ($cfg->opt('with-asm-tree')) { | |
++ if ($cfg->opt('with-asm-tree') ne '-') { | |
++ $cfg->set('asmtree', $cfg->opt('with-asm-tree')); | |
+ } | |
+ } else { | |
- $config{'asmtree'} = "3rdparty/asm/asm-tree-4.1.jar"; | |
++ $cfg->set('asmtree', "3rdparty/asm/asm-tree-4.1.jar"); | |
+ } | |
- if ($options{'with-jline'}) { | |
- if ($options{'with-jline'} ne '-') { | |
- $config{'jline'} = $options{'with-jline'}; | |
++ if ($cfg->opt('with-jline')) { | |
++ if ($cfg->opt('with-jline') ne '-') { | |
++ $cfg->set('jline', $cfg->opt('with-jline')); | |
+ } | |
+ } else { | |
- $config{'jline'} = "3rdparty/jline/jline-1.0.jar"; | |
++ $cfg->set('jline', "3rdparty/jline/jline-1.0.jar"); | |
+ } | |
- if ($options{'with-jna'}) { | |
- if ($options{'with-jna'} ne '-') { | |
- $config{'jna'} = $options{'with-jna'}; | |
++ if ($cfg->opt('with-jna')) { | |
++ if ($cfg->opt('with-jna') ne '-') { | |
++ $cfg->set('jna', $cfg->opt('with-jna')); | |
+ } | |
+ } else { | |
- $config{'jna'} = "3rdparty/jna/jna-4.0.0.jar"; | |
++ $cfg->set('jna', "3rdparty/jna/jna-4.0.0.jar"); | |
+ } | |
- if ($options{'with-truffle-api'}) { | |
- if ($options{'with-truffle-api'} ne '-') { | |
- $config{'truffleapi'} = $options{'with-truffle-api'}; | |
++ if ($cfg->opt('with-truffle-api')) { | |
++ if ($cfg->opt('with-truffle-api') ne '-') { | |
++ $cfg->set('truffleapi', $cfg->opt('with-truffle-api')); | |
+ } | |
+ } else { | |
- $config{'truffleapi'} = "3rdparty/truffle/truffle-api-1.0.0-rc3.jar"; | |
++ $cfg->set('truffleapi', "3rdparty/truffle/truffle-api-1.0.0-rc3.jar"); | |
+ } | |
- if ($options{'with-truffle-dsl-processor'}) { | |
- if ($options{'with-truffle-dsl-processor'} ne '-') { | |
- $config{'truffledslprocessor'} = $options{'with-truffle-dsl-processor'}; | |
++ if ($cfg->opt('with-truffle-dsl-processor')) { | |
++ if ($cfg->opt('with-truffle-dsl-processor') ne '-') { | |
++ $cfg->set('truffledslprocessor', $cfg->opt('with-truffle-dsl-processor')); | |
+ } | |
+ } else { | |
- $config{'truffledslprocessor'} = "3rdparty/truffle/truffle-dsl-processor-1.0.0-rc3.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/.*\///; | |
++ $cfg->set('truffledslprocessor', "3rdparty/truffle/truffle-dsl-processor-1.0.0-rc3.jar"); | |
} | |
- fill_template_file( | |
- 'tools/build/install-jvm-runner.pl.in', | |
- 'tools/build/install-jvm-runner.pl', | |
- %config, | |
- ); | |
+ $cfg->configure_paths; | |
+ $cfg->configure_from_options; | |
+ $cfg->configure_relocatability; | |
+ $cfg->configure_repo_urls; | |
+ $cfg->configure_commands; | |
+ $cfg->configure_jars; | |
+ $cfg->configure_refine_vars; | |
+ $cfg->configure_backends; | |
+ $cfg->configure_misc; | |
- my $default_backend; | |
- my @backends; | |
- my %backends; | |
- if ($options{backends}) { | |
- $options{backends} = join ',', @known_backends if lc($options{backends}) eq 'all'; | |
- for my $be (split /,/, $options{backends}) { | |
- $be = lc $be; | |
- unless ($known_backends{$be}) { | |
- die "Unknown backend: '$be'; Known backends: " . | |
- join(', ', sort keys %known_backends) . "\n"; | |
- } | |
- $default_backend ||= $be; | |
- push @backends, $be unless $backends{$be}; | |
- $backends{$be} = 1; | |
- } | |
- } | |
- if (defined $options{'gen-moar'}) { | |
- push @backends, 'moar' unless $backends{moar}; | |
- $backends{moar} = 1; | |
- $default_backend ||= 'moar'; | |
- } | |
- unless (%backends) { | |
- # TODO: come up with more sensible defaults | |
- $backends{moar} = 1; | |
- push @backends, 'moar'; | |
- $default_backend = 'moar'; | |
- } | |
- if ($backends{js} and !$backends{moar}) { | |
- sorry($options{'ignore-errors'}, "When building the js backend you must also build moar\nPlease build with --backends=moar,js\n"); | |
- } | |
- | |
- # XXX mkpath instead? | |
- mkdir($options{'prefix'}) if $options{'prefix'} && $^O =~ /Win32/ && !-d $options{'prefix'}; | |
- my $prefix = $options{'prefix'} | |
- ? abs_path($options{'prefix'}) | |
- : ($options{sysroot} | |
- ? '/usr' | |
- : File::Spec->catdir(cwd, 'install')); | |
- $config{prefix} = $prefix; | |
- $config{nqplibdir} = $options{libdir} ? "$options{libdir}/nqp" : '$(NQP_LANG_DIR)/lib'; | |
- $config{sysroot} = $options{sysroot}; | |
- $config{sdkroot} = $options{sdkroot}; | |
+ # XXX Why Windows only? | |
+ my $prefix = $cfg->cfg('prefix'); | |
+ mkpath($prefix) | |
+ if $prefix && $cfg->is_win && !-d $prefix; | |
# Save options in config.status | |
- unlink('config.status'); | |
- if (open(my $CONFIG_STATUS, '>', 'config.status')) { | |
- print $CONFIG_STATUS | |
- "$^X Configure.pl $config{'nqp_config_status'} \$*\n"; | |
- close($CONFIG_STATUS); | |
- } | |
- $config{'makefile-timing'} = $options{'makefile-timing'}; | |
- $config{'stagestats'} = '--stagestats' if $options{'makefile-timing'}; | |
- my $shell = $^O eq 'MSWin32' ? 'cmd' : 'sh'; | |
- $config{'shell'} = $^O eq 'solaris' ? '' : "SHELL = $shell"; | |
- $config{'bat'} = $^O eq 'MSWin32' ? '.bat' : ''; | |
- $config{'cpsep'} = $^O eq 'MSWin32' ? ';' : ':'; | |
- $config{'slash'} = $slash; | |
- | |
- open my $MAKEFILE, '>', 'Makefile' | |
- or die "Cannot open 'Makefile' for writing: $!"; | |
- | |
- my @prefixes = map { $prefixes{$_} } @backends; | |
- print $MAKEFILE "\n# Makefile code generated by Configure.pl:\n"; | |
- | |
- my $launcher = $prefixes{$default_backend} . '-runner-default'; | |
- print $MAKEFILE "all: ", join(' ', map("$_-all", @prefixes), $launcher), "\n"; | |
- print $MAKEFILE "install: ", join(' ', map("$_-install", @prefixes), $launcher . '-install'), "\n"; | |
- for my $t (qw/clean test qregex-test/) { | |
- print $MAKEFILE "$t: ", join(' ', map "$_-$t", @prefixes), "\n"; | |
- } | |
- | |
+ $cfg->save_config_status unless $cfg->has_option('expand'); | |
- fill_template_file( | |
- 'tools/build/Makefile-common.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
+ $cfg->configure_active_backends; | |
- if ($backends{moar}) { | |
- my @errors; | |
- my ($moar_want) = split(' ', slurp('tools/build/MOAR_REVISION')); | |
- my ($moar_path, @moar_errors) = gen_moar($moar_want, %config, %options); | |
- if (!$moar_path) { | |
- push @errors, | |
- "No suitable MoarVM (moar executable) found using the --prefix\n" . | |
- "(You can get a MoarVM built automatically with --gen-moar.)"; | |
- unshift @errors, @moar_errors if @moar_errors; | |
- } | |
- sorry($options{'ignore-errors'}, @errors) if @errors; | |
- # If we ignore errors, normally we'd print out the @moar_errors elsewhere | |
- # so make sure to print them out now. Don't print unless errors are ignored | |
- print join("\n", '', @moar_errors, "\n") if @moar_errors and $options{'ignore-errors'}; | |
- $config{'make'} = `$moar_path --libpath="src/vm/moar/stage0" "src/vm/moar/stage0/nqp.moarvm" -e "print(nqp::backendconfig()<make>)"` | |
- || 'make'; | |
- $config{moar} = $moar_path; | |
- $config{moar_prefix} = File::Spec->catpath((File::Spec->splitpath($moar_path))[0, 1], File::Spec->updir); | |
- fill_template_file( | |
- 'tools/build/Makefile-Moar.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
- } | |
+ $cfg->expand_template; | |
- if ($backends{js}) { | |
- system_or_die($config{moar}, '--libpath=src/vm/moar/stage0', 'src/vm/moar/stage0/nqp.moarvm', 'tools/build/gen-js-makefile.nqp', 'gen/js/Makefile-JS.in'); | |
- $config{'make'} = $^O eq 'MSWin32' ? 'nmake' : 'make'; | |
- $config{link} = $options{link}; | |
- my $node = probe_node(); | |
- | |
- if ($node eq 'nodejs') { | |
- sorry($options{'ignore-errors'}, 'You have a broken node.js. Please install node.js as node instead of nodejs.') | |
- } | |
- elsif (!$node) { | |
- sorry($options{'ignore-errors'}, "You don't have node.js. Please install node.js."); | |
- } | |
- | |
- fill_template_file( | |
- 'gen/js/Makefile-JS.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
- } | |
- | |
- if ($backends{jvm}) { | |
- my @errors; | |
- | |
- my $got; | |
- if (!@errors) { | |
- my @jvm_info = `java -showversion 2>&1`; | |
- my $jvm_found = 0; | |
- my $jvm_ok = 0; | |
- for (@jvm_info) { | |
- print "got: $_"; | |
- if (/(?:java|jdk) version "(\d+)(?:\.(\d+))?/) { | |
- $jvm_found = 1; | |
- if ($1 > 1 || $1 == 1 && $2 >= 8) { | |
- $jvm_ok = 1; | |
- } | |
- $got = $_; | |
- last; | |
- } | |
- } | |
- | |
- if (!$jvm_found) { | |
- push @errors, | |
- "No JVM (java executable) in path; cannot continue"; | |
- } | |
- elsif (!$jvm_ok) { | |
- push @errors, | |
- "Need at least JVM 1.8 (got $got)"; | |
+ unless ( $cfg->opt('expand') ) { | |
+ my $make = $cfg->cfg('make'); | |
+ unless ( $cfg->opt('no-clean') ) { | |
+ no warnings; | |
+ print "Cleaning up ...\n"; | |
+ if ( open my $CLEAN, '-|', "$make clean" ) { | |
+ my @slurp = <$CLEAN>; | |
+ close($CLEAN); | |
} | |
} | |
- sorry($options{'ignore-errors'}, @errors) if @errors; | |
- print "Using $got\n"; | |
- | |
- $config{'make'} = $^O eq 'MSWin32' ? 'nmake' : 'make'; | |
- $config{'runner'} = $^O eq 'MSWin32' ? 'nqp.bat' : 'nqp'; | |
- | |
- fill_template_file( | |
- 'tools/build/Makefile-JVM.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
- } | |
- | |
- my $ext = ''; | |
- if ($^O eq 'MSWin32') { | |
- $ext = '.bat'; | |
- } | |
- | |
- print $MAKEFILE qq[t/*/*.t: all\n\tprove -r -v --exec ./nqp$ext \$\@\n]; | |
- | |
- close $MAKEFILE | |
- or die "Error while writing to 'Makefile': $!"; | |
- | |
- my $make = fill_template_text('@make@', %config); | |
- unless ($options{'no-clean'}) { | |
- no warnings; | |
- print "Cleaning up ...\n"; | |
- if (open my $CLEAN, '-|', "$make clean") { | |
- my @slurp = <$CLEAN>; | |
- close($CLEAN); | |
+ if ( $cfg->opt('make-install') ) { | |
+ system_or_die($make); | |
+ system_or_die( $make, 'install' ); | |
+ print "\nNQP has been built and installed.\n"; | |
+ } | |
+ else { | |
+ print "You can now use '$make' to build NQP.\n"; | |
+ print "After that, '$make test' will run some tests and\n"; | |
+ print "'$make install' will install NQP.\n"; | |
} | |
- } | |
- | |
- if ($options{'make-install'}) { | |
- system_or_die($make); | |
- system_or_die($make, 'install'); | |
- print "\nNQP has been built and installed.\n"; | |
- } | |
- else { | |
- print "You can now use '$make' to build NQP.\n"; | |
- print "After that, '$make test' will run some tests and\n"; | |
- print "'$make install' will install NQP.\n"; | |
} | |
exit 0; | |
diff --git a/tools/templates/jvm/Makefile.in b/tools/templates/jvm/Makefile.in | |
index 9b50f8cad..0a1e21e16 100644 | |
--- a/tools/templates/jvm/Makefile.in | |
+++ b/tools/templates/jvm/Makefile.in | |
@@ -130,7 +130,7 @@ j-install: j-all | |
$(RUNTIME_JAR): $(RUNTIME_JAVAS) @mkquot(@script(gen-jvm-properties.pl)@)@ | |
$(PERL5) -MExtUtils::Command -e mkpath bin | |
- $(JAVAC) --release 9 -cp @q($(THIRDPARTY_JARS))@ -g -d bin -encoding UTF8 $(RUNTIME_JAVAS) | |
+ $(JAVAC) -cp @q($(THIRDPARTY_JARS))@ -g -d bin -encoding UTF8 $(RUNTIME_JAVAS) | |
$(PERL5) @shquot(@script(gen-jvm-properties.pl)@)@ . @q($(THIRDPARTY_JARS))@ > jvmconfig.properties | |
$(PERL5) @shquot(@script(gen-jvm-properties.pl)@)@ @nfpq(@prefix@)@ @q($(THIRDPARTY_JARS))@ > @nfpq(bin/jvmconfig.properties)@ | |
$(JAR) cf0 nqp-runtime.jar -C @nfp(bin/)@ . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --cc Configure.pl | |
index e1dfc0f0d,a07916e9b..000000000 | |
--- a/Configure.pl | |
+++ b/Configure.pl | |
@@@ -80,61 -46,265 +80,101 @@@ MAIN: | |
print_help(); | |
exit(0); | |
} | |
++<<<<<<< HEAD | |
+ if ( $cfg->opt('ignore-errors') ) { | |
+"===WARNING!===\nErrors are being ignored.\nIn the case of any errors the script may behave unexpectedly.\n"; | |
++======= | |
+ if ($options{'ignore-errors'}) { | |
+ print "===WARNING!===\nErrors are being ignored.\nIn the case of any errors the script may behave unexpectedly.\n"; | |
+ } | |
+ 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-4.0.0.jar"; | |
+ } | |
+ if ($options{'with-truffle-api'}) { | |
+ if ($options{'with-truffle-api'} ne '-') { | |
+ $config{'truffleapi'} = $options{'with-truffle-api'}; | |
+ } | |
+ } else { | |
+ $config{'truffleapi'} = "3rdparty/truffle/truffle-api-1.0.0-rc3.jar"; | |
++>>>>>>> [truffle] Update truffle dependency jars | |
} | |
if ($options{'with-truffle-dsl-processor'}) { | |
if ($options{'with-truffle-dsl-processor'} ne '-') { | |
$config{'truffledslprocessor'} = $options{'with-truffle-dsl-processor'}; | |
} | |
} else { | |
- $config{'truffledslprocessor'} = "3rdparty/truffle/truffle-dsl-processor-1.0.0-rc1.jar"; | |
+ $config{'truffledslprocessor'} = "3rdparty/truffle/truffle-dsl-processor-1.0.0-rc3.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, | |
- ); | |
+ $cfg->configure_paths; | |
+ $cfg->configure_from_options; | |
+ $cfg->configure_relocatability; | |
+ $cfg->configure_repo_urls; | |
+ $cfg->configure_commands; | |
+ $cfg->configure_jars; | |
+ $cfg->configure_refine_vars; | |
+ $cfg->configure_backends; | |
+ $cfg->configure_misc; | |
- my $default_backend; | |
- my @backends; | |
- my %backends; | |
- if ($options{backends}) { | |
- $options{backends} = join ',', @known_backends if lc($options{backends}) eq 'all'; | |
- for my $be (split /,/, $options{backends}) { | |
- $be = lc $be; | |
- unless ($known_backends{$be}) { | |
- die "Unknown backend: '$be'; Known backends: " . | |
- join(', ', sort keys %known_backends) . "\n"; | |
- } | |
- $default_backend ||= $be; | |
- push @backends, $be unless $backends{$be}; | |
- $backends{$be} = 1; | |
- } | |
- } | |
- if (defined $options{'gen-moar'}) { | |
- push @backends, 'moar' unless $backends{moar}; | |
- $backends{moar} = 1; | |
- $default_backend ||= 'moar'; | |
- } | |
- unless (%backends) { | |
- # TODO: come up with more sensible defaults | |
- $backends{moar} = 1; | |
- push @backends, 'moar'; | |
- $default_backend = 'moar'; | |
- } | |
- if ($backends{js} and !$backends{moar}) { | |
- sorry($options{'ignore-errors'}, "When building the js backend you must also build moar\nPlease build with --backends=moar,js\n"); | |
- } | |
- | |
- # XXX mkpath instead? | |
- mkdir($options{'prefix'}) if $options{'prefix'} && $^O =~ /Win32/ && !-d $options{'prefix'}; | |
- my $prefix = $options{'prefix'} | |
- ? abs_path($options{'prefix'}) | |
- : ($options{sysroot} | |
- ? '/usr' | |
- : File::Spec->catdir(cwd, 'install')); | |
- $config{prefix} = $prefix; | |
- $config{nqplibdir} = $options{libdir} ? "$options{libdir}/nqp" : '$(NQP_LANG_DIR)/lib'; | |
- $config{sysroot} = $options{sysroot}; | |
- $config{sdkroot} = $options{sdkroot}; | |
+ # XXX Why Windows only? | |
+ my $prefix = $cfg->cfg('prefix'); | |
+ mkpath($prefix) | |
+ if $prefix && $cfg->is_win && !-d $prefix; | |
# Save options in config.status | |
- unlink('config.status'); | |
- if (open(my $CONFIG_STATUS, '>', 'config.status')) { | |
- print $CONFIG_STATUS | |
- "$^X Configure.pl $config{'nqp_config_status'} \$*\n"; | |
- close($CONFIG_STATUS); | |
- } | |
- $config{'makefile-timing'} = $options{'makefile-timing'}; | |
- $config{'stagestats'} = '--stagestats' if $options{'makefile-timing'}; | |
- my $shell = $^O eq 'MSWin32' ? 'cmd' : 'sh'; | |
- $config{'shell'} = $^O eq 'solaris' ? '' : "SHELL = $shell"; | |
- $config{'bat'} = $^O eq 'MSWin32' ? '.bat' : ''; | |
- $config{'cpsep'} = $^O eq 'MSWin32' ? ';' : ':'; | |
- $config{'slash'} = $slash; | |
- | |
- open my $MAKEFILE, '>', 'Makefile' | |
- or die "Cannot open 'Makefile' for writing: $!"; | |
- | |
- my @prefixes = map { $prefixes{$_} } @backends; | |
- print $MAKEFILE "\n# Makefile code generated by Configure.pl:\n"; | |
- | |
- my $launcher = $prefixes{$default_backend} . '-runner-default'; | |
- print $MAKEFILE "all: ", join(' ', map("$_-all", @prefixes), $launcher), "\n"; | |
- print $MAKEFILE "install: ", join(' ', map("$_-install", @prefixes), $launcher . '-install'), "\n"; | |
- for my $t (qw/clean test qregex-test/) { | |
- print $MAKEFILE "$t: ", join(' ', map "$_-$t", @prefixes), "\n"; | |
- } | |
- | |
+ $cfg->save_config_status unless $cfg->has_option('expand'); | |
- fill_template_file( | |
- 'tools/build/Makefile-common.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
+ $cfg->configure_active_backends; | |
- if ($backends{moar}) { | |
- my @errors; | |
- my ($moar_want) = split(' ', slurp('tools/build/MOAR_REVISION')); | |
- my ($moar_path, @moar_errors) = gen_moar($moar_want, %config, %options); | |
- if (!$moar_path) { | |
- push @errors, | |
- "No suitable MoarVM (moar executable) found using the --prefix\n" . | |
- "(You can get a MoarVM built automatically with --gen-moar.)"; | |
- unshift @errors, @moar_errors if @moar_errors; | |
- } | |
- sorry($options{'ignore-errors'}, @errors) if @errors; | |
- # If we ignore errors, normally we'd print out the @moar_errors elsewhere | |
- # so make sure to print them out now. Don't print unless errors are ignored | |
- print join("\n", '', @moar_errors, "\n") if @moar_errors and $options{'ignore-errors'}; | |
- $config{'make'} = `$moar_path --libpath="src/vm/moar/stage0" "src/vm/moar/stage0/nqp.moarvm" -e "print(nqp::backendconfig()<make>)"` | |
- || 'make'; | |
- $config{moar} = $moar_path; | |
- $config{moar_prefix} = File::Spec->catpath((File::Spec->splitpath($moar_path))[0, 1], File::Spec->updir); | |
- fill_template_file( | |
- 'tools/build/Makefile-Moar.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
- } | |
+ $cfg->expand_template; | |
- if ($backends{js}) { | |
- system_or_die($config{moar}, '--libpath=src/vm/moar/stage0', 'src/vm/moar/stage0/nqp.moarvm', 'tools/build/gen-js-makefile.nqp', 'gen/js/Makefile-JS.in'); | |
- $config{'make'} = $^O eq 'MSWin32' ? 'nmake' : 'make'; | |
- $config{link} = $options{link}; | |
- my $node = probe_node(); | |
- | |
- if ($node eq 'nodejs') { | |
- sorry($options{'ignore-errors'}, 'You have a broken node.js. Please install node.js as node instead of nodejs.') | |
- } | |
- elsif (!$node) { | |
- sorry($options{'ignore-errors'}, "You don't have node.js. Please install node.js."); | |
- } | |
- | |
- fill_template_file( | |
- 'gen/js/Makefile-JS.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
- } | |
- | |
- if ($backends{jvm}) { | |
- my @errors; | |
- | |
- my $got; | |
- if (!@errors) { | |
- my @jvm_info = `java -showversion 2>&1`; | |
- my $jvm_found = 0; | |
- my $jvm_ok = 0; | |
- for (@jvm_info) { | |
- print "got: $_"; | |
- if (/(?:java|jdk) version "(\d+)(?:\.(\d+))?/) { | |
- $jvm_found = 1; | |
- if ($1 > 1 || $1 == 1 && $2 >= 8) { | |
- $jvm_ok = 1; | |
- } | |
- $got = $_; | |
- last; | |
- } | |
- } | |
- | |
- if (!$jvm_found) { | |
- push @errors, | |
- "No JVM (java executable) in path; cannot continue"; | |
- } | |
- elsif (!$jvm_ok) { | |
- push @errors, | |
- "Need at least JVM 1.8 (got $got)"; | |
+ unless ( $cfg->opt('expand') ) { | |
+ my $make = $cfg->cfg('make'); | |
+ unless ( $cfg->opt('no-clean') ) { | |
+ no warnings; | |
+ print "Cleaning up ...\n"; | |
+ if ( open my $CLEAN, '-|', "$make clean" ) { | |
+ my @slurp = <$CLEAN>; | |
+ close($CLEAN); | |
} | |
} | |
- sorry($options{'ignore-errors'}, @errors) if @errors; | |
- print "Using $got\n"; | |
- | |
- $config{'make'} = $^O eq 'MSWin32' ? 'nmake' : 'make'; | |
- $config{'runner'} = $^O eq 'MSWin32' ? 'nqp.bat' : 'nqp'; | |
- | |
- fill_template_file( | |
- 'tools/build/Makefile-JVM.in', | |
- $MAKEFILE, | |
- %config, | |
- ); | |
- } | |
- | |
- my $ext = ''; | |
- if ($^O eq 'MSWin32') { | |
- $ext = '.bat'; | |
- } | |
- | |
- print $MAKEFILE qq[t/*/*.t: all\n\tprove -r -v --exec ./nqp$ext \$\@\n]; | |
- | |
- close $MAKEFILE | |
- or die "Error while writing to 'Makefile': $!"; | |
- | |
- my $make = fill_template_text('@make@', %config); | |
- unless ($options{'no-clean'}) { | |
- no warnings; | |
- print "Cleaning up ...\n"; | |
- if (open my $CLEAN, '-|', "$make clean") { | |
- my @slurp = <$CLEAN>; | |
- close($CLEAN); | |
+ if ( $cfg->opt('make-install') ) { | |
+ system_or_die($make); | |
+ system_or_die( $make, 'install' ); | |
+ print "\nNQP has been built and installed.\n"; | |
+ } | |
+ else { | |
+ print "You can now use '$make' to build NQP.\n"; | |
+ print "After that, '$make test' will run some tests and\n"; | |
+ print "'$make install' will install NQP.\n"; | |
} | |
- } | |
- | |
- if ($options{'make-install'}) { | |
- system_or_die($make); | |
- system_or_die($make, 'install'); | |
- print "\nNQP has been built and installed.\n"; | |
- } | |
- else { | |
- print "You can now use '$make' to build NQP.\n"; | |
- print "After that, '$make test' will run some tests and\n"; | |
- print "'$make install' will install NQP.\n"; | |
} | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment