From: Nicholas Clark Date: Fri, 30 Jan 2009 20:45:48 +0000 (+0000) Subject: Use Config; rather than parsing config.sh and pushing it into %ENV, a literal X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8d39eba9160d9d827fe1bd336e755657f56fc04;p=p5sagit%2Fp5-mst-13.2.git 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) --- diff --git a/make_ext.pl b/make_ext.pl index 2f648e9..ce63523 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; -}