This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
"This little thing tests for a file .patch, and if it contains
authorSimon Cozens <simon@netthink.co.uk>
Fri, 14 Jul 2000 07:12:15 +0000 (07:12 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 2 Aug 2000 01:43:33 +0000 (01:43 +0000)
 a number, pops into patchlevel.h" (making it easier to track
which development version people are reporting bugs against)

Subject: Patchlevel autogeneration for repository perls
Message-ID: <slrn8mtfaf.1qo.simon@justanother.perlhacker.org>

p4raw-id: //depot/perl@6485

MANIFEST
Makefile.SH
fix_pl [new file with mode: 0644]

index 68afd78..96eec9c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -414,6 +414,7 @@ ext/re/re.xs                re extension external subroutines
 ext/util/make_ext      Used by Makefile to execute extension Makefiles
 ext/util/mkbootstrap   Turns ext/*/*_BS into bootstrap info
 fakethr.h              Fake threads header
+fix_pl                 Fix up patchlevel.h for repository perls
 form.h                 Public declarations for the above
 global.sym             Symbols that need hiding when embedded
 globals.c              File to declare global symbols (for shared library)
index c691614..22f8071 100644 (file)
@@ -307,7 +307,7 @@ opmini$(OBJ_EXT): op.c
        $(CCCMD) $(PLDLFLAGS) -DPERL_EXTERNAL_GLOB opmini.c
        $(RMS) opmini.c
 
-miniperlmain$(OBJ_EXT): miniperlmain.c
+miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h
        $(CCCMD) $(PLDLFLAGS) $*.c
 
 perlmain.c: miniperlmain.c config.sh $(FIRSTMAKEFILE)
@@ -325,6 +325,14 @@ ext.libs: $(static_ext)
 
 !NO!SUBS!
 
+if test -f .patch ; then $spitshell >>Makefile <<'!NO!SUBS!' 
+patchlevel.h: .patch
+       perl fix_pl || (make -f Makefile.micro && ./microperl fix_pl)
+
+!NO!SUBS!
+
+fi
+
 # How to build libperl.  This is still rather convoluted.
 # Load up custom Makefile.SH fragment for shared loading and executables:
 case "$osname" in
diff --git a/fix_pl b/fix_pl
new file mode 100644 (file)
index 0000000..44c3f52
--- /dev/null
+++ b/fix_pl
@@ -0,0 +1,21 @@
+#!perl
+# Not fixing perl, but fixing the patchlevel if this perl comes
+# from the repository rather than an official release
+exit unless -e ".patch";
+open PATCH, ".patch" or die "Couldn't open .patch: $!";
+open PLIN, "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
+open PLOUT, ">patchlevel.new" or die "Couldn't write on patchlevel.new : $!";
+my $pl = <PATCH>;
+chomp ($pl);
+$pl =~ s/\D//g;
+my $seen=0;
+while (<PLIN>) {
+    if (/\t,NULL/ and $seen) {
+        print PLOUT "\t,\"devel-$pl\"\n";
+    }
+    $seen++ if /local_patches\[\]/;
+    print PLOUT;
+}
+close PLOUT; close PLIN;
+rename "patchlevel.new", "patchlevel.h" or die "Couldn't rename: $!";
+unlink ".patch";