X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=make_ext.pl;h=22a97eb7af7cdc73d62ee2cf736da95ef4c5a7a2;hb=85831461cd8850ede28b33bf03b6fe7a7904e0dc;hp=e9d318d802b02b133a0ba7e139720809a9642e8d;hpb=902aaf3efe5ea7a7c69197eed2e2b4292ca6360c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/make_ext.pl b/make_ext.pl index e9d318d..22a97eb 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -82,6 +82,9 @@ foreach (@extspec) { } elsif (s{^ext/}{}) { # Remove ext/ prefix and /pm_to_blib suffix s{/pm_to_blib$}{}; + # Targets are given as files on disk, but the extension spec is still + # written using /s for each :: + tr!-!/!; } elsif (s{::}{\/}g) { # Convert :: to / } else { @@ -206,12 +209,13 @@ foreach my $spec (@extspec) { print "\tMaking $mname ($target)\n"; build_extension('ext', $ext_pathname, $up, $perl || "$up/miniperl", - "$up/lib", + "$up/lib", $mname, [@pass_through, @{$extra_passthrough{$spec} || []}]); } sub build_extension { - my ($ext, $ext_dir, $return_dir, $perl, $lib_dir, $pass_through) = @_; + my ($ext, $ext_dir, $return_dir, $perl, $lib_dir, $mname, $pass_through) + = @_; unless (chdir "$ext_dir") { warn "Cannot cd to $ext_dir: $!"; return; @@ -229,6 +233,47 @@ sub build_extension { } if (!-f $makefile) { + if (!-f 'Makefile.PL') { + print "\nCreating Makefile.PL in $ext_dir for $mname\n"; + # We need to cope well with various possible layouts + my @dirs = split /::/, $mname; + my $leaf = pop @dirs; + my $leafname = "$leaf.pm"; + my $pathname = join '/', @dirs, $leafname; + my @locations = ($leafname, $pathname, "lib/$pathname"); + my $fromname; + foreach (@locations) { + if (-f $_) { + $fromname = $_; + last; + } + } + + unless ($fromname) { + die "For $mname tried @locations in in $ext_dir but can't find source"; + } + open my $fh, '>', 'Makefile.PL' + or die "Can't open Makefile.PL for writing: $!"; + print $fh <<"EOM"; +#-*- buffer-read-only: t -*- + +# This Makefile.PL was written by $0. +# It will be deleted automatically by make realclean + +use strict; +use ExtUtils::MakeMaker; + +WriteMakefile( + NAME => '$mname', + VERSION_FROM => '$fromname', + ABSTRACT_FROM => '$fromname', + realclean => {FILES => 'Makefile.PL'}, +); + +# ex: set ro: +EOM + close $fh or die "Can't close Makefile.PL: $!"; + } print "\nRunning Makefile.PL in $ext_dir\n"; # Presumably this can be simplified @@ -246,7 +291,8 @@ sub build_extension { my $libd = VMS::Filespec::vmspath($lib_dir); push @args, "INST_LIB=$libd", "INST_ARCHLIB=$libd"; } else { - push @args, 'INSTALLDIRS=perl', 'INSTALLMAN3DIR=none'; + push @args, 'INSTALLDIRS=perl', 'INSTALLMAN1DIR=none', + 'INSTALLMAN3DIR=none'; } push @args, @$pass_through; _quote_args(\@args) if $is_VMS;