X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/ed9ba3bbdb87bec68e0f8d47a3a5c2253c96f950..4ea3d013da305b2f2c1dc4bd374270fa7a57c1ae:/configpm diff --git a/configpm b/configpm index 048da37..21bd3ef 100755 --- a/configpm +++ b/configpm @@ -11,7 +11,6 @@ # lib/Config.pm # lib/Config_heavy.pl # lib/Config.pod -# lib/Cross.pm (optionally) # # # from the contents of the static files @@ -23,7 +22,6 @@ # # config.sh # -# Note that output directory is xlib/[cross-name]/ for cross-compiling # # It will only update Config.pm and Config_heavy.pl if the contents of # either file would be different. Note that *both* files are updated in @@ -32,7 +30,6 @@ sub usage { die < '', # --cross=PLATFORM - crosscompiling for PLATFORM 'glossary' => 1, # --no-glossary - no glossary file inclusion, # for compactness 'chdir' => '', # --chdir=dir - change directory before writing files @@ -128,19 +124,10 @@ if ($Opts{chdir}) { my ($Config_SH, $Config_PM, $Config_heavy, $Config_POD); my $Glossary = 'Porting/Glossary'; -if ($Opts{cross}) { - # creating cross-platform config file - mkdir "xlib"; - mkdir "xlib/$Opts{cross}"; - $Config_PM = "xlib/$Opts{cross}/Config.pm"; - $Config_POD = "xlib/$Opts{cross}/Config.pod"; - $Config_SH = "Cross/config-$Opts{cross}.sh"; -} -else { - $Config_PM = "lib/Config.pm"; - $Config_POD = "lib/Config.pod"; - $Config_SH = "config.sh"; -} +$Config_PM = "lib/Config.pm"; +$Config_POD = "lib/Config.pod"; +$Config_SH = "config.sh"; + ($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; @@ -641,6 +628,24 @@ foreach my $prefix (qw(libs libswanted)) { $heavy_txt .= "${prefix}_nolargefiles='$value'\n"; } +if (open(my $fh, "cflags")) { + my $ccwarnflags; + my $ccstdflags; + while (<$fh>) { + if (/^warn="(.+)"$/) { + $ccwarnflags = $1; + } elsif (/^stdflags="(.+)"$/) { + $ccstdflags = $1; + } + } + if (defined $ccwarnflags) { + $heavy_txt .= "ccwarnflags='$ccwarnflags'\n"; + } + if (defined $ccstdflags) { + $heavy_txt .= "ccstdflags='$ccstdflags'\n"; + } +} + $heavy_txt .= "EOVIRTUAL\n"; $heavy_txt .= <<'ENDOFGIT'; @@ -987,6 +992,7 @@ if ($Opts{glossary}) { my %seen = (); my $text = 0; $/ = ''; +my $errors= 0; sub process { if (s/\A(\w*)\s+\(([\w.]+)\):\s*\n(\t?)/=item C<$1>\n\nFrom F<$2>:\n\n/m) { @@ -1011,7 +1017,9 @@ EOF } elsif (!$text || !/\A\t/) { warn "Expected a Configure variable header", - ($text ? " or another paragraph of description" : () ); + ($text ? " or another paragraph of description" : () ), + ", instead we got:\n$_"; + $errors++; } s/n't/n\00t/g; # leave can't, won't etc untouched s/^\t\s+(.*)/\n$1/gm; # Indented lines ===> new paragraph @@ -1048,6 +1056,13 @@ if ($Opts{glossary}) { process; print CONFIG_POD; } + if ($errors) { + die "Errors encountered while processing $Glossary. ", + "Header lines are expected to be of the form:\n", + "NAME (CLASS):\n", + "Maybe there is a malformed header?\n", + ; + } } print CONFIG_POD <<'ENDOFTAIL'; @@ -1103,46 +1118,8 @@ if ($orig_config_txt ne $config_txt or $orig_heavy_txt ne $heavy_txt) { print "updated $Config_heavy\n"; } - -# Now create Cross.pm if needed -if ($Opts{cross}) { - open CROSS, ">lib/Cross.pm" or die "Can not open >lib/Cross.pm: $!"; - my $cross = <<'EOS'; -# typical invocation: -# perl -MCross Makefile.PL -# perl -MCross=wince -V:cc -package Cross; - -sub import { - my ($package,$platform) = @_; - unless (defined $platform) { - # if $platform is not specified, then use last one when - # 'configpm; was invoked with --cross option - $platform = '***replace-marker***'; - } - #a Perl debugger can load a bunch of modules before -MCross with PERL5DB env - #var, stopping a cross compile Config.pm from being loaded because the native - #Config.pm was already use'd - if(exists $INC{'Config.pm'}) { - warn "Cross.pm found Config.pm is already loaded, reload required, will delete from %INC"; - delete $INC{'Config.pm'}; - } - @INC = map {/\blib\b/?(do{local $_=$_;s/\blib\b/xlib\/$platform/;$_},$_):($_)} @INC; - $::Cross::platform = $platform; -} - -1; -EOS - $cross =~ s/\*\*\*replace-marker\*\*\*/$Opts{cross}/g; - print CROSS $cross; - close CROSS; - print "written lib/Cross.pm\n"; - unshift(@INC,"xlib/$Opts{cross}"); -} - # Now do some simple tests on the Config.pm file we have created unshift(@INC,'lib'); -unshift(@INC,'xlib/symbian') if $Opts{cross}; require $Config_PM; require $Config_heavy; import Config;