This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf16_to_utf8_reversed() should croak early when passed an odd byte length.
[perl5.git] / pod / buildtoc
old mode 100644 (file)
new mode 100755 (executable)
index 50120ea..83eb447
@@ -15,7 +15,7 @@ use Carp;
 no locale;
 
 $Up = File::Spec->updir;
-$masterpodfile = File::Spec->catdir($Up, "pod.lst");
+$masterpodfile = File::Spec->catfile($Up, "pod.lst");
 
 # Generate any/all of these files
 # --verbose gives slightly more output
@@ -29,12 +29,12 @@ $masterpodfile = File::Spec->catdir($Up, "pod.lst");
      toc => "perltoc.pod",
      manifest => File::Spec->catdir($Up, "MANIFEST"),
      perlpod => "perl.pod",
-     vms => File::Spec->catdir($Up, "vms", "descrip_mms.template"),
-     nmake => File::Spec->catdir($Up, "win32", "Makefile"),
-     dmake => File::Spec->catdir($Up, "win32", "makefile.mk"),
-     podmak => File::Spec->catdir($Up, "win32", "pod.mak"),
+     vms => File::Spec->catfile($Up, "vms", "descrip_mms.template"),
+     nmake => File::Spec->catfile($Up, "win32", "Makefile"),
+     dmake => File::Spec->catfile($Up, "win32", "makefile.mk"),
+     podmak => File::Spec->catfile($Up, "win32", "pod.mak"),
      # plan9 =>  File::Spec->catdir($Up, "plan9", "mkfile"),
-     unix => File::Spec->catdir($Up, "Makefile.SH"),
+     unix => File::Spec->catfile($Up, "Makefile.SH"),
      # TODO: add roffitall
     );
 
@@ -209,9 +209,13 @@ close MASTER;
     warn "$0: $i exists but is unknown by perl.pod\n"
        if !$perlpods{$i} && !exists $sources{$i};
   }
+  my @BuildTargets = grep {defined} @Targets{grep $_ ne 'all', keys %Build};
+  my %BuildFiles;
+  @BuildFiles{@BuildTargets} = @BuildTargets;
+  
   foreach my $i (sort keys %our_pods) {
     warn "$0: $i is known by buildtoc but does not exist\n"
-      unless $disk_pods{$i};
+      unless $disk_pods{$i} or $BuildFiles{$i};
   }
   foreach my $i (sort keys %manipods) {
     warn "$0: $i is known by ../MANIFEST but does not exist\n"
@@ -221,11 +225,11 @@ close MASTER;
   }
   foreach my $i (sort keys %perlpods) {
     warn "$0: $i is known by perl.pod but does not exist\n"
-      unless $disk_pods{$i};
+      unless $disk_pods{$i} or $BuildFiles{$i};
   }
 }
 
-# Find all the mdoules
+# Find all the modules
 {
   my @modpods;
   find \&getpods => qw(../lib ../ext);
@@ -253,9 +257,11 @@ close MASTER;
          if ($line =~ /^=head1\s+NAME\b/) {
            push @modpods, $file;
            #warn "GOOD $file\n";
+           close F;
            return;
          }
        }
+       close F;
        warn "$0: $file: cannot find =head1 NAME\n" unless $Quiet;
       }
     }
@@ -371,6 +377,7 @@ EOPOD2B
   s/^\t//gm;
   output $_;
   output "\n";                    # flush $LINE
+  close OUT;
 }
 
 # Below are all the auxiliary routines for generating perltoc.pod
@@ -381,6 +388,8 @@ sub podset {
     local @ARGV = @_;
     my $pod;
 
+    return unless scalar(@ARGV);
+
     while(<>) {
        tr/\015//d;
        if (s/^=head1 (NAME)\s*/=head2 /) {
@@ -699,8 +708,10 @@ sub do_unix {
   my $makefile_SH = join '', @_;
   die "$0: $name contains NUL bytes" if $makefile_SH =~ /\0/;
 
-  $makefile_SH =~ s{^(generated_pods = extra.pods).*}
-                  {join ' ', $1, map "pod/$_", sort keys %Generated, keys %Copies}mge;
+  $makefile_SH =~ s{^(perltoc_pod_prereqs = extra.pods).*}
+                  {join ' ', $1, map "pod/$_",
+                       sort keys %Copies, grep {!/perltoc/} keys %Generated
+                   }mge;
 
 # pod/perldelta.pod: pod/perl511delta.pod
 #      cd pod && $(LNS) perl511delta.pod perldelta.pod
@@ -726,6 +737,7 @@ pod/$_: pod/$Copies{$_}
 
 my $built;
 while (my ($target, $name) = each %Targets) {
+  print "Working on target $target\n" if $Verbose;
   next unless $Build{$target};
   $built++;
   if ($target eq "toc") {