summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-06-19 18:32:59 +0000
committerNicholas Clark <nick@ccl4.org>2007-06-19 18:32:59 +0000
commitb7254abcd458ced5f5357ad0fd808fa82e099c55 (patch)
treef72178e54bd2a1ea844090a9843575542625ce3b /ext
parentadc11f0b907360e0200070e6c61df037613107d4 (diff)
downloadperl-b7254abcd458ced5f5357ad0fd808fa82e099c55.tar.gz
Work on getting B compiling outside of the perl source tree.
p4raw-id: //depot/perl@31422
Diffstat (limited to 'ext')
-rw-r--r--ext/B/Makefile.PL31
-rw-r--r--ext/B/defsubs_h.PL6
2 files changed, 28 insertions, 9 deletions
diff --git a/ext/B/Makefile.PL b/ext/B/Makefile.PL
index d59e9d7720..4a1e425ac1 100644
--- a/ext/B/Makefile.PL
+++ b/ext/B/Makefile.PL
@@ -5,6 +5,7 @@ use File::Spec;
my $e = $Config{'exe_ext'};
my $o = $Config{'obj_ext'};
my $exeout_flag = '-o ';
+my $core = grep { $_ eq 'PERL_CORE=1' } @ARGV;
if ($^O eq 'MSWin32') {
if ($Config{'cc'} =~ /^cl/i) {
$exeout_flag = '-Fe';
@@ -30,19 +31,35 @@ sub post_constants {
"\nLIBS = $Config::Config{libs}\n"
}
-sub upupfile {
- File::Spec->catfile(File::Spec->updir,
- File::Spec->updir, $_[0]);
+sub headerfilefile {
+ push @makefileopts, MAN3PODS => {};
+}
+
+sub headerpath {
+ if ($core) {
+ return File::Spec->catdir(File::Spec->updir,
+ File::Spec->updir);
+ } else {
+ return File::Spec->catdir($Config::Config{archlibexp}, "CORE");
+ }
}
sub MY::postamble {
- my $op_h = upupfile('op.h');
- my $cop_h = upupfile('cop.h');
+ my $headerpath = headerpath();
+ my @headers = map { File::Spec->catfile($headerpath, $_) } qw(op.h cop.h);
my $noecho = shift->{NOECHO};
+
"
B\$(OBJ_EXT) : defsubs.h
-defsubs.h :: $op_h $cop_h defsubs_h.PL
- \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) defsubs_h.PL defsubs.h
+defsubs.h :: @headers defsubs_h.PL
+ \$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB) defsubs_h.PL defsubs.h $headerpath
"
}
+
+sub MY::processPL {
+ my $text = shift->SUPER::processPL(@_);
+ # Append our extra parameter
+ $text =~ s/^\t.*defsubs_h\.PL.*/$& . ' ' . headerpath()/me;
+ $text;
+}
diff --git a/ext/B/defsubs_h.PL b/ext/B/defsubs_h.PL
index 8e8abd252c..f92a26e1d1 100644
--- a/ext/B/defsubs_h.PL
+++ b/ext/B/defsubs_h.PL
@@ -1,7 +1,9 @@
# Do not remove the following line; MakeMaker relies on it to identify
# this file as a template for defsubs.h
# Extracting defsubs.h (with variable substitutions)
-#!perl
+#!perl -w
+use File::Spec;
+my (undef, $headerpath) = @ARGV;
my ($out) = __FILE__ =~ /(^.*)\.PL/i;
$out =~ s/_h$/.h/;
unlink $out if -l $out;
@@ -70,7 +72,7 @@ foreach my $tuple (['op.h'],['cop.h'],['regexp.h','RXf_'])
{
my $file = $tuple->[0];
my $pfx = $tuple->[1] || '';
- my $path = $^O eq 'MacOS' ? ":::$file" : "../../$file";
+ my $path = File::Spec->catfile($headerpath, $file);
open(OPH,"$path") || die "Cannot open $path:$!";
while (<OPH>)
{