This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Module-CoreList is 5.20151020 on teh CPAN
[perl5.git] / Porting / pod_rules.pl
index 6157183..0d837bf 100644 (file)
@@ -6,6 +6,11 @@ use Text::Tabs;
 use Text::Wrap;
 use Getopt::Long;
 
+if (ord("A") == 193) {
+    print "1..0 # EBCDIC sort order is different\n";
+    exit;
+}
+
 # Generate the sections of files listed in %Targets from pod/perl.pod
 # Mostly these are rules in Makefiles
 #
@@ -21,6 +26,7 @@ use Getopt::Long;
             vms => 'vms/descrip_mms.template',
             nmake => 'win32/Makefile',
             dmake => 'win32/makefile.mk',
+            gmake => 'win32/GNUmakefile',
             podmak => 'win32/pod.mak',
             unix => 'Makefile.SH',
             # plan9 =>  'plan9/mkfile',
@@ -57,7 +63,7 @@ sub my_die;
 }
 
 if ($Verbose) {
-    print "I will be building $_\n" foreach keys %Build;
+    print "I will be building $_\n" foreach sort keys %Build;
 }
 
 my $test = 1;
@@ -68,10 +74,10 @@ my $state = $Test
     ? get_pod_metadata(0, sub {
                            printf "1..%d\n", 1 + scalar keys %Build;
                            if (@_) {
-                               print "not ok $test\n";
+                               print "not ok $test # got Pod metadata\n";
                                die @_;
                            }
-                           print "ok $test\n";
+                           print "ok $test # got Pod metadata\n";
                        })
     : get_pod_metadata(1, sub { warn @_ if @_ }, values %Build);
 
@@ -129,16 +135,6 @@ sub generate_pod_mak {
     $line;
 }
 
-sub verify_contiguous {
-    my ($name, $content, $re, $what) = @_;
-    require Carp;
-    $content =~ s/$re/\0/g;
-    my $sections = () = $content =~ m/\0+/g;
-    Carp::croak("$0: $name contains no $what") if $sections < 1;
-    Carp::croak("$0: $name contains discontiguous $what") if $sections > 1;
-    return $content;
-}
-
 sub do_manifest {
     my ($name, $prev) = @_;
     my @manifest =
@@ -169,6 +165,7 @@ sub do_nmake {
 
 # shut up used only once warning
 *do_dmake = *do_dmake = \&do_nmake;
+*do_gmake = *do_gmake = \&do_nmake;
 
 sub do_podmak {
     my ($name, $body) = @_;
@@ -227,38 +224,7 @@ pod/$_: pod/$state->{copies}{$_}
 }
 
 # Do stuff
-while (my ($target, $name) = each %Build) {
-    print "Now processing $name\n" if $Verbose;
-
-    my $orig = slurp_or_die($name);
-    my_die "$name contains NUL bytes" if $orig =~ /\0/;
-
-    my $new = do {
-        no strict 'refs';
-        &{"do_$target"}($target, $orig);
-    };
-
-    if ($Test) {
-        printf "%s %d # $name is up to date\n",
-            $new eq $orig ? 'ok' : 'not ok',
-                ++$test;
-        next;
-    } elsif ($new eq $orig) {
-        print "Was not modified\n"
-            if $Verbose;
-        next;
-    }
+process($_, $Build{$_}, main->can("do_$_"), $Test && ++$test, $Verbose)
+    foreach sort keys %Build;
 
-    my $mode = (stat $name)[2] // my_die "Can't stat $name: $!";
-    rename $name, "$name.old" or my_die "Can't rename $name to $name.old: $!";
-
-    write_or_die($name, $new);
-    chmod $mode & 0777, $name or my_die "can't chmod $mode $name: $!";
-}
-
-# Local variables:
-# cperl-indent-level: 4
-# indent-tabs-mode: nil
-# End:
-#
 # ex: set ts=8 sts=4 sw=4 et: