Change 28513 by [EMAIL PROTECTED] on 2006/07/09 08:19:33

        Integrate mkppport. All ppport.h files in the core will now
        be autogenerated at build time (and removed during cleanup).

Affected files ...

... //depot/perl/MANIFEST#1428 edit
... //depot/perl/Makefile.SH#362 edit
... //depot/perl/ext/Compress/Raw/Zlib/ppport.h#2 delete
... //depot/perl/ext/Cwd/ppport.h#3 delete
... //depot/perl/ext/Digest/SHA/ppport.h#4 delete
... //depot/perl/ext/Sys/Syslog/ppport.h#2 delete
... //depot/perl/ext/Time/HiRes/ppport.h#4 delete
... //depot/perl/mkppport#1 add
... //depot/perl/mkppport.lst#1 add
... //depot/perl/vms/descrip_mms.template#118 edit
... //depot/perl/win32/Makefile#302 edit
... //depot/perl/win32/Makefile.ce#6 edit
... //depot/perl/win32/ext/Win32API/File/ppport.h#2 delete
... //depot/perl/win32/makefile.mk#340 edit

Differences ...

==== //depot/perl/MANIFEST#1428 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1427~28504~   2006-07-07 18:14:28.000000000 -0700
+++ perl/MANIFEST       2006-07-09 01:19:33.000000000 -0700
@@ -248,7 +248,6 @@
 ext/Compress/Raw/Zlib/fallback/constants.xs    Compress::Raw::Zlib
 ext/Compress/Raw/Zlib/lib/Compress/Raw/Zlib.pm Compress::Raw::Zlib
 ext/Compress/Raw/Zlib/Makefile.PL      Compress::Raw::Zlib
-ext/Compress/Raw/Zlib/ppport.h         Compress::Raw::Zlib
 ext/Compress/Raw/Zlib/private/MakeUtil.pm      Compress::Raw::Zlib
 ext/Compress/Raw/Zlib/README           Compress::Raw::Zlib
 ext/Compress/Raw/Zlib/t/01version.t    Compress::Raw::Zlib
@@ -299,7 +298,6 @@
 ext/Cwd/Changes                        Cwd extension Changelog
 ext/Cwd/Cwd.xs                 Cwd extension external subroutines
 ext/Cwd/Makefile.PL            Cwd extension makefile maker
-ext/Cwd/ppport.h               portability header for Cwd
 ext/Cwd/t/cwd.t                        See if Cwd works
 ext/Cwd/t/taint.t              See if Cwd works with taint
 ext/Cwd/t/win32.t              See if Cwd works on Win32
@@ -500,7 +498,6 @@
 ext/Digest/SHA/bin/shasum      shasum script
 ext/Digest/SHA/Changes         Digest::SHA changes
 ext/Digest/SHA/Makefile.PL     Digest::SHA Makefile.PL
-ext/Digest/SHA/ppport.h                Digest::SHA extension
 ext/Digest/SHA/README          Digest::SHA README
 ext/Digest/SHA/SHA.pm          Digest::SHA extension
 ext/Digest/SHA/SHA.xs          Digest::SHA extension
@@ -1120,7 +1117,6 @@
 ext/Sys/Syslog/README          README for Sys::Syslog
 ext/Sys/Syslog/Syslog.pm       Sys::Syslog extension Perl module
 ext/Sys/Syslog/Syslog.xs       Sys::Syslog extension external subroutines
-ext/Sys/Syslog/ppport.h                portability header for Sys::Syslog
 ext/Sys/Syslog/t/00-load.t     test for Sys::Syslog
 ext/Sys/Syslog/t/constants.t   test for Sys::Syslog
 ext/Sys/Syslog/t/syslog.t      See if Sys::Syslog works
@@ -1208,7 +1204,6 @@
 ext/Time/HiRes/HiRes.pm                Time::HiRes extension
 ext/Time/HiRes/HiRes.xs                Time::HiRes extension
 ext/Time/HiRes/Makefile.PL     Time::HiRes extension
-ext/Time/HiRes/ppport.h                portability header for Time::HiRes
 ext/Time/HiRes/t/HiRes.t       Test for Time::HiRes
 ext/Time/HiRes/typemap         Time::HiRes extension
 ext/Unicode/Normalize/Changes  Unicode::Normalize
@@ -2715,6 +2710,8 @@
 mint/stdio.h                   MiNT port
 mint/sys/time.h                        MiNT port
 mint/time.h                    MiNT port
+mkppport                       A script that distributes ppport.h
+mkppport.lst                   List of extensions that need a ppport.h
 mpeix/mpeix.c                  MPE/iX port
 mpeix/mpeixish.h               MPE/iX port
 mpeix/mpeix_setjmp.c           MPE/iX port
@@ -3717,7 +3714,6 @@
 win32/ext/Win32API/File/File.pm                                Win32API::File 
extension
 win32/ext/Win32API/File/File.xs                                Win32API::File 
extension
 win32/ext/Win32API/File/Makefile.PL                    Win32API::File 
extension makefile write
-win32/ext/Win32API/File/ppport.h                       Win32API::File extension
 win32/ext/Win32API/File/README                         Win32API::File 
extension Readme
 win32/ext/Win32API/File/t/file.t                       See if Win32API::File 
extension works
 win32/ext/Win32API/File/t/tie.t                                See if 
Win32API::File extension works

==== //depot/perl/Makefile.SH#362 (text) ====
Index: perl/Makefile.SH
--- perl/Makefile.SH#361~28482~ 2006-07-05 01:53:56.000000000 -0700
+++ perl/Makefile.SH    2006-07-09 01:19:33.000000000 -0700
@@ -815,6 +815,10 @@
                autosplit_lib_modules(@ARGV)' lib/*/*.pm
        $(MAKE) lib/re.pm
 
+.PHONY: makeppport
+makeppport: miniperl$(EXE_EXT) $(CONFIGPM)
+       $(LDLIBPTH) ./miniperl -Ilib mkppport
+
 lib/Config.pod: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
        $(LDLIBPTH) ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl 
lib/Config.pm
 
@@ -1014,10 +1018,10 @@
 $(DYNALOADER): miniperl$(EXE_EXT) preplibrary FORCE
        @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) 
LIBPERL_A=$(LIBPERL)
 
-d_dummy $(dynamic_ext):        miniperl$(EXE_EXT) preplibrary $(DYNALOADER) 
FORCE
+d_dummy $(dynamic_ext):        miniperl$(EXE_EXT) preplibrary makeppport 
$(DYNALOADER) FORCE
        @$(LDLIBPTH) sh ext/util/make_ext dynamic $@ MAKE=$(MAKE) 
LIBPERL_A=$(LIBPERL)
 
-s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
+s_dummy $(static_ext): miniperl$(EXE_EXT) preplibrary makeppport $(DYNALOADER) 
FORCE
        @$(LDLIBPTH) sh ext/util/make_ext $(STATIC) $@ MAKE=$(MAKE) 
LIBPERL_A=$(LIBPERL)
 
 n_dummy $(nonxs_ext):  miniperl$(EXE_EXT) preplibrary $(DYNALOADER) FORCE
@@ -1090,6 +1094,7 @@
        [EMAIL PROTECTED] x in $(DYNALOADER) $(dynamic_ext) $(static_ext) 
$(nonxs_ext) ; do \
        $(LDLIBPTH) sh ext/util/make_ext $(CLEAN) $$x MAKE=$(MAKE) ; \
        done
+       $(LDLIBPTH) ./miniperl -Ilib mkppport --clean
 
 # Some systems do not support "?", so keep these files separate.
 _cleaner2:

==== //depot/perl/mkppport#1 (text) ====
Index: perl/mkppport
--- /dev/null   2006-07-07 18:02:01.443840750 -0700
+++ perl/mkppport       2006-07-09 01:19:33.000000000 -0700
@@ -0,0 +1,181 @@
+use strict;
+use warnings;
+
+use Getopt::Long;
+use Pod::Usage;
+use File::Spec;
+use File::Copy qw( copy );
+use File::Basename qw( dirname );
+
+sub iterdirs(&);
+
+my $rootdir = dirname($0);
+
+unshift @INC, File::Spec->catfile($rootdir, 't', 'lib');
+
+eval q{ use MakeMaker::Test::Utils qw( which_perl ) };
+$@ and die $@;
+
+my %opt = (
+  list   => File::Spec->catfile($rootdir, 'mkppport.lst'),
+  clean  => 0,
+);
+
+GetOptions(\%opt, qw( clean list=s )) or pod2usage(2);
+
+my $absroot = File::Spec->rel2abs($rootdir);
+my @destdirs = readlist($opt{list});
+
+# Nothing to do...
+unless (@destdirs) {
+  print "no destination directories found in $opt{list}\n";
+  exit 0;
+}
+
+# Remove all installed ppport.h files
+if ($opt{clean}) {
+  iterdirs {
+    my($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;
+}
+
+# Determine full perl location
+my $perl = which_perl();
+
+# We're now changing the directory, which confuses the deferred
+# loading in Config.pm, so we better use an absolute @INC path
+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');
+
+# Capture and remove temporary files
+my @unlink;
+
+END {
+  for my $file (@unlink) {
+    print "removing temporary file $file\n";
+    unlink $file or warn "WARNING: could not remove $file: $!\n";
+    1 while unlink $file;  # remove any remaining versions
+  }
+}
+
+# Try to create a ppport.h if it doesn't exist yet, and
+# remember all files that need to be removed later.
+unless (-e 'ppport.h') {
+  unless (-e 'PPPort.pm') {
+    run('PPPort_pm.PL');
+    push @unlink, 'PPPort.pm';
+  }
+  run('ppport_h.PL');
+  push @unlink, 'ppport.h';
+}
+
+# Now install the created ppport.h into extension directories
+iterdirs {
+  my($dir, $fulldir) = @_;
+  print "installing ppport.h for $dir\n";
+  my $dest = File::Spec->catfile($fulldir, 'ppport.h');
+  copy('ppport.h', $dest) or die "copying ppport.h to $dest failed: $!\n";
+};
+
+exit 0;
+
+#---------------------------------------
+# Iterate through extension directories
+#---------------------------------------
+sub iterdirs(&)
+{
+  my $code = shift;
+  
+  for my $dir (@destdirs) {
+    my $fulldir = File::Spec->catdir($absroot, $dir);
+    if (-d $fulldir) {
+      $code->($dir, $fulldir);
+    }
+    else {
+      warn "WARNING: no such directory: $fulldir\n";
+    }
+  }
+}
+
+#----------------------------------------
+# Read the list of extension directories
+#----------------------------------------
+sub readlist
+{
+  my $list = shift;
+  my @dirs;
+  open LIST, $list or die "$list: $!\n";
+  while (<LIST>) {
+    chomp;
+    /^\s*(?:$|#)/ or push @dirs, $_;
+  }
+  close LIST;
+  return @dirs;
+}
+
+#----------------------------------------------
+# Runs a script in the Devel::PPPort directory
+#----------------------------------------------
+sub run
+{
+  my @args = ("-I" . File::Spec->catdir((File::Spec->updir) x 3, 'lib'), @_);
+  my $run = $perl =~ m/\s/ ? qq("$perl") : $perl;
+  for (@args) {
+    $_ = qq("$_") if $^O eq 'VMS' && /^[^"]/;
+    $run .= " $_";
+  }
+  print "running $run\n";
+  system $run and die "$run failed: $?\n";
+}
+
+__END__
+
+=head1 NAME
+
+mkppport - distribute ppport.h among extensions
+
+=head1 SYNOPSIS
+
+mkppport [B<--list>=I<file>] [B<--clean>]
+
+=head1 DESCRIPTION
+
+B<mkppport> generates a I<ppport.h> file using Devel::PPPort
+and distributes it to the various extension directories that
+need it to build.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--list>=I<file>
+
+Name of the file that holds the list of extension directories
+that I<ppport.h> should be distributed to.
+This defaults to I<mkppport.lst> in the same directory as this
+script.
+
+=item B<--clean>
+
+Run with this option to clean out all distributed I<ppport.h> files.
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright 2006 by Marcus Holland-Moritz <[EMAIL PROTECTED]>.
+
+This program is free software; you may redistribute it
+and/or modify it under the same terms as Perl itself.
+
+=cut

==== //depot/perl/mkppport.lst#1 (text) ====
Index: perl/mkppport.lst
--- /dev/null   2006-07-07 18:02:01.443840750 -0700
+++ perl/mkppport.lst   2006-07-09 01:19:33.000000000 -0700
@@ -0,0 +1,14 @@
+#
+# List of directories into which a ppport.h should be installed.
+# Please try to keep the list sorted.
+#
+# This file is read by mkppport at build time.
+#
+
+ext/Compress/Raw/Zlib
+ext/Cwd
+ext/Digest/SHA
+ext/Sys/Syslog
+ext/Time/HiRes
+
+win32/ext/Win32API/File

==== //depot/perl/vms/descrip_mms.template#118 (text) ====
Index: perl/vms/descrip_mms.template
--- perl/vms/descrip_mms.template#117~28372~    2006-06-08 07:11:29.000000000 
-0700
+++ perl/vms/descrip_mms.template       2006-07-09 01:19:33.000000000 -0700
@@ -532,7 +532,7 @@
        $(MINIPERL) $(MMS$SOURCE)
        @ Rename/Log xsloader.pm [.ext.dynaloader]
 
-dynext : $(LIBPREREQ) $(DBG)perlshr$(E) preplibrary
+dynext : $(LIBPREREQ) $(DBG)perlshr$(E) preplibrary makeppport
        @make_ext "$(MINIPERL_EXE)" "$(MMS)"
 
 [.lib]lib.pm : [.lib]lib_pm.PL
@@ -695,6 +695,9 @@
        @ Create/Directory [.lib.auto]
        @ $(MINIPERL) -e "use AutoSplit; autosplit_lib_modules(@ARGV)" 
[.lib]*.pm [.lib.*]*.pm [.lib.*.*]*.pm
 
+makeppport : $(MINIPERL_EXE) $(ARCHDIR)Config.pm
+       $(MINIPERL) mkppport
+
 [.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]
@@ -1766,6 +1769,7 @@
 
 realclean : clean
        - @make_ext "$(MINIPERL_EXE)" "$(MMS)" realclean
+       - $(MINIPERL) mkppport "--clean"
        - If F$Search("*$(OLB)").nes."" Then Delete/NoConfirm/Log *$(OLB);*
        - If F$Search("*.Opt").nes."" Then Delete/NoConfirm/Log *.Opt;*
        - If F$Search("Config.H").nes."" Then Delete/NoConfirm/Log Config.H;*

==== //depot/perl/win32/Makefile#302 (text) ====
Index: perl/win32/Makefile
--- perl/win32/Makefile#301~28460~      2006-06-30 06:46:06.000000000 -0700
+++ perl/win32/Makefile 2006-07-09 01:19:33.000000000 -0700
@@ -918,7 +918,7 @@
 #
 
 all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) \
-       $(X2P) Extensions
+       $(X2P) MakePPPort Extensions
        @echo   Everything is up to date. '$(MAKE_BARE) test' to run test suite.
 
 reonly : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) 
$(PERLEXE) \
@@ -1077,6 +1077,12 @@
 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
        copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
 
+MakePPPort: $(MINIPERL) $(CONFIGPM)
+       $(MINIPERL) -I..\lib ..\mkppport
+
+MakePPPort_clean:
+       -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\mkppport --clean
+
 
#-------------------------------------------------------------------------------
 Extensions: buildext.pl $(PERLDEP) $(CONFIGPM)
        $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic
@@ -1330,7 +1336,7 @@
 
 clean : Extensions_clean _clean
 
-realclean : Extensions_realclean _clean
+realclean : Extensions_realclean MakePPPort_clean _clean
 
 # Handy way to run perlbug -ok without having to install and run the
 # installed perlbug. We don't re-run the tests here - we trust the user.

==== //depot/perl/win32/Makefile.ce#6 (text) ====
Index: perl/win32/Makefile.ce
--- perl/win32/Makefile.ce#5~28140~     2006-05-09 08:23:55.000000000 -0700
+++ perl/win32/Makefile.ce      2006-07-09 01:19:33.000000000 -0700
@@ -706,7 +706,7 @@
 # Top targets
 #
 
-all: hostminiperl $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) Extensions
+all: hostminiperl $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) MakePPPort 
Extensions
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c xconfig.h $(EXTDIR)\DynaLoader\dlutils.c
 
@@ -746,6 +746,12 @@
 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
        $(COPY) dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
 
+MakePPPort: $(MINIPERL) $(CONFIGPM)
+       $(MINIPERL) -I..\lib ..\mkppport
+
+MakePPPort_clean:
+       -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\mkppport --clean
+
 
#----------------------------------------------------------------------------------
 NOT_COMPILE_EXT =
 !if "$(MACHINE)" == "wince-sh3-palm-wce211"

==== //depot/perl/win32/makefile.mk#340 (text) ====
Index: perl/win32/makefile.mk
--- perl/win32/makefile.mk#339~28460~   2006-06-30 06:46:06.000000000 -0700
+++ perl/win32/makefile.mk      2006-07-09 01:19:33.000000000 -0700
@@ -964,7 +964,7 @@
 
 all : .\config.h $(GLOBEXE) $(MINIPERL) $(MK2)         \
        $(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE)  \
-       $(X2P) Extensions
+       $(X2P) MakePPPort Extensions
 
 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
 
@@ -1221,6 +1221,12 @@
 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
        copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
 
+MakePPPort: $(MINIPERL) $(CONFIGPM)
+       $(MINIPERL) -I..\lib ..\mkppport
+
+MakePPPort_clean:
+       -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\mkppport --clean
+
 
#-------------------------------------------------------------------------------
 Extensions : buildext.pl $(PERLDEP) $(CONFIGPM)
        $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic
@@ -1472,7 +1478,7 @@
 
 clean : Extensions_clean _clean
 
-realclean : Extensions_realclean _clean
+realclean : Extensions_realclean MakePPPort_clean _clean
 
 # Handy way to run perlbug -ok without having to install and run the
 # installed perlbug. We don't re-run the tests here - we trust the user.
End of Patch.

Reply via email to