diff options
author | joe <joe@FreeBSD.org> | 2001-04-05 13:59:51 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2001-04-05 13:59:51 +0000 |
commit | 938fa0f26ba95dab039bd28edf94c4ed0dd165bf (patch) | |
tree | c76cc18858fec464d511cae70ea551e84bdccc7f /gnu | |
parent | 911e6f337bf14f9113f37894ab9c1a26b62a6c1f (diff) | |
download | FreeBSD-src-938fa0f26ba95dab039bd28edf94c4ed0dd165bf.zip FreeBSD-src-938fa0f26ba95dab039bd28edf94c4ed0dd165bf.tar.gz |
Fix a few bugs in BSDPAN:
* Fix a bug which prevented the second invocation of overloaded
subs governed by SelfLoader from functioning.
* Fix a bug with XS modules. MakeMaker determines where the xsubpp
preprocessor is located by adding "ExtUtils" string to the Perl's
system path. At the same time, BSDPAN has to fool MakeMaker into
thinking that the Perl's system path is elsewhere. Now we
`reverse-adjust' the notion of the Perl's system path for a
moment, so xsubpp utility is found.
This should fix the breakage with some p5- ports.
Reported by: vanilla
Submitted by: Anton Berezin <tobez@tobez.org>
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm | 18 | ||||
-rw-r--r-- | gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm | 22 |
2 files changed, 30 insertions, 10 deletions
diff --git a/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm b/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm index f7e8030..5e667ee 100644 --- a/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm +++ b/gnu/usr.bin/perl/BSDPAN/BSDPAN/Override.pm @@ -93,14 +93,16 @@ sub override ($$) { # Ouch! Don't ask. :-) eval <<EOF; *$name = sub { - \$replacement_sub->( sub { - \$SelfLoader::AUTOLOAD = "$name"; - local \$SIG{__WARN__} = sub {}; - my \@r = \$sl_autoload->(\@_); - my \$real_addr = "*$name\{CODE}"; - *$name = sub { \$replacement_sub->( - \$real_addr, \@_) }; - }, \@_) + \$replacement_sub->( sub { + \$SelfLoader::AUTOLOAD = "$name"; + local \$SIG{__WARN__} = sub {}; + my \@r = \$sl_autoload->(\@_); + my \$real_addr = eval "*$name\{CODE}"; + my \$repsub2 = \$replacement_sub; + eval "*\$name = sub { + \\\$repsub2->( + \\\$real_addr, \\\@_) };"; + }, \@_) }; EOF } else { diff --git a/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm b/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm index 43acdae..5bfcf59 100644 --- a/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm +++ b/gnu/usr.bin/perl/BSDPAN/ExtUtils/MM_Unix.pm @@ -24,7 +24,9 @@ sub init_main { # MakeMaker insist to use perl system path first; # free it of this misconception, since we know better. - $him->{PERL_LIB} = BSDPAN->path; + $him->{PERL_LIB_REAL} = $him->{PERL_LIB}; + $him->{PERL_LIB_BSDPAN} = BSDPAN->path; + $him->{PERL_LIB} = $him->{PERL_LIB_BSDPAN}; # MakeMaker is pretty lame when the user specifies PREFIX. # It has too fine granularity regarding the various places @@ -57,8 +59,20 @@ sub init_main { return @r; } +sub tool_xsubpp { + my $orig = shift; + my $him = $_[0]; + + $him->{PERL_LIB} = $him->{PERL_LIB_REAL}; + my @r = &$orig; + $him->{PERL_LIB} = $him->{PERL_LIB_BSDPAN}; + + return @r; +} + BEGIN { override 'init_main', \&init_main; + override 'tool_xsubpp', \&tool_xsubpp; } 1; @@ -72,7 +86,7 @@ BSDPAN::ExtUtils::MM_Unix - Override ExtUtils::MM_Unix functionality =head1 DESCRIPTION -BSDPAN::ExtUtils::MM_Unix overrides init_main() sub of the standard perl +BSDPAN::ExtUtils::MM_Unix overrides two subs from the standard perl module ExtUtils::MM_Unix. The overridden init_main() first calls the original init_main(). Then, @@ -80,6 +94,10 @@ if the Perl port build is detected, and the PREFIX stored in the ExtUtils::MM_Unix object is not F</usr/local/>, it proceeds to change various installation paths ExtUtils::MM_Unix maintains, to match PREFIX. +The overridden tool_xsubpp() sub temporarily undoes the change in the +environment done by the overridden init_main(), so that xsubpp(1) and +other XS tools will be searched in the right place. + Thus, BSDPAN::ExtUtils::MM_Unix is responsible for making p5- ports PREFIX-clean. |