X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=configpm;h=ccf7816f293a9fbdc40a239b71ff4c4b7b5d4697;hb=ae706db49f17350f7e2ed5eccdc792223f4ea020;hp=a6d6d0f14ba4acf8d25ceb71927b9fd4f565aaa4;hpb=88fe16b231aae255ffd6ec9561af9af9f6edf830;p=p5sagit%2Fp5-mst-13.2.git diff --git a/configpm b/configpm index a6d6d0f..ccf7816 100755 --- a/configpm +++ b/configpm @@ -82,7 +82,7 @@ use strict; # use vars pulls in Carp ENDOFBEG -my $myver = sprintf "v%vd", $^V; +my $myver = sprintf "%vd", $^V; printf CONFIG <<'ENDOFBEG', ($myver) x 3; # This file was created by configpm when Perl was built. Any changes @@ -298,24 +298,26 @@ EOT my @need_relocation; if (fetch_string({},'userelocatableinc')) { - foreach my $what (qw(archlib archlibexp - privlib privlibexp - sitearch sitearchexp - sitelib sitelibexp + foreach my $what (qw(archlibexp + privlibexp + sitearchexp + sitelibexp sitelib_stem - vendorarch vendorarchexp - vendorlib vendorlibexp + vendorarchexp + vendorlibexp vendorlib_stem)) { push @need_relocation, $what if fetch_string({}, $what) =~ m!^\.\.\./!; } - # This can have .../ anywhere: - push @need_relocation, 'otherlibdirs' - if fetch_string({}, 'otherlibdirs') =~ m!\.\.\./!; } my %need_relocation; @need_relocation{@need_relocation} = @need_relocation; +# This can have .../ anywhere: +if (fetch_string({}, 'otherlibdirs') =~ m!\.\.\./!) { + $need_relocation{otherlibdirs} = 'otherlibdirs'; +} + my $relocation_code = <<'EOT'; sub relocate_inc { @@ -344,9 +346,10 @@ sub relocate_inc { } EOT -if (@need_relocation) { +if (%need_relocation) { my $relocations_in_common; - foreach (@need_relocation) { + # otherlibdirs only features in the hash + foreach (keys %need_relocation) { $relocations_in_common++ if $Common{$_}; } if ($relocations_in_common) { @@ -359,16 +362,12 @@ if (@need_relocation) { print CONFIG_HEAVY @non_v, "\n"; # copy config summary format from the myconfig.SH script -print CONFIG_HEAVY "our \$summary : unique = <<'!END!';\n"; +print CONFIG_HEAVY "our \$summary = <<'!END!';\n"; open(MYCONFIG,") && !/^Summary of/; do { print CONFIG_HEAVY $_ } until !defined($_ = ) || /^\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_HEAVY "\n!END!\n", <<'EOT'; my $summary_expanded; @@ -399,6 +398,15 @@ print CONFIG_HEAVY 'foreach my $what (qw(', join (' ', @need_relocation), s/^($what=)(['"])(.*?)\2/$1 . $2 . relocate_inc($3) . $2/me; } EOT +# Currently it only makes sense to do the ... relocation on Unix, so there's +# no need to emulate the "which separator for this platform" logic in perl.c - +# ':' will always be applicable +if ($need_relocation{otherlibdirs}) { +print CONFIG_HEAVY << 'EOT'; +s{^(otherlibdirs=)(['"])(.*?)\2} + {$1 . $2 . join ':', map {relocate_inc($_)} split ':', $3 . $2}me; +EOT +} } print CONFIG_HEAVY <<'EOT'; @@ -406,18 +414,22 @@ s/(byteorder=)(['"]).*?\2/$1$2$Config::byteorder$2/m; my $config_sh_len = length $_; -our $Config_SH_expanded : unique = "\n$_" . << 'EOVIRTUAL'; +our $Config_SH_expanded = "\n$_" . << 'EOVIRTUAL'; EOT 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_HEAVY "${prefix}_nolargefiles='$value'\n"; + if (defined $withlargefiles) { + $value =~ s/\Q$withlargefiles\E\b//; + print CONFIG_HEAVY "${prefix}_nolargefiles='$value'\n"; + } } foreach my $prefix (qw(libs libswanted)) { my $value = fetch_string ({}, $prefix); + my $withlf = fetch_string ({}, 'libswanted_uselargefiles'); + next unless defined $withlf; my @lflibswanted = split(' ', fetch_string ({}, 'libswanted_uselargefiles')); if (@lflibswanted) { @@ -585,7 +597,9 @@ foreach my $key (keys %Common) { $value =~ s!\\!\\\\!g; $value =~ s!'!\\'!g; $value = "'$value'"; - if ($need_relocation{$key}) { + if ($key eq 'otherlibdirs') { + $value = "join (':', map {relocate_inc(\$_)} split (':', $value))"; + } elsif ($need_relocation{$key}) { $value = "relocate_inc($value)"; } } else { @@ -599,20 +613,21 @@ if ($Common{byteorder}) { } my $fast_config = join '', map { " $_,\n" } sort values %Common; +# Sanity check needed to stop an infite loop if Config_heavy.pl fails to define +# &launcher for some reason (eg it got truncated) print CONFIG sprintf <<'ENDOFTIE', $fast_config; sub DESTROY { } sub AUTOLOAD { require 'Config_heavy.pl'; - goto \&launcher; + goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/; die "&Config::AUTOLOAD failed on $Config::AUTOLOAD"; } +# tie returns the object, so the value returned to require will be true. tie %%Config, 'Config', { %s}; - -1; ENDOFTIE @@ -844,11 +859,14 @@ EOS $cross =~ s/\*\*\*replace-marker\*\*\*/$Opts{cross}/g; print CROSS $cross; close CROSS; + 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; die "$0: $Config_PM not valid"