From: Yves Orton Date: Sat, 20 Dec 2008 19:37:09 +0000 (+0100) Subject: make perl use git-describe for PATCHNUM X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f6a80292c3db127d1561c118f409c1cffd1b55d9;p=p5sagit%2Fp5-mst-13.2.git make perl use git-describe for PATCHNUM This is just an initial attempt at getting something more useful into the -v / -V output. Currently "patchlevel" is really "version", and PATCHNUM is just a special string added to the patchlevel in perl.c via defines created by cflags.SH and its product file cflags, which happens very early in the build process. This means that for committers the -v output is likely to not be upto date unless they run make clean. Anyway, IMO we should rethink a reasonable amount about how we do this, this is just a crude step forward. --- diff --git a/cflags.SH b/cflags.SH index 4e62f92..b429df6 100755 --- a/cflags.SH +++ b/cflags.SH @@ -354,8 +354,10 @@ case "$cc" in ;; esac -if test -f .patch; then - ccflags="-DPERL_PATCHNUM=`cat .patch` $ccflags" +if test -d .git; then + ccflags="-DPERL_PATCHNUM=`git describe` $ccflags" +elsif test -f .patch; then + ccflags="-DPERL_PATCHNUM=`awk '{print $4}' .patch` $ccflags" fi : Can we perhaps use $ansi2knr here diff --git a/perl.c b/perl.c index 63ff6d7..021f35d 100644 --- a/perl.c +++ b/perl.c @@ -3304,7 +3304,7 @@ Perl_moreswitches(pTHX_ const char *s) PerlIO_printf(PerlIO_stdout(), "\nThis is perl, %"SVf #ifdef PERL_PATCHNUM - " DEVEL" STRINGIFY(PERL_PATCHNUM) + " DEVEL:" STRINGIFY(PERL_PATCHNUM) #endif " built for %s", SVfARG(vstringify(PL_patchlevel)),