blob: e6f23eed65738761c88478e49e91f9a841360e0a [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001This patch is used for perl-native only. It enables the switching of
2configuration files between Config_heavy.pl and
3Config_heavy-target.pl by setting the environment variables
4PERLCONFIGTARGET - the later containing settings for the target while
5the former contains those for the host. This will allow cpan.bbclass
6to use the settings appropriate for the native and/or target builds
7as required. This also disables the use of the cache since the cached
8values would be valid for the host only.
9
10Upstream-Status: Inappropriate [native]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12
13Index: perl-5.14.2/configpm
14===================================================================
15--- perl-5.14.2.orig/configpm
16+++ perl-5.14.2/configpm
17@@ -658,7 +658,7 @@ sub FETCH {
18 my($self, $key) = @_;
19
20 # check for cached value (which may be undef so we use exists not defined)
21- return exists $self->{$key} ? $self->{$key} : $self->fetch_string($key);
22+ return $self->fetch_string($key);
23 }
24
25 ENDOFEND
26@@ -816,7 +816,21 @@ $config_txt .= sprintf <<'ENDOFTIE', $fa
27 sub DESTROY { }
28
29 sub AUTOLOAD {
30- require 'Config_heavy.pl';
31+ my $cfgfile = 'Config_heavy.pl';
32+ if (defined $ENV{PERLCONFIGTARGET} and $ENV{PERLCONFIGTARGET} eq "yes")
33+ {
34+ $cfgfile = 'Config_heavy-target.pl';
35+ }
36+ if (defined $ENV{PERL_ARCHLIB})
37+ {
38+ push @INC, $ENV{PERL_ARCHLIB};
39+ require $cfgfile;
40+ pop @INC;
41+ }
42+ else
43+ {
44+ require $cfgfile;
45+ }
46 goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/;
47 die "&Config::AUTOLOAD failed on $Config::AUTOLOAD";
48 }