UCD 5.1.0
[p5sagit/p5-mst-13.2.git] / pod / buildtoc
index 86d5ba7..de88d8d 100644 (file)
@@ -32,6 +32,8 @@ $masterpodfile = File::Spec->catdir($Up, "pod.lst");
      dmake => File::Spec->catdir($Up, "win32", "makefile.mk"),
      podmak => File::Spec->catdir($Up, "win32", "pod.mak"),
      # plan9 =>  File::Spec->catdir($Up, "plan9", "mkfile"),
+     unix => File::Spec->catdir($Up, "Makefile.SH"),
+     # TODO: add roffitall
     );
 
 {
@@ -68,7 +70,6 @@ __USAGE__
 # Don't copy these top level READMEs
 %Ignore
   = (
-     Y2K => 1,
      micro => 1,
 #     vms => 1,
      );
@@ -273,7 +274,7 @@ close MASTER;
   }
 }
 
-# OK. Now a lot of ancillay function definitions follow
+# OK. Now a lot of ancillary function definitions follow
 # Main program returns at "Do stuff"
 
 sub path2modname {
@@ -382,6 +383,8 @@ sub podset {
            unhead1();
            output "\n \n\n=head2 ";
            $_ = <>;
+           # Remove svn keyword expansions from the Perl FAQ
+           s/ \(\$Revision: \d+ \$\)//g;
            if ( /^\s*$pod\b/ ) {
                s/$pod\.pm/$pod/;       # '.pm' in NAME !?
                output $_;
@@ -540,16 +543,16 @@ sub generate_descrip_mms_1 {
   local $Text::Wrap::columns = 150;
   my $count = 0;
   my @lines = map {"pod" . $count++ . " = $_"}
-    split /\n/, wrap('', '', join " ", map "[.lib.pod]$_.pod",
+    split /\n/, wrap('', '', join " ", map "[.lib.pods]$_.pod",
                     sort keys %Pods, keys %Readmepods);
   @lines, "pod = " . join ' ', map {"\$(pod$_)"} 0 .. $count - 1;
 }
 
 sub generate_descrip_mms_2 {
   map {sprintf <<'SNIP', $_, $_ eq 'perlvms' ? 'vms' : 'pod', $_}
-[.lib.pod]%s.pod : [.%s]%s.pod
-       @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
-       Copy/NoConfirm/Log $(MMS$SOURCE) [.lib.pod]
+[.lib.pods]%s.pod : [.%s]%s.pod
+       @ If F$Search("[.lib]pods.dir").eqs."" Then Create/Directory [.lib.pods]
+       Copy/NoConfirm/Log $(MMS$SOURCE) [.lib.pods]
 SNIP
    sort keys %Pods, keys %Readmepods;
 }
@@ -627,7 +630,7 @@ sub do_perlpod {
                   )+
                  }
          {$1 . join "", &generate_perlpod}mxe) {
-    die "$0: Failed to insert ammendments in do_perlpod";
+    die "$0: Failed to insert amendments in do_perlpod";
   }
   $pod;
 }
@@ -657,13 +660,13 @@ sub do_vms {
   die "$0: $name contains NUL bytes" if $makefile =~ /\0/;
 
 # Looking for rules like this
-# [.lib.pod]perl.pod : [.pod]perl.pod
-#      @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
-#      Copy/NoConfirm/Log $(MMS$SOURCE) [.lib.pod]
+# [.lib.pods]perl.pod : [.pod]perl.pod
+#      @ If F$Search("[.lib]pods.dir").eqs."" Then Create/Directory [.lib.pods]
+#      Copy/NoConfirm/Log $(MMS$SOURCE) [.lib.pods]
 
-  $makefile =~ s/\n\Q[.lib.pod]\Eperl[^\n\.]*\.pod[^\n]+\n
+  $makefile =~ s/\n\Q[.lib.pods]\Eperl[^\n\.]*\.pod[^\n]+\n
                 [^\n]+\n       # Another line
-                [^\n]+\Q[.lib.pod]\E\n         # ends [.lib.pod]
+                [^\n]+\Q[.lib.pods]\E\n                # ends [.lib.pods]
                    /\0/gsx;
   $sections = () = $makefile =~ m/\0+/g;
   die "$0: $name contains no copy rules" if $sections < 1;
@@ -673,6 +676,27 @@ sub do_vms {
   $makefile;
 }
 
+sub do_unix {
+  my $name = shift;
+  my $makefile_SH = join '', @_;
+  die "$0: $name contains NUL bytes" if $makefile_SH =~ /\0/;
+
+  $makefile_SH =~ s/\n\s+-\@test -f \S+ && cd pod && \$\(LNS\) \S+ \S+ && cd \.\. && echo "\S+" >> extra.pods \# See buildtoc\n/\0/gm;
+
+  my $sections = () = $makefile_SH =~ m/\0+/g;
+
+  die "$0: $name contains no copy rules" if $sections < 1;
+  die "$0: $name contains $sections discontigous copy rules"
+    if $sections > 1;
+
+  my @copy_rules = map "\t-\@test -f pod/$Copies{$_} && cd pod && \$(LNS) $Copies{$_} $_ && cd .. && echo \"pod/$_\" >> extra.pods # See buildtoc",
+    keys %Copies;
+
+  $makefile_SH =~ s/\0+/join "\n", '', @copy_rules, ''/se;
+  $makefile_SH;
+
+}
+
 # Do stuff
 
 my $built;