From: Nicholas Clark Date: Sun, 1 Feb 2009 14:37:21 +0000 (+0000) Subject: Replacing system $scalar with system @list requires splitting $MAKE on spaces. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb1f8df73c921226b177e96f1b82371e5ad0d13d;p=p5sagit%2Fp5-mst-13.2.git Replacing system $scalar with system @list requires splitting $MAKE on spaces. --- diff --git a/make_ext.pl b/make_ext.pl index fb4399c..422d580 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -75,7 +75,10 @@ unless(defined $makecmd and $makecmd =~ /^MAKE=(.*)$/) { die "$0: WARNING: Please include MAKE=\$(MAKE) in \@ARGV\n"; } -my $make = $1 || $Config{make} || $ENV{MAKE}; +# This isn't going to cope with anything fancy, such as spaces inside command +# names, but neither did what it replaced. Once there is a use case that needs +# it, please supply patches. Until then, I'm sticking to KISS +my @make = split ' ', $1 || $Config{make} || $ENV{MAKE}; # Using an array of 0 or 1 elements makes the subsequent code simpler. my @run = $Config{run}; @run = () if not defined $run[0] or $run[0] eq ''; @@ -161,12 +164,12 @@ sub build_extension { cd $ext_dir if test ! -f Makefile -a -f Makefile.old; then echo "Note: Using Makefile.old" - make -f Makefile.old $clean_target MAKE=$make @pass_through + make -f Makefile.old $clean_target MAKE='@make' @pass_through else if test ! -f Makefile ; then echo "Warning: No Makefile!" fi - make $clean_target MAKE=$make @pass_through + make $clean_target MAKE='@make' @pass_through fi cd $return_dir EOS @@ -182,10 +185,10 @@ EOS if (!$target or $target !~ /clean$/) { # Give makefile an opportunity to rewrite itself. # reassure users that life goes on... - my @config = (@run, $make, 'config', @$pass_through); + my @config = (@run, @make, 'config', @$pass_through); system @config and print "@config failed, continuing anyway...\n"; } - my @targ = (@run, $make, $target, @$pass_through); + my @targ = (@run, @make, $target, @$pass_through); print "Making $target in $ext_dir\n@targ\n"; my $code = system @targ; die "Unsuccessful make($ext_dir): code=$code" if $code != 0; diff --git a/win32/buildext.pl b/win32/buildext.pl index 55715f2..8b6a797 100644 --- a/win32/buildext.pl +++ b/win32/buildext.pl @@ -65,21 +65,15 @@ my $dir = $opts{dir} || 'ext'; my $target = $opts{target}; $target = 'all' unless defined $target; -my $make; -if (defined($makecmd) and $makecmd =~ /^MAKE=(.*)$/) { - $make = $1; +unless(defined $makecmd and $makecmd =~ /^MAKE=(.*)$/) { + die "$0: WARNING: Please include MAKE=\$(MAKE) in \@ARGV\n"; } -else { - print "$0: WARNING: Please include MAKE=\$(MAKE)\n"; - print "\tin your call to buildext.pl. See buildext.pl for details.\n"; - exit(1); -} - -# Strip whitespace at end of $make to ease passing of (potentially empty) parameters -$make =~ s/\s+$//; -# fallback to config.sh's MAKE -$make ||= $Config{make} || $ENV{MAKE}; +# This isn't going to cope with anything fancy, such as spaces inside command +# names, but neither did what it replaced. Once there is a use case that needs +# it, please supply patches. Until then, I'm sticking to KISS +my @make = split ' ', $1 || $Config{make} || $ENV{MAKE}; +# Using an array of 0 or 1 elements makes the subsequent code simpler. my @run = $Config{run}; @run = () if not defined $run[0] or $run[0] eq ''; @@ -155,10 +149,10 @@ sub build_extension { if (!$target or $target !~ /clean$/) { # Give makefile an opportunity to rewrite itself. # reassure users that life goes on... - my @config = (@run, $make, 'config', @$pass_through); + my @config = (@run, @make, 'config', @$pass_through); system @config and print "@config failed, continuing anyway...\n"; } - my @targ = (@run, $make, $target, @$pass_through); + my @targ = (@run, @make, $target, @$pass_through); print "Making $target in $ext_dir\n@targ\n"; my $code = system @targ; die "Unsuccessful make($ext_dir): code=$code" if $code != 0;