This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
re.pm: correct typo
[perl5.git] / make_ext.pl
index a4a6ea7..1305e0e 100644 (file)
@@ -29,10 +29,10 @@ my $is_Unix = !$is_Win32 && !$is_VMS;
 # environment variables on VMS
 my @toolchain = qw(cpan/AutoLoader/lib
                   dist/Cwd dist/Cwd/lib
-                  cpan/ExtUtils-Command/lib
+                  dist/ExtUtils-Command/lib
                   dist/ExtUtils-Install/lib
                   cpan/ExtUtils-MakeMaker/lib
-                  cpan/ExtUtils-Manifest/lib
+                  dist/ExtUtils-Manifest/lib
                   cpan/File-Path/lib
                   );
 
@@ -47,7 +47,7 @@ my $ext_dirs_re = '(?:' . join('|', @ext_dirs) . ')';
 # It's actually a cut and shut of the Unix version ext/utils/makeext and the
 # Windows version win32/build_ext.pl hence the two invocation styles.
 
-# On Unix, it primarily used by the perl Makefile one extention at a time:
+# On Unix, it primarily used by the perl Makefile one extension at a time:
 #
 # d_dummy $(dynamic_ext): miniperl preplibrary FORCE
 #      @$(RUN) ./miniperl make_ext.pl --target=dynamic $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
@@ -56,7 +56,7 @@ my $ext_dirs_re = '(?:' . join('|', @ext_dirs) . ')';
 # If '--static' is specified, static extensions will be built.
 # If '--dynamic' is specified, dynamic extensions will be built.
 # If '--nonxs' is specified, nonxs extensions will be built.
-# If '--dynaloader' is specificied, DynaLoader will be built.
+# If '--dynaloader' is specified, DynaLoader will be built.
 # If '--all' is specified, all extensions will be built.
 #
 #    make_ext.pl "MAKE=make [-make_opts]" --dir=directory [--target=target] [--static|--dynamic|--all] +ext2 !ext1
@@ -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.
@@ -360,7 +370,7 @@ use ExtUtils::MakeMaker;
 # hash.
 my @temps = 'Makefile.PL';
 foreach (glob('scripts/pod*.PL')) {
-    # The various pod*.PL extrators change directory. Doing that with relative
+    # The various pod*.PL extractors change directory. Doing that with relative
     # paths in @INC breaks. It seems the lesser of two evils to copy (to avoid)
     # the chdir doing anything, than to attempt to convert lib paths to
     # absolute, and potentially run into problems with quoting special
@@ -377,7 +387,7 @@ my $script_ext = $^O eq 'VMS' ? '.com' : '';
 my %%pod_scripts;
 foreach (glob('pod*.PL')) {
     my $script = $_;
-    s/.PL$/$script_ext/;
+    s/.PL$/$script_ext/i;
     $pod_scripts{$script} = $_;
 }
 my @exe_files = values %%pod_scripts;
@@ -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,