X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FB%2FMakefile.PL;h=4a1e425ac1bf9ec76a82385fda38a54553649ef7;hb=f18deeb9b59cda663e9ec1025829a38e0553d38b;hp=cdcc4ed71b412c98545d75a145bb66d022ebfde7;hpb=f7d144c835d02593edb2388cf7cb0c7395c53ae2;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/B/Makefile.PL b/ext/B/Makefile.PL index cdcc4ed..4a1e425 100644 --- a/ext/B/Makefile.PL +++ b/ext/B/Makefile.PL @@ -1,9 +1,11 @@ use ExtUtils::MakeMaker; use Config; +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'; @@ -14,33 +16,50 @@ if ($^O eq 'MSWin32') { } WriteMakefile( - NAME => "B", - VERSION => "a5", - MAN3PODS => ' ', - clean => { - FILES => "perl$e byteperl$e *$o B.c *~" + NAME => "B", + VERSION_FROM => "B.pm", + PL_FILES => { 'defsubs_h.PL' => 'defsubs.h' }, + MAN3PODS => {}, + clean => { + FILES => "perl$e *$o B.c defsubs.h *~" } ); -sub MY::post_constants { - "\nLIBS = $Config{libs}\n" +package MY; + +sub post_constants { + "\nLIBS = $Config::Config{libs}\n" +} + +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"); + } } -# Leave out doing byteperl for now. Probably should be built in the -# core directory or somewhere else rather than here -#sub MY::top_targets { -# my $self = shift; -# my $targets = $self->MM::top_targets(); -# $targets =~ s/^(all ::.*)$/$1 byteperl$e/m; -# return <<"EOT" . $targets; - -# -# byteperl is *not* a standard perl+XSUB executable. It's a special -# program for running standalone bytecode executables. It isn't an XSUB -# at the moment because a standlone Perl program needs to set up curpad -# which is overwritten on exit from an XSUB. -# -#byteperl$e : byteperl$o B$o \$(PERL_SRC)/byterun$o -# \$(CC) ${exeout_flag}byteperl$e byteperl$o B$o byterun$o \$(LDFLAGS) \$(PERL_ARCHLIB)/CORE/$Config{libperl} \$(LIBS) -#EOT -#} +sub MY::postamble { + 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 :: @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; +}