Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 1 | This patch is used for perl-native only. It enables the switching of |
| 2 | configuration files between Config_heavy.pl and |
| 3 | Config_heavy-target.pl by setting the environment variables |
| 4 | PERLCONFIGTARGET - the later containing settings for the target while |
| 5 | the former contains those for the host. This will allow cpan.bbclass |
| 6 | to use the settings appropriate for the native and/or target builds |
| 7 | as required. This also disables the use of the cache since the cached |
| 8 | values would be valid for the host only. |
| 9 | |
| 10 | Upstream-Status: Inappropriate [native] |
| 11 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
| 12 | |
| 13 | Index: 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 | } |