summaryrefslogtreecommitdiff
path: root/configpm
diff options
context:
space:
mode:
authorVadim Konovalov <vkonovalov@lucent.com>2002-05-04 07:49:11 +0400
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-05 01:05:17 +0000
commit18f68570297a02601dc2452e05e11ca1485ace3f (patch)
tree51500988a2689c530c150a514098ec39d08325f4 /configpm
parenta4ccfa7629128e4b79e21f856eb1cbf44ef54e7e (diff)
downloadperl-18f68570297a02601dc2452e05e11ca1485ace3f.tar.gz
Re: Cross-compiling as of WinCE
Message-ID: <00ca01c1f2fd$20a35fb0$cb5cc3d9@vad> p4raw-id: //depot/perl@16407
Diffstat (limited to 'configpm')
-rwxr-xr-xconfigpm58
1 files changed, 52 insertions, 6 deletions
diff --git a/configpm b/configpm
index a22f9a2404..e473bb5ef4 100755
--- a/configpm
+++ b/configpm
@@ -1,7 +1,36 @@
#!./miniperl -w
-my $config_pm = $ARGV[0] || 'lib/Config.pm';
+# following options are recognized:
+# --no-glossary - no glossary file inclusion, for compactness
+# --cross=PALTFORM - crosscompiling for PLATFORM
+my %opts = (
+ # %known_opts enumerates allowed opts as well as specifies default and initial values
+ my %known_opts = (
+ 'cross' => '',
+ 'glossary' => 1,
+ ),
+ # options itself
+ my %specified_opts = (
+ (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth
+ (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt
+ ),
+);
+die "option '$_' is not recognized" for grep {!exists $known_opts{$_}} keys %specified_opts;
+@ARGV = grep {!/^--/} @ARGV;
+
+my $config_pm;
my $glossary = $ARGV[1] || 'Porting/Glossary';
+
+if ($opts{cross}) {
+ # creating cross-platform config file
+ mkdir "xlib";
+ mkdir "xlib/$opts{cross}";
+ $config_pm = $ARGV[0] || "xlib/$opts{cross}/Config.pm";
+}
+else {
+ $config_pm = $ARGV[0] || 'lib/Config.pm';
+}
+
@ARGV = "./config.sh";
# list names to put first (and hence lookup fastest)
@@ -414,7 +443,9 @@ in such cases.
ENDOFTAIL
-open(GLOS, "<$glossary") or die "Can't open $glossary: $!";
+if ($opts{glossary}) {
+ open(GLOS, "<$glossary") or die "Can't open $glossary: $!";
+}
%seen = ();
$text = 0;
$/ = '';
@@ -468,10 +499,12 @@ EOF
s/n[\0]t/n't/g; # undo can't, won't damage
}
-<GLOS>; # Skip the preamble
-while (<GLOS>) {
- process;
- print CONFIG;
+if ($opts{glossary}) {
+ <GLOS>; # Skip the preamble
+ while (<GLOS>) {
+ process;
+ print CONFIG;
+ }
}
print CONFIG <<'ENDOFTAIL';
@@ -491,6 +524,19 @@ ENDOFTAIL
close(CONFIG);
close(GLOS);
+# Now create Cross.pm if needed
+if ($opts{cross}) {
+ open CROSS, ">lib/Cross.pm" or die "Can not open >lib/Cross.pm: $!";
+ print CROSS <<"EOS";
+sub BEGIN {
+ \@INC = map {/\\blib\\b/?(do{local \$_=\$_;s/\\blib\\b/xlib\\/$opts{cross}/;\$_},\$_):(\$_)} \@INC;
+}
+1;
+EOS
+ close CROSS;
+}
+
+
# Now do some simple tests on the Config.pm file we have created
unshift(@INC,'lib');
require $config_pm;