diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-05 19:30:59 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-05 19:30:59 +0100 |
commit | d3bc6aa63a6a5b0edf9948f07d2571be8049339c (patch) | |
tree | 1a028fd11998eb2951c0a580e0168328ce3146b5 /make_ext.pl | |
parent | ce41b7f24c1dd8024fc3b77f9c85f8b0d85908ef (diff) | |
download | perl-d3bc6aa63a6a5b0edf9948f07d2571be8049339c.tar.gz |
Generate the core-only Makefile.PL for podlators using make_ext.
Using make_ext to generate it uses less code than committing a special
core-only Makefile.PL to the repository, and is no more complex.
Diffstat (limited to 'make_ext.pl')
-rw-r--r-- | make_ext.pl | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/make_ext.pl b/make_ext.pl index a4a6ea7b87..8f3e6dbf42 100644 --- a/make_ext.pl +++ b/make_ext.pl @@ -321,29 +321,39 @@ 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; + my ($fromname, $key, $value); + if ($mname eq 'podlators') { + # We need to special case this somewhere, and this is fewer + # lines of code than a core-only Makefile.PL, and no more + # complex + $fromname = 'VERSION'; + $key = 'DISTNAME'; + $value = 'podlators'; + $mname = 'Pod'; + } else { + $key = 'ABSTRACT_FROM'; + # 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"); + foreach (@locations) { + if (-f $_) { + $fromname = $_; + last; + } } - } - unless ($fromname) { - die "For $mname tried @locations in in $ext_dir but can't find source"; + unless ($fromname) { + die "For $mname tried @locations in in $ext_dir but can't find source"; + } + ($value = $fromname) =~ s/\.pm\z/.pod/; + $value = $fromname unless -e $value; } - my $pod_name; - ($pod_name = $fromname) =~ s/\.pm\z/.pod/; - $pod_name = $fromname unless -e $pod_name; open my $fh, '>', 'Makefile.PL' or die "Can't open Makefile.PL for writing: $!"; - printf $fh <<'EOM', $0, $mname, $fromname, $pod_name; + printf $fh <<'EOM', $0, $mname, $fromname, $key, $value; #-*- buffer-read-only: t -*- # This Makefile.PL was written by %s. @@ -385,7 +395,7 @@ my @exe_files = values %%pod_scripts; WriteMakefile( NAME => '%s', VERSION_FROM => '%s', - ABSTRACT_FROM => '%s', + %-13s => '%s', realclean => { FILES => "@temps" }, (%%pod_scripts ? ( PL_FILES => \%%pod_scripts, |