diff --git a/MANIFEST b/MANIFEST index fc5792f218c27..a6a91e68ee0f2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -4157,6 +4157,7 @@ dist/ExtUtils-CBuilder/t/01-basic.t tests for ExtUtils::CBuilder dist/ExtUtils-CBuilder/t/02-link.t tests for ExtUtils::CBuilder dist/ExtUtils-CBuilder/t/03-cplusplus.t tests for ExtUtils::CBuilder dist/ExtUtils-CBuilder/t/04-base.t tests for ExtUtils::CBuilder +dist/ExtUtils-ParseXS/author/mksnapshot.pl Utility for detecting before/after changes to xsubpp output dist/ExtUtils-ParseXS/Changes ExtUtils::ParseXS change log dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm converts Perl XS code into C code dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pod ExtUtils::ParseXS documentation diff --git a/Porting/exec-bit.txt b/Porting/exec-bit.txt index f9abc7d605b3a..f18adb64efa66 100644 --- a/Porting/exec-bit.txt +++ b/Porting/exec-bit.txt @@ -20,6 +20,7 @@ dist/Devel-PPPort/devel/regenerate dist/Devel-PPPort/devel/scanprov dist/Devel-PPPort/devel/update_release_date.pl dist/Devel-PPPort/soak +dist/ExtUtils-ParseXS/author/mksnapshot.pl dist/Thread-Queue/examples/callback.pl dist/Thread-Queue/examples/queue.pl installperl diff --git a/dist/ExtUtils-ParseXS/author/mksnapshot.pl b/dist/ExtUtils-ParseXS/author/mksnapshot.pl new file mode 100755 index 0000000000000..f4e490368f8e6 --- /dev/null +++ b/dist/ExtUtils-ParseXS/author/mksnapshot.pl @@ -0,0 +1,69 @@ +#!/usr/bin/perl +# +# mksnapshot.pl +# +# This is a very crude script to help check whether and/or what has +# changed in generated .c files as a result of changes to xsubpp and its +# modules. +# +# It finds all .xs files under the current directory, then copies to +# another directory, each associated .c file if it exists. +# +# The idea is that, while cd'ed to the base of the perl distribution, you +# run this script, which will copy all the generated .c files to one +# directory. You then rebuild perl with the newly modified xsubpp, and +# create a second snapshot to another directory, then compare the results. +# +# For example, +# +# ... build perl... +# +# $ mkdir /tmp/snap1 /tmp/snap2 +# $ dist/ExtUtils-ParseXS/author/mksnapshot.pl /tmp/snap1 +# $ git clean -xdf +# +# ... modify xsubpp ... +# ... build perl... +# +# $ dist/ExtUtils-ParseXS/author/mksnapshot.pl /tmp/snap2 +# $ diff -ru /tmp/snap[12] +# +# Each snapped .c file is saved with each '/' component of its pathname +# changed to a '='. So ext/POSIX/POSIX.c would be copied to +# /tmp/snap1/ext=POSIX=POSIX.c + +use warnings; +use strict; + +use File::Find; +use File::Copy; + +die "usage: $0 snapdirectory\n" unless @ARGV == 1; +my $snapdir = shift @ARGV; + +die "No such directory: $snapdir\n" unless -d $snapdir; + +find( + { + wanted => \&wanted, + no_chdir => 1, + }, + + '.' +); + + + +sub wanted { + return unless /\.xs$/; + my $f = $_; + $f =~ s/\.xs$/.c/ or die; + return unless -f $f; + my $df = $f; + $df =~ s{^/}{}; + $df =~ s{^\./}{}; + $df =~ s{/}{=}g; + $df = "$snapdir/$df"; + print "snapping $f\n"; + copy($f, $df) or die "Can't copy $f to $df: $!\n"; +}