X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/0bac45c8ec730e2fa8dc539d8acfd2271778b4bf..9f601cf3bbfa6be3e2ab3468e77a7b79c80ff5cf:/configpm diff --git a/configpm b/configpm index c62f0fc..8c4bd14 100755 --- a/configpm +++ b/configpm @@ -35,7 +35,7 @@ usage: $0 [ options ] EOF use strict; -use vars qw(%Config $Config_SH_expanded); +our (%Config, $Config_SH_expanded); my $how_many_common = 22; @@ -150,12 +150,12 @@ $config_txt .= sprintf << 'EOT', $], $export_funcs; # for a description of the variables, please have a look at the # Glossary file, as written in the Porting folder, or use the url: -# http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary +# https://github.com/Perl/perl5/blob/blead/Porting/Glossary package Config; use strict; use warnings; -use vars '%%Config', '$VERSION'; +our ( %%Config, $VERSION ); $VERSION = "%s"; @@ -212,11 +212,24 @@ my $in_v = 0; my %Data = (); my $quote; +# These variables were set in older versions of Perl, but are no longer needed +# by the core. However, some CPAN modules may rely on them; in particular, Tk +# (at least up to version 804.034) fails to build without them. We force them +# to be emitted to Config_heavy.pl for backcompat with such modules (and we may +# find that this set needs to be extended in future). See RT#132347. +my @v_forced = map "$_\n", split /\n+/, <<'EOT'; +i_limits='define' +i_stdlib='define' +i_string='define' +i_time='define' +prototype='define' +EOT + my %seen_quotes; { my ($name, $val); - open(CONFIG_SH, $Config_SH) || die "Can't open $Config_SH: $!"; + open(CONFIG_SH, '<', $Config_SH) || die "Can't open $Config_SH: $!"; while () { next if m:^#!/bin/sh:; @@ -248,6 +261,9 @@ my %seen_quotes; else { $quote = $2; ($name,$val) = ($1,$3); + if ($name eq 'cc') { + $val =~ s{^(['"]?+).*\bccache\s+}{$1}; + } } $in_v = $val !~ /$quote\n/; next if $in_v; @@ -316,7 +332,7 @@ die if $@; # Calculation for the keys for byteorder # This is somewhat grim, but I need to run fetch_string here. -our $Config_SH_expanded = join "\n", '', @v_others; +$Config_SH_expanded = join "\n", '', @v_others; my $t = fetch_string ({}, 'ivtype'); my $s = fetch_string ({}, 'ivsize'); @@ -453,7 +469,7 @@ $heavy_txt .= sprintf <<'ENDOFBEG', $osname, $osname, $from, $osname, $env_cygwi package Config; use strict; use warnings; -use vars '%%Config'; +our %%Config; sub bincompat_options { return split ' ', (Internals::V())[0]; @@ -527,7 +543,7 @@ $heavy_txt .= join('', @non_v) . "\n"; # copy config summary format from the myconfig.SH script $heavy_txt .= "our \$summary = <<'!END!';\n"; -open(MYCONFIG,") && !/^Summary of/; do { $heavy_txt .= $_ } until !defined($_ = ) || /^\s*$/; close(MYCONFIG); @@ -557,8 +573,17 @@ sub myconfig { local *_ = \my $a; $_ = <<'!END!'; EOT - -$heavy_txt .= join('', sort @v_others) . "!END!\n"; +#proper lexicographical order of the keys +my %seen_var; +$heavy_txt .= join('', + map { $_->[-1] } + sort {$a->[0] cmp $b->[0] } + grep { !$seen_var{ $_->[0] }++ } + map { + /^([^=]+)/ ? [ $1, $_ ] + : [ $_, $_ ] # shouldnt happen + } @v_others, @v_forced +) . "!END!\n"; # Only need the dynamic byteorder code in Config.pm if 'byteorder' is one of # the precached keys @@ -625,7 +650,7 @@ foreach my $prefix (qw(libs libswanted)) { $heavy_txt .= "${prefix}_nolargefiles='$value'\n"; } -if (open(my $fh, "cflags")) { +if (open(my $fh, '<', 'cflags')) { my $ccwarnflags; my $ccstdflags; while (<$fh>) { @@ -831,10 +856,12 @@ tie %%Config, 'Config', { ENDOFTIE -open(CONFIG_POD, ">$Config_POD") or die "Can't open $Config_POD: $!"; +open(CONFIG_POD, '>', $Config_POD) or die "Can't open $Config_POD: $!"; print CONFIG_POD <<'ENDOFTAIL'; =head1 NAME +=for comment Generated by configpm. Any changes made here will be lost! + Config - access Perl configuration information =head1 SYNOPSIS @@ -869,7 +896,7 @@ named variable exists. For a description of the variables, please have a look at the Glossary file, as written in the Porting folder, or use the url: -http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary +https://github.com/Perl/perl5/blob/blead/Porting/Glossary =over 4 @@ -984,7 +1011,7 @@ in such cases. ENDOFTAIL if ($Opts{glossary}) { - open(GLOS, "<$Glossary") or die "Can't open $Glossary: $!"; + open(GLOS, '<', $Glossary) or die "Can't open $Glossary: $!"; } my %seen = (); my $text = 0; @@ -998,16 +1025,12 @@ sub process { print CONFIG_POD <