X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=configpm;h=8c53dbb7249c707087ee036ac905a704075dd0d2;hb=7fa2f4f15785dd46abca32ba3f3cb3aabf0263dd;hp=ba07f14a878b9187b036c86fbbad89726cce86d4;hpb=435ec615985f8f6df0ee71931461d13d7cec3ccd;p=p5sagit%2Fp5-mst-13.2.git diff --git a/configpm b/configpm index ba07f14..8c53dbb 100755 --- a/configpm +++ b/configpm @@ -19,13 +19,25 @@ my $glossary = $ARGV[1] || 'Porting/Glossary'; open CONFIG, ">$config_pm" or die "Can't open $config_pm: $!\n"; $myver = $]; -print CONFIG <<"ENDOFBEG"; +print CONFIG <<'ENDOFBEG_NOQ', <<"ENDOFBEG"; package Config; use Exporter (); -\@ISA = (Exporter); -\@EXPORT = qw(%Config); -\@EXPORT_OK = qw(myconfig config_sh config_vars); +@EXPORT = qw(%Config); +@EXPORT_OK = qw(myconfig config_sh config_vars); + +# Define our own import method to avoid pulling in the full Exporter: +sub import { + my $pkg = shift; + @_ = @EXPORT unless @_; + my @func = grep {$_ ne '%Config'} @_; + local $Exporter::ExportLevel = 1; + Exporter::import('Config', @func) if @func; + return if @func == @_; + my $callpkg = caller(0); + *{"$callpkg\::Config"} = \%Config; +} +ENDOFBEG_NOQ \$] == $myver or die "Perl lib version ($myver) doesn't match executable version (\$])"; @@ -44,8 +56,21 @@ $in_v = 0; while (<>) { next if m:^#!/bin/sh:; - # Catch CONFIG=true and PATCHLEVEL=n line from Configure. + # Catch CONFIGDOTSH=true and PERL_VERSION=n line from Configure. s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/; + my ($k,$v) = ($1,$2); + # grandfather PATCHLEVEL and SUBVERSION and CONFIG + if ($k) { + if ($k eq 'PERL_VERSION') { + push @v_others, "PATCHLEVEL='$v'\n"; + } + elsif ($k eq 'PERL_SUBVERSION') { + push @v_others, "SUBVERSION='$v'\n"; + } + elsif ($k eq 'CONFIGDOTSH') { + push @v_others, "CONFIG='$v'\n"; + } + } # We can delimit things in config.sh with either ' or ". unless ($in_v or m/^(\w+)=(['"])(.*\n)/){ push(@non_v, "#$_"); # not a name='value' line @@ -68,11 +93,11 @@ print CONFIG "\n", join("", @v_fast, sort @v_others), "!END!\n\n"; -# copy config summary format from the myconfig script +# copy config summary format from the myconfig.SH script print CONFIG "my \$summary = <<'!END!';\n"; -open(MYCONFIG,") && !/^Summary of/; do { print CONFIG $_ } until !defined($_ = ) || /^\s*$/; close(MYCONFIG); @@ -401,11 +426,11 @@ require $config_pm; import Config; die "$0: $config_pm not valid" - unless $Config{'CONFIG'} eq 'true'; + unless $Config{'CONFIGDOTSH'} eq 'true'; die "$0: error processing $config_pm" if defined($Config{'an impossible name'}) - or $Config{'CONFIG'} ne 'true' # test cache + or $Config{'CONFIGDOTSH'} ne 'true' # test cache ; die "$0: error processing $config_pm"