This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
msgrcv: properly downgrade the receive buffer
[perl5.git] / mkppport
index 8cfc8e9..b463aaf 100644 (file)
--- a/mkppport
+++ b/mkppport
@@ -2,17 +2,17 @@ use strict;
 use warnings;
 
 use Getopt::Long;
-use Pod::Usage;
 use File::Spec;
 use File::Compare qw( compare );
 use File::Copy qw( copy );
 use File::Basename qw( dirname );
 
-sub iterdirs(&);
+use feature 'signatures';
+no warnings 'experimental::signatures';
 
 my $rootdir = dirname($0);
 
-unshift @INC, File::Spec->catdir($rootdir, qw(ext ExtUtils-MakeMaker t lib));
+unshift @INC, File::Spec->catdir($rootdir, qw(cpan ExtUtils-MakeMaker t lib));
 
 eval q{ use MakeMaker::Test::Utils qw( which_perl ) };
 $@ and die $@;
@@ -22,7 +22,10 @@ my %opt = (
   clean  => 0,
 );
 
-GetOptions(\%opt, qw( clean list=s )) or pod2usage(2);
+unless ( GetOptions(\%opt, qw( clean list=s )) ) {
+  require Pod::Usage;
+  Pod::Usage::pod2usage(2);
+}
 
 my $absroot = File::Spec->rel2abs($rootdir);
 my @destdirs = readlist($opt{list});
@@ -35,15 +38,14 @@ unless (@destdirs) {
 
 # Remove all installed ppport.h files
 if ($opt{clean}) {
-  iterdirs {
-    my($dir, $fulldir) = @_;
+  iterdirs( sub ($dir, $fulldir) {
     my $dest = File::Spec->catfile($fulldir, 'ppport.h');
     if (-f $dest) {
       print "removing ppport.h for $dir\n";
       unlink $dest or warn "WARNING: could not remove $dest: $!\n";
       1 while unlink $dest;  # remove any remaining versions
     }
-  };
+  } );
   exit 0;
 }
 
@@ -56,7 +58,7 @@ unshift @INC, File::Spec->catdir($absroot, 'lib');
 
 # Change to Devel::PPPort directory, as it needs the stuff
 # from the parts/ directory
-chdir File::Spec->catdir($rootdir, 'ext', 'Devel-PPPort');
+chdir File::Spec->catdir($rootdir, 'dist', 'Devel-PPPort');
 
 # Capture and remove temporary files
 my @unlink;
@@ -81,8 +83,7 @@ unless (-e 'ppport.h') {
 }
 
 # Now install the created ppport.h into extension directories
-iterdirs {
-  my($dir, $fulldir) = @_;
+iterdirs( sub ($dir, $fulldir) {
   my $dest = File::Spec->catfile($fulldir, 'ppport.h');
   if (compare('ppport.h', $dest)) {
     print "installing ppport.h for $dir\n";
@@ -91,17 +92,15 @@ iterdirs {
   else {
     print "ppport.h in $dir is up-to-date\n";
   }
-};
+} );
 
 exit 0;
 
 #---------------------------------------
 # Iterate through extension directories
 #---------------------------------------
-sub iterdirs(&)
+sub iterdirs($code)
 {
-  my $code = shift;
-  
   for my $dir (@destdirs) {
     my $fulldir = File::Spec->catdir($absroot, $dir);
     if (-d $fulldir) {
@@ -116,9 +115,8 @@ sub iterdirs(&)
 #----------------------------------------
 # Read the list of extension directories
 #----------------------------------------
-sub readlist
+sub readlist($list)
 {
-  my $list = shift;
   my @dirs;
   open LIST, $list or die "$list: $!\n";
   while (<LIST>) {
@@ -158,7 +156,8 @@ mkppport [B<--list>=I<file>] [B<--clean>]
 
 B<mkppport> generates a I<ppport.h> file using Devel::PPPort
 and distributes it to the various extension directories that
-need it to build.
+need it to build.  On certain Win32 builds, this script is not
+used and an alternative mechanism is used to create I<ppport.h>.
 
 =head1 OPTIONS