From: Nicholas Clark Date: Thu, 24 Sep 2009 13:52:34 +0000 (+0100) Subject: Allow make_ext.pl to take multiple --dir options, and honour them all. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7c40aa71c55530661091304bfd36d642ff33d9b6;p=p5sagit%2Fp5-mst-13.2.git Allow make_ext.pl to take multiple --dir options, and honour them all. --- diff --git a/make_ext.pl b/make_ext.pl index 0e0bc9b..0fe892f 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -76,7 +76,7 @@ foreach (@ARGV) { } elsif (/^--([\w\-]+)$/) { $opts{$1} = 1; } elsif (/^--([\w\-]+)=(.*)$/) { - $opts{$1} = $2; + push @{$opts{$1}}, $2; } elsif (/=/) { push @pass_through, $_; } elsif (length) { @@ -116,8 +116,8 @@ foreach (@extspec) { my $makecmd = shift @pass_through; # Should be something like MAKE=make unshift @pass_through, 'PERL_CORE=1'; -my $dir = $opts{dir} || 'ext'; -my $target = $opts{target}; +my @dirs = $opts{dir} || ['ext', 'cpan']; +my $target = $opts{target}[0]; $target = 'all' unless defined $target; # Previously, $make was taken from config.sh. However, the user might @@ -171,35 +171,37 @@ if ($is_Win32) { } print "In ", getcwd(); - chdir($dir) || die "Cannot cd to $dir\n"; - (my $ext = getcwd()) =~ s{/}{\\}g; - FindExt::scan_ext($ext); - FindExt::set_static_extensions(split ' ', $Config{static_ext}); - - my @ext; - push @ext, FindExt::static_ext() if $static; - push @ext, FindExt::dynamic_ext() if $dynamic; - push @ext, FindExt::nonxs_ext() if $nonxs; - push @ext, 'DynaLoader' if $dynaloader; - - foreach (sort @ext) { - if (%incl and !exists $incl{$_}) { - #warn "Skipping extension $ext\\$_, not in inclusion list\n"; - next; - } - if (exists $excl{$_}) { - warn "Skipping extension $ext\\$_, not ported to current platform"; - next; - } - push @extspec, $_; - if($_ eq 'DynaLoader') { - # No, we don't know why nmake can't work out the dependency chain - push @{$extra_passthrough{$_}}, 'DynaLoader.c'; - } elsif(FindExt::is_static($_)) { - push @{$extra_passthrough{$_}}, 'LINKTYPE=static'; + foreach my $dir (@dirs) { + chdir($dir) || die "Cannot cd to $dir\n"; + (my $ext = getcwd()) =~ s{/}{\\}g; + FindExt::scan_ext($ext); + FindExt::set_static_extensions(split ' ', $Config{static_ext}); + + my @ext; + push @ext, FindExt::static_ext() if $static; + push @ext, FindExt::dynamic_ext() if $dynamic; + push @ext, FindExt::nonxs_ext() if $nonxs; + push @ext, 'DynaLoader' if $dynaloader; + + foreach (sort @ext) { + if (%incl and !exists $incl{$_}) { + #warn "Skipping extension $ext\\$_, not in inclusion list\n"; + next; + } + if (exists $excl{$_}) { + warn "Skipping extension $ext\\$_, not ported to current platform"; + next; + } + push @extspec, $_; + if($_ eq 'DynaLoader') { + # No, we don't know why nmake can't work out the dependency chain + push @{$extra_passthrough{$_}}, 'DynaLoader.c'; + } elsif(FindExt::is_static($_)) { + push @{$extra_passthrough{$_}}, 'LINKTYPE=static'; + } } + chdir '..'; # now in the Perl build directory } - chdir '..'; # now in the Perl build directory } elsif ($is_VMS) { $perl = $^X;