From 1f7afaabdbe35e2737c1709dc239fba563e0bf31 Mon Sep 17 00:00:00 2001 From: Tobias Leich Date: Sat, 3 May 2014 13:25:12 +0200 Subject: tools: only set $impl{config} when it is trueish Otherwise we pass a ref of an empty hash around, wich will be treated truesh later. --- tools/lib/NQP/Configure.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/NQP/Configure.pm b/tools/lib/NQP/Configure.pm index cb95cc9..ee3f67c 100644 --- a/tools/lib/NQP/Configure.pm +++ b/tools/lib/NQP/Configure.pm @@ -313,7 +313,7 @@ sub gen_nqp { my $nqp_have = $c{'nqp::version'} || ''; my $nqp_ok = $nqp_have && cmp_rev($nqp_have, $nqp_want) >= 0; if ($nqp_ok) { - $impls{$b}{config} = \%c; + $impls{$b}{config} = \%c if %c; } else { $need{$b} = 1; -- cgit v1.1 From 5bbf9d6245aed2cae58b1f76b39d7c6dbf97fc81 Mon Sep 17 00:00:00 2001 From: Tobias Leich Date: Sat, 3 May 2014 13:46:41 +0200 Subject: more guidance to build rakudo It shows examples what option can be passes, and it also mentiones other backends than Parrot when someone tried to build for several backends but did not supply the right flags. --- Configure.pl | 92 +++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 22 deletions(-) diff --git a/Configure.pl b/Configure.pl index 443456f..f2b223d 100644 --- a/Configure.pl +++ b/Configure.pl @@ -90,22 +90,32 @@ MAIN: { } else { for my $l (sort keys %letter_to_backend) { - if (-x "$prefix/bin/nqp-$l" || -x "$prefix/bin/nqp-$l.bat" || -x "$prefix/bin/nqp-$l.exe") { + # TODO: needs .exe/.bat magic on windows? + if (-x "$prefix/bin/nqp-$l") { my $b = $letter_to_backend{$l}; print "Found $prefix/bin/nqp-$l (backend $b)\n"; $backends{$b} = 1; $default_backend ||= $b; } } + if (exists $options{'gen-moar'}) { + $backends{moar} = 1; + $default_backend ||= 'moar'; + } + if (exists $options{'gen-parrot'}) { + $backends{parrot} = 1; + $default_backend ||= 'parrot'; + } unless (%backends) { - if (defined $options{'gen-moar'}) { - $backends{moar} = 1; - $default_backend = 'moar'; - } - else { - $backends{parrot} = 1; - $default_backend = 'parrot'; - } + die "No suitable nqp executables found! Please specify some --backends, or a --prefix that contains nqp-{p,j,m} executables\n\n" + . "Example to build for all backends (which will take a while):\n" + . "\tperl Configure.pl --backends=moar,parrot,jvm --gen-moar --gen-parrot\n\n" + . "Example to build for MoarVM only:\n" + . "\tperl Configure.pl --gen-moar\n\n" + . "Example to build for Parrot only:\n" + . "\tperl Configure.pl --gen-parrot\n\n" + . "Example to build for JVM only:\n" + . "\tperl Configure.pl --backends=jvm --gen-nqp\n\n"; } } @@ -155,6 +165,7 @@ MAIN: { my %impls = gen_nqp($nqp_want, prefix => $prefix, backends => join(',', sort keys %backends), %options); my @errors; + my %errors; if ($backends{parrot}) { my %nqp_config; if ($impls{parrot}{config}) { @@ -179,18 +190,12 @@ MAIN: { if @errors; } - if (@errors && !defined $options{'gen-nqp'}) { - push @errors, - "\nTo automatically clone (git) and build a copy of NQP $nqp_want,", - "try re-running Configure.pl with the '--gen-nqp' or '--gen-parrot'", - "options. Or, use '--prefix=' to explicitly", - "specify the path where the NQP and Parrot executable can be found that are use to build $lang."; - } - - sorry(@errors) if @errors; + $errors{parrot}{'no gen-nqp'} = @errors && !defined $options{'gen-nqp'}; - %config = (%nqp_config, %config); - print "Using $impls{parrot}{bin} (version $nqp_config{'nqp::version'}).\n"; + unless (@errors) { + %config = (%nqp_config, %config); + print "Using $impls{parrot}{bin} (version $nqp_config{'nqp::version'}).\n"; + } } if ($backends{jvm}) { $config{j_nqp} = $impls{jvm}{bin}; @@ -208,11 +213,54 @@ MAIN: { push @errors, "jvm::runtime.jars value not available from $bin --show-config."; } - sorry(@errors) if @errors; + $errors{jvm}{'no gen-nqp'} = @errors && !defined $options{'gen-nqp'}; + + unless (@errors) { + %config = (%nqp_config, %config); + print "Using $bin.\n"; + } + } + if ($backends{moar}) { + $config{m_nqp} = $impls{moar}{bin}; + $config{m_nqp} =~ s{/}{\\}g if $^O eq 'MSWin32'; + my %nqp_config; + if ( $impls{moar}{config} ) { + %nqp_config = %{ $impls{moar}{config} }; + } + else { + push @errors, "Unable to read configuration from NQP on MoarVM"; + } + + $errors{moar}{'no gen-nqp'} = @errors && !defined $options{'gen-nqp'}; - print "Using $bin.\n"; + unless (@errors) { + %config = (%nqp_config, %config); + print "Using $config{m_nqp} (version $nqp_config{'nqp::version'} / MoarVM $nqp_config{'moar::version'}).\n"; + } + } + if ($errors{parrot}{'no gen-nqp'} || $errors{jvm}{'no gen-nqp'} || $errors{moar}{'no gen-nqp'}) { + my @options_to_pass; + push @options_to_pass, "--gen-parrot" if $backends{parrot}; + push @options_to_pass, "--gen-moar" if $backends{moar}; + push @options_to_pass, "--gen-nqp" unless @options_to_pass; + my $options_to_pass = join ' ', @options_to_pass; + my $want_executables = $backends{parrot} && $backends{moar} + ? ', Parrot and MoarVM' + : $backends{parrot} + ? ' and Parrot' + : $backends{moar} + ? ' and MoarVM' + : ''; + my $s1 = @options_to_pass > 1 ? 's' : ''; + my $s2 = $want_executables ? 's' : ''; + push @errors, + "\nTo automatically clone (git) and build a copy of NQP $nqp_want,", + "try re-running Configure.pl with the '$options_to_pass' option$s1.", + "Or, use '--prefix=' to explicitly specify the path where the NQP$want_executables", + "executable$s2 can be found that are use to build $lang."; } + sorry(@errors) if @errors; fill_template_file('tools/build/Makefile.in', 'Makefile', %config); -- cgit v1.1