diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-01-30 20:45:48 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-01-30 20:45:48 +0000 |
commit | b8d39eba9160d9d827fe1bd336e755657f56fc04 (patch) | |
tree | 43aaa641fbd5e740a43341411a9658d64f3b686d /make_ext.pl | |
parent | 222046efb22c183703fea2b30db76296ab782e89 (diff) | |
download | perl-b8d39eba9160d9d827fe1bd336e755657f56fc04.tar.gz |
Use Config; rather than parsing config.sh and pushing it into %ENV, a literal
transcription of the make_ext shell script. (We'll soon see if anything we
called was using its environment rather than Config.pm)
Diffstat (limited to 'make_ext.pl')
-rw-r--r-- | make_ext.pl | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/make_ext.pl b/make_ext.pl index 2f648e9dc7..ce63523dce 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -1,6 +1,7 @@ #!./miniperl use strict; use warnings; +use Config; # This script acts as a simple interface for building extensions. # It primarily used by the perl Makefile: @@ -54,23 +55,9 @@ else { exit(1); } -# search config.sh for inclusion -$ENV{CONFIG} = '' if not defined $ENV{CONFIG}; -if ($ENV{CONFIG} eq '') { - my $config; - foreach my $depth (0..4) { - my $file = ('../' x $depth) . 'config.sh'; - $config = $file, last if -f $file; - } - print("Can't find config.sh generated by Configure"), exit(1) - unless defined $config; - - load_config_sh($config); -} - # fallback to config.sh's MAKE -$make ||= $ENV{make} || $ENV{MAKE}; -my $run = $ENV{run}; +$make ||= $Config{make} || $ENV{MAKE}; +my $run = $Config{run}; $run = '' if not defined $run; $run .= ' ' if $run ne '';; @@ -118,9 +105,9 @@ if (not -d "ext/$pname") { exit(0); # not an error ? } -if ($ENV{osname} eq 'catamount') { +if ($Config{osname} eq 'catamount') { # Snowball's chance of building extensions. - print "This is $ENV{osname}, not building $mname, sorry.\n"; + print "This is $Config{osname}, not building $mname, sorry.\n"; exit(0); } @@ -233,15 +220,3 @@ system( ) or exit(); exit($?); - -# read config.sh and add its keys to our %ENV -sub load_config_sh { - my $file = shift; - open my $fh, '<', $file or die "Could not open file '$file' as a 'config.sh': $!"; - while (<$fh>) { - chomp; - next if /^\s*#/; - $ENV{$1} = $3 if /^(?!:)([^\s=]+)=('?)(.*?)\2$/; - } - close $fh; -} |