summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2004-11-27 16:56:35 +0000
committerNicholas Clark <nick@ccl4.org>2004-11-27 16:56:35 +0000
commitb15f85b3b9efd666125904fa3a8bc9d714145e20 (patch)
treec7a1a7d073dcaa3575d331967786c2d6498c2b05
parent71f5a8c6aa3d85126cbcdaef5707d773deaf8181 (diff)
downloadperl-b15f85b3b9efd666125904fa3a8bc9d714145e20.tar.gz
Put Config.pm on a diet. 3K rather than 32K
configpm now generates 2 files, a small Config.pm containing the commonly used functions and values, which AUTOLOADs a Config_heavy.pl containing anything else needed. The "common" values in the small Config.pm may need some tweaking, based on real world data. p4raw-id: //depot/perl@23554
-rw-r--r--Makefile.SH25
-rwxr-xr-xconfigpm80
-rw-r--r--vms/descrip_mms.template9
-rw-r--r--win32/Makefile2
-rw-r--r--win32/makefile.mk2
5 files changed, 82 insertions, 36 deletions
diff --git a/Makefile.SH b/Makefile.SH
index 3ee015c841..d616c89416 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -299,7 +299,8 @@ CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@`
CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<`
-private = preplibrary lib/Config.pm lib/ExtUtils/Miniperl.pm
+CONFIGPM = lib/Config.pm lib/Config_heavy.pl
+private = preplibrary $(CONFIGPM) lib/ExtUtils/Miniperl.pm
# Files to be built with variable substitution before miniperl
# is available.
@@ -372,10 +373,10 @@ compile: all
cd x2p; $(MAKE) compile;
cd pod; $(MAKE) compile;
-translators: miniperl$(EXE_EXT) lib/Config.pm FORCE
+translators: miniperl$(EXE_EXT) $(CONFIGPM) FORCE
@echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
-utilities: miniperl$(EXE_EXT) lib/Config.pm $(plextract) lib/lib.pm FORCE
+utilities: miniperl$(EXE_EXT) $(CONFIGPM) $(plextract) lib/lib.pm FORCE
@echo " "; echo " Making utilities"; cd utils; $(LDLIBPTH) $(MAKE) all
@@ -728,7 +729,7 @@ sperl$(OBJ_EXT): perl.c $(h)
# We need to autosplit in two steps because VOS can't handle so many args
#
.PHONY: preplibrary
-preplibrary: miniperl$(EXE_EXT) lib/Config.pm lib/lib.pm $(PREPLIBRARY_LIBPERL)
+preplibrary: miniperl$(EXE_EXT) $(CONFIGPM) lib/lib.pm $(PREPLIBRARY_LIBPERL)
@sh ./makedir lib/auto
@echo " AutoSplitting perl library"
$(LDLIBPTH) ./miniperl -Ilib -e 'use AutoSplit; \
@@ -740,11 +741,11 @@ preplibrary: miniperl$(EXE_EXT) lib/Config.pm lib/lib.pm $(PREPLIBRARY_LIBPERL)
# Take care to avoid modifying lib/Config.pm without reason
# (If trying to create a new port and having problems with the configpm script,
# try 'make minitest' and/or commenting out the tests at the end of configpm.)
-lib/Config.pm: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
- $(LDLIBPTH) ./miniperl -Ilib configpm configpm.tmp
- sh mv-if-diff configpm.tmp $@
+$(CONFIGPM): config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
+ $(LDLIBPTH) ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl configpm.tmp
+ sh mv-if-diff configpm.tmp lib/Config.pm
-lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl lib/Config.pm
+lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl $(CONFIGPM)
$(LDLIBPTH) ./miniperl minimod.pl > minimod.tmp
sh mv-if-diff minimod.tmp $@
-touch lib/ExtUtils/Miniperl.pm
@@ -752,18 +753,18 @@ lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl$(EXE_EXT) minimod.pl lib/Confi
lib/re.pm: ext/re/re.pm
cp ext/re/re.pm ext/re/re.tmp && sh mv-if-diff ext/re/re.tmp lib/re.pm
-$(plextract): miniperl$(EXE_EXT) lib/Config.pm x2p/s2p
+$(plextract): miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p
@-rm -f $@
$(LDLIBPTH) ./miniperl -Ilib $@.PL
-x2p/s2p: miniperl$(EXE_EXT) lib/Config.pm x2p/s2p.PL
+x2p/s2p: miniperl$(EXE_EXT) $(CONFIGPM) x2p/s2p.PL
cd x2p; $(LDLIBPTH) $(MAKE) s2p
-lib/lib.pm: miniperl$(EXE_EXT) lib/Config.pm
+lib/lib.pm: miniperl$(EXE_EXT) $(CONFIGPM)
@-rm -f $@
$(LDLIBPTH) ./miniperl -Ilib lib/lib_pm.PL
-$(unidatafiles): miniperl$(EXE_EXT) lib/Config.pm lib/unicore/mktables
+$(unidatafiles): miniperl$(EXE_EXT) $(CONFIGPM) lib/unicore/mktables
cd lib/unicore && $(LDLIBPTH) ../../miniperl -I../../lib mktables -w
extra.pods: miniperl$(EXE_EXT)
diff --git a/configpm b/configpm
index 9b83df0e94..3f4cb46b51 100755
--- a/configpm
+++ b/configpm
@@ -17,9 +17,10 @@ my %Extensions = map {($_,$_)}
# allowed opts as well as specifies default and initial values
my %Allowed_Opts = (
- 'cross' => '', # --cross=PALTFORM - crosscompiling for PLATFORM
- 'glossary' => 1, # --no-glossary - no glossary file inclusion,
+ 'cross' => '', # --cross=PLATFORM - crosscompiling for PLATFORM
+ 'glossary' => 1, # --no-glossary - no glossary file inclusion,
# for compactness
+ 'heavy' => '', # pathname of the Config_heavy.pl file
);
sub opts {
@@ -44,7 +45,7 @@ sub opts {
my %Opts = opts();
-my $Config_PM;
+my ($Config_PM, $Config_heavy);
my $Glossary = $ARGV[1] || 'Porting/Glossary';
if ($Opts{cross}) {
@@ -56,9 +57,27 @@ if ($Opts{cross}) {
else {
$Config_PM = $ARGV[0] || 'lib/Config.pm';
}
-
+if ($Opts{heavy}) {
+ $Config_heavy = $Opts{heavy};
+}
+else {
+ ($Config_heavy = $Config_PM) =~ s!\.pm$!_heavy.pl!;
+ die "Can't automatically determine name for Config_heavy.pl from '$Config_PM'"
+ if $Config_heavy eq $Config_PM;
+}
open CONFIG, ">$Config_PM" or die "Can't open $Config_PM: $!\n";
+open CONFIG_HEAVY, ">$Config_heavy" or die "Can't open $Config_heavy: $!\n";
+
+print CONFIG_HEAVY <<'ENDOFBEG';
+# This file was created by configpm when Perl was built. Any changes
+# made to this file will be lost the next time perl is built.
+
+package Config;
+use strict;
+# use warnings; Pulls in Carp
+# use vars pulls in Carp
+ENDOFBEG
my $myver = sprintf "v%vd", $^V;
@@ -239,32 +258,33 @@ if ($s == 4 || $s == 8) {
my \$i = 0;
foreach my \$c ($list) { \$i |= ord(\$c); \$i <<= 8 }
\$i |= ord(1);
-my \$byteorder = join('', unpack('$format', pack('$f', \$i)));
+our \$byteorder = join('', unpack('$format', pack('$f', \$i)));
EOT
} else {
- $byteorder_code = "my \$byteorder = '?'x$s;\n";
+ $byteorder_code = "our \$byteorder = '?'x$s;\n";
}
+print CONFIG $byteorder_code;
-print CONFIG @non_v, "\n";
+print CONFIG_HEAVY @non_v, "\n";
# copy config summary format from the myconfig.SH script
-print CONFIG "our \$summary : unique = <<'!END!';\n";
+print CONFIG_HEAVY "our \$summary : unique = <<'!END!';\n";
open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
-do { print CONFIG $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
+do { print CONFIG_HEAVY $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
close(MYCONFIG);
# NB. as $summary is unique, we need to copy it in a lexical variable
# before expanding it, because may have been made readonly if a perl
# interpreter has been cloned.
-print CONFIG "\n!END!\n", $byteorder_code, <<'EOT';
+print CONFIG_HEAVY "\n!END!\n", <<'EOT';
my $summary_expanded;
sub myconfig {
return $summary_expanded if $summary_expanded;
($summary_expanded = $summary) =~ s{\$(\w+)}
- { my $c = $Config{$1}; defined($c) ? $c : 'undef' }ge;
+ { my $c = $Config::Config{$1}; defined($c) ? $c : 'undef' }ge;
$summary_expanded;
}
@@ -272,11 +292,11 @@ local *_ = \my $a;
$_ = <<'!END!';
EOT
-print CONFIG join("", @v_fast, sort @v_others);
+print CONFIG_HEAVY join("", @v_fast, sort @v_others);
-print CONFIG <<'EOT';
+print CONFIG_HEAVY <<'EOT';
!END!
-s/(byteorder=)(['"]).*?\2/$1$2$byteorder$2/m;
+s/(byteorder=)(['"]).*?\2/$1$2$Config::byteorder$2/m;
our $Config_SH : unique = $_;
our $Config_SH_expanded : unique = "\n$_" . << 'EOVIRTUAL';
@@ -286,7 +306,7 @@ foreach my $prefix (qw(ccflags ldflags)) {
my $value = fetch_string ({}, $prefix);
my $withlargefiles = fetch_string ({}, $prefix . "_uselargefiles");
$value =~ s/\Q$withlargefiles\E\b//;
- print CONFIG "${prefix}_nolargefiles='$value'\n";
+ print CONFIG_HEAVY "${prefix}_nolargefiles='$value'\n";
}
foreach my $prefix (qw(libs libswanted)) {
@@ -307,16 +327,16 @@ foreach my $prefix (qw(libs libswanted)) {
$value = join(' ', @libswanted);
}
}
- print CONFIG "${prefix}_nolargefiles='$value'\n";
+ print CONFIG_HEAVY "${prefix}_nolargefiles='$value'\n";
}
-print CONFIG "EOVIRTUAL\n";
+print CONFIG_HEAVY "EOVIRTUAL\n";
-print CONFIG $fetch_string;
+print CONFIG_HEAVY $fetch_string;
print CONFIG <<'ENDOFEND';
-sub FETCH {
+sub FETCH {
my($self, $key) = @_;
# check for cached value (which may be undef so we use exists not defined)
@@ -324,7 +344,9 @@ sub FETCH {
return $self->fetch_string($key);
}
-
+ENDOFEND
+
+print CONFIG_HEAVY <<'ENDOFEND';
my $prevpos = 0;
sub FIRSTKEY {
@@ -380,13 +402,21 @@ sub config_vars {
print map "$_$lnend", @matches ? @matches : "$qry: not found" if !$notag;
print map { s/\w+=//; "$_$lnend" } @matches ? @matches : "$qry: not found" if $notag;
} else {
- my $v = (exists $Config{$qry}) ? $Config{$qry} : 'UNKNOWN';
+ my $v = (exists $Config::Config{$qry}) ? $Config::Config{$qry}
+ : 'UNKNOWN';
$v = 'undef' unless defined $v;
print "${prfx}'${v}'$lnend";
}
}
}
+# Called by the real AUTOLOAD
+sub launcher {
+ undef &AUTOLOAD;
+ goto \&$Config::AUTOLOAD;
+}
+
+1;
ENDOFEND
if ($^O eq 'os2') {
@@ -426,9 +456,14 @@ my $fast_config = join '', map { " $_,\n" }
print CONFIG sprintf <<'ENDOFTIE', $fast_config;
-# avoid Config..Exporter..UNIVERSAL search for DESTROY then AUTOLOAD
sub DESTROY { }
+sub AUTOLOAD {
+ require 'config_heavy.pl';
+ goto \&launcher;
+ die "&Config::AUTOLOAD failed on $Config::AUTOLOAD";
+}
+
tie %%Config, 'Config', {
%s
};
@@ -635,6 +670,7 @@ outside of it.
ENDOFTAIL
+close(CONFIG_HEAVY);
close(CONFIG);
close(GLOS);
close(CONFIG_POD);
diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index 271ae01d14..76af39c817 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -475,6 +475,10 @@ $(ARCHDIR)Config.pm : [.lib]Config.pm
Create/Directory $(ARCHDIR)
Copy/NoConfirm/Log $(MMS$SOURCE) $(ARCHDIR)
+$(ARCHDIR)Config_heavy.pl : [.lib]Config_heavy.pl
+ Create/Directory $(ARCHDIR)
+ Copy/NoConfirm/Log $(MMS$SOURCE) $(ARCHDIR)
+
[.lib]Config.pm : config.h $(MINIPERL_EXE)
$(MINIPERL) ConfigPM.
@@ -1303,6 +1307,7 @@ archify : all
Backup/Log/Verify [.lib.auto...]*.*;/Exclude=(*.al,*.ix) 'archroot'/New_Version
Delete/Log/NoConfirm [.lib.auto...]*.*;*/exclude=(*.al,*.ix,*.dir)
Delete/Log/NoConfirm [.lib]Config.pm;*
+ Delete/Log/NoConfirm [.lib]Config_heavy.pl;*
Copy/Log/NoConfirm *$(E);,[.x2p]$(DBG)a2p$(E); $(ARCHDIR)
Delete/Log/NoConfirm Perl*$(E);*,[.x2p]$(DBG)a2p$(E);*
@ QUALIFIERS := $(MMSQUALIFIERS)
@@ -1638,6 +1643,8 @@ tidy : cleanlis
- If F$Search("[.Lib]XSLoader.pm;-1").nes."" Then Purge/NoConfirm/Log [.Lib]XSLoader.pm
- If F$Search("[.Lib]Config.pm;-1").nes."" Then Purge/NoConfirm/Log [.Lib]Config.pm
- If F$Search("$(ARCHDIR)Config.pm;-1").nes."" Then Purge/NoConfirm/Log $(ARCHDIR)Config.pm
+ - If F$Search("[.Lib]Config_heavy.pl;-1").nes."" Then Purge/NoConfirm/Log [.Lib]Config_heavy.pl
+ - If F$Search("$(ARCHDIR)Config_heavy.pl;-1").nes."" Then Purge/NoConfirm/Log $(ARCHDIR)Config_heavy.pl
- If F$Search("[.lib.ExtUtils]Miniperl.pm").nes."" Then Purge/NoConfirm/Log [.lib.ExtUtils]Miniperl.pm
- If F$Search("[.lib.ExtUtils]XSSymSet.pm").nes."" Then Purge/NoConfirm/Log [.lib.ExtUtils]XSSymSet.pm
- If F$Search("[.Lib.VMS]*.*;-1").nes."" Then Purge/NoConfirm/Log [.Lib.VMS]*.*
@@ -1688,11 +1695,13 @@ realclean : clean
- If F$Search("[.Lib]DynaLoader.pm").nes."" Then Delete/NoConfirm/Log [.Lib]DynaLoader.pm;*
- If F$Search("[.Lib]XSLoader.pm").nes."" Then Delete/NoConfirm/Log [.Lib]XSLoader.pm;*
- If F$Search("[.Lib]Config.pm").nes."" Then Delete/NoConfirm/Log [.Lib]Config.pm;*
+ - If F$Search("[.Lib]Config_heavy.pl").nes."" Then Delete/NoConfirm/Log [.Lib]Config_heavy.pl;*
- If F$Search("[.Lib]*.com").nes."" Then Delete/NoConfirm/Log [.Lib]*.com;*
- If F$Search("[.pod]*.com").nes."" Then Delete/NoConfirm/Log [.pod]*.com;*
- If F$Search("[.utils]*.com").nes."" Then Delete/NoConfirm/Log [.utils]*.com;*
- If F$Search("[.x2p]*.com").nes."" Then Delete/NoConfirm/Log [.x2p]*.com;*
- If F$Search("$(ARCHDIR)Config.pm").nes."" Then Delete/NoConfirm/Log $(ARCHDIR)Config.pm;*
+ - If F$Search("$(ARCHDIR)Config_heavy.pl").nes."" Then Delete/NoConfirm/Log $(ARCHDIR)Config_heavy.pl;*
- If F$Search("[.lib.ExtUtils]Miniperl.pm").nes."" Then Delete/NoConfirm/Log [.lib.ExtUtils]Miniperl.pm;*
- If F$Search("[.lib.ExtUtils]XSSymSet.pm").nes."" Then Delete/NoConfirm/Log [.lib.ExtUtils]XSSymSet.pm;*
- If F$Search("[.lib.pod]*.pod").nes."" Then Delete/NoConfirm/Log [.lib.pod]*.pod;*
diff --git a/win32/Makefile b/win32/Makefile
index ae2ed4c0a0..b03c1c91d5 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -447,7 +447,7 @@ MINIDIR = .\mini
PERLEXE = ..\perl.exe
WPERLEXE = ..\wperl.exe
GLOBEXE = ..\perlglob.exe
-CONFIGPM = ..\lib\Config.pm
+CONFIGPM = ..\lib\Config.pm ..\Config_heavy.pl
MINIMOD = ..\lib\ExtUtils\Miniperl.pm
X2P = ..\x2p\a2p.exe
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 1117f28d9a..095be64b55 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -584,7 +584,7 @@ MINIDIR = .\mini
PERLEXE = ..\perl.exe
WPERLEXE = ..\wperl.exe
GLOBEXE = ..\perlglob.exe
-CONFIGPM = ..\lib\Config.pm
+CONFIGPM = ..\lib\Config.pm ..\lib\Config_heavy.pl
MINIMOD = ..\lib\ExtUtils\Miniperl.pm
X2P = ..\x2p\a2p.exe