summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--MANIFEST5
-rw-r--r--Makefile.SH12
-rwxr-xr-xcflags.SH11
-rw-r--r--make_patchnum.sh63
-rw-r--r--patchlevel.h2
6 files changed, 50 insertions, 46 deletions
diff --git a/.gitignore b/.gitignore
index 362fc7a319..0c34456d06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,9 +3,8 @@
# ignore local .config files
.config
# these are generated by make_patchnum.sh from git or from a .patchfile
-.patchnum
.sha1
-unpushed.h
+git_version.h
# ignore bug*.pl
bug*.pl
diff --git a/MANIFEST b/MANIFEST
index 7dcfb6fa5b..2faee4fcfa 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3170,8 +3170,9 @@ makedepend.SH Precursor to makedepend
makedir.SH Precursor to makedir
Makefile.micro microperl Makefile
Makefile.SH A script that generates Makefile
-make_patchnum.com DCL script to generate .patchnum file on VMS
-make_patchnum.sh Script to generate .patchnum file
+make_patchnum.com DCL script to generate .patchnum file on VMS (should be rewritten to create git_version.h)
+make_patchnum.sh Script to generate git_version.h and lib/Config_git.pl files
+make_patchnum.pl Script to generate git_Version.h and lib/Config_git.pl files for all OS'es (experimental)
malloc.c A version of malloc you might not want
malloc_ctl.h A version of malloc you might not want
MANIFEST This list of files
diff --git a/Makefile.SH b/Makefile.SH
index 9ad8b6f102..ad04fe5350 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -525,7 +525,7 @@ splintfiles = $(c1)
.c.s:
$(CCCMDSRC) -S $*.c
-all: $(FIRSTMAKEFILE) make_patchnum miniperl$(EXE_EXT) extra.pods $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
+all: $(FIRSTMAKEFILE) make_patchnum miniperl$(EXE_EXT) miniperl extra.pods $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
@echo " ";
@echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
@@ -543,8 +543,11 @@ sperl.i: perl.c $(h)
make_patchnum:
sh $(shellflags) make_patchnum.sh
-# make sure that we recompile perl.c if .patchnum changes
-perl$(OBJ_EXT): .patchnum unpushed.h
+git_version.h:
+ sh $(shellflags) make_patchnum.sh
+
+# make sure that we recompile perl.c if the git version changes
+perl$(OBJ_EXT): git_version.h
translators: miniperl$(EXE_EXT) $(CONFIGPM) FORCE
@echo " "; echo " Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
@@ -1220,9 +1223,8 @@ _tidy:
-cd pod; $(LDLIBPTH) $(MAKE) clean
-cd utils; $(LDLIBPTH) $(MAKE) clean
-cd x2p; $(LDLIBPTH) $(MAKE) clean
- -rm .patchnum
-rm lib/Config_git.pl
- -rm unpushed.h
+ -rm git_version.h
-@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
$(LDLIBPTH) sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
done
diff --git a/cflags.SH b/cflags.SH
index 80b50b1165..ef1c8b5b37 100755
--- a/cflags.SH
+++ b/cflags.SH
@@ -213,6 +213,8 @@ warn="$warn"
stdflags="$stdflags"
# Extra extra.
extra="$extra"
+# what do executables look like?
+_exe="$_exe"
!GROK!THIS!
@@ -296,14 +298,7 @@ for file do
op) ;;
opmini) ;;
pad) ;;
- perl)
- if [ -f .patchnum -a -n "`awk 'BEGIN{ORS=""} /describe:/ {print $1}' .patchnum`" ] ; then
- ccflags="-DPERL_PATCHNUM=`awk 'BEGIN{ORS=""} /describe:/ {print $2}' .patchnum` $ccflags"
- fi
- if [ -f .patchnum -a -n "`awk 'BEGIN{ORS=""} /status:/ {print $2}' .patchnum`" ] ; then
- ccflags="-DPERL_GIT_UNCOMMITTED_CHANGES=`awk 'BEGIN{ORS=""} /status:/ {print $2}' .patchnum` $ccflags"
- fi
- ;;
+ perl) ;;
perlapi) ;;
perlmain) ;;
perly) ;;
diff --git a/make_patchnum.sh b/make_patchnum.sh
index 2d3f09305e..9a8982fd97 100644
--- a/make_patchnum.sh
+++ b/make_patchnum.sh
@@ -8,34 +8,40 @@
# lib/Config_git.pl # holds some special configure settings related to git
# unpushed.h # header file used by patchlevel.h to store unpushed commits
-existing_patchnum=`cat .patchnum 2>/dev/null`
-existing_config=`cat lib/Config_git.pl 2>/dev/null`
-existing_unpushed=`cat unpushed.h 2>/dev/null`
+config_file="lib/Config_git.pl"
+header_file="git_version.h"
+patch_file=".patch"
+
+git_dir=`git rev-parse --git-dir 2>/dev/null`
+existing_config=`cat $config_file 2>/dev/null`
+existing_header=`cat $header_file 2>/dev/null`
unpushed_commits='/*no-op*/'
-if [ -s ".patch" ] ; then
+if [ -s $patch_file ] ; then
# this is the minimal expectation for the
read branch snapshot_created commit_id describe < .patch
changed=""
extra_info="git_snapshot_date='$snapshot_created'"
commit_title='Snapshot of:'
-elif [ -d ".git" ]; then
- branch=`git branch | awk 'BEGIN{ORS=""} /\*/ { print $2 }'`
+elif [ -n "$git_dir" ]; then
+ branch=`git branch | awk 'BEGIN{ORS=""} /^\* [^(]/ { print $2 }'`
test -n "$branch" && remote=`git config branch.$branch.remote`
+ test -n "$branch" && merge=`git config branch.$branch.merge | sed s,refs/heads/,,`
commit_id=`git rev-parse HEAD`
changed=`git diff-index --name-only HEAD`
describe=`git describe --tags`
commit_created=`git log -1 --pretty='format:%ci'`
extra_info="git_commit_date='$commit_created'"
- if [ -n "$branch" ] && [ -n "$remote" ]; then
- unpushed_commit_list=`git cherry $remote/$branch | awk 'BEGIN{ORS=","} /\+/ {print $2}' | sed -e 's/,$//'`
- unpushed_commits=`git cherry $remote/$branch | awk 'BEGIN{ORS="\t\\\\\n"} /\+/ {print ",\"" $2 "\""}'`
+ if [ -n "$merge" ] && [ -n "$remote" ]; then
+ unpushed_commit_list=`git cherry $remote/$merge | awk 'BEGIN{ORS=","} /\+/ {print $2}' | sed -e 's/,$//'`
+ unpushed_commits=`git cherry $remote/$merge | awk 'BEGIN{ORS="\t\\\\\n"} /\+/ {print ",\"" $2 "\""}'`
if [ -n "$unpushed_commits" ]; then
commit_title="Local Commit:"
- ancestor=`git rev-parse $remote/$branch`
+ ancestor=`git rev-parse $remote/$merge`
extra_info="$extra_info
git_ancestor='$ancestor'
+git_remote_branch='$remote/$merge'
git_unpushed='$unpushed_commit_list'"
fi
@@ -52,29 +58,31 @@ SNDOGS
fi
# Set up defaults for various values
-new_patchnum="describe: $describe"
if [ -n "$changed" ]; then
changed="true"
commit_title="Derived from:"
- new_patchnum="$new_patchnum
-status: uncommitted-changes"
+ status="#define PERL_GIT_UNCOMMITTED_CHANGES uncommitted-changes"
+else
+ status="/* clean working directory */"
fi
test -z "$commit_title" && commit_title='Commit id:'
-new_unpushed=`cat <<EOFTEXT
-/*********************************************************************
-* WARNING: unpushed.h is automatically generated by make_patchnum.sh *
-* DO NOT EDIT DIRECTLY - edit make_patchnum.sh instead *
-*********************************************************************/
+new_header=`cat <<EOFTEXT
+/***************************************************************************
+* WARNING: $header_file is automatically generated by make_patchnum.sh
+* DO NOT EDIT DIRECTLY - edit make_patchnum.sh instead
+****************************************************************************/
+#define PERL_PATCHNUM $describe
+$status
#define PERL_GIT_UNPUSHED_COMMITS $unpushed_commits
/*leave-this-comment*/
EOFTEXT
`
new_config=`cat <<EOFDATA
-#################################################################
-# WARNING: lib/Config_git.pl is generated by make_patchnum.sh #
-# DO NOT EDIT DIRECTLY - edit make_patchnum.sh instead #
-#################################################################
+#######################################################################
+# WARNING: $config_file is generated by make_patchnum.sh
+# DO NOT EDIT DIRECTLY - edit make_patchnum.sh instead
+#######################################################################
\\$Config::Git_Data=<<'ENDOFGIT';
git_commit_id='$commit_id'
git_describe='$describe'
@@ -86,12 +94,11 @@ ENDOFGIT
EOFDATA
`
# only update the files if necessary, other build product depends on these files
-if [ "$existing_patchnum" != "$new_patchnum" ] || [ "$new_config" != "$existing_config" ] || [ "$existing_unpushed" != "$new_unpushed" ]; then
- echo "Updating .patchnum and lib/Config_git.pl"
- echo "$new_patchnum" > .patchnum
- echo "$new_config" > lib/Config_git.pl
- echo "$new_unpushed" > unpushed.h
+if [ "$new_config" != "$existing_config" ] || [ "$existing_header" != "$new_header" ]; then
+ echo "Updating $header_file and $config_file"
+ echo "$new_config" > $config_file
+ echo "$new_header" > $header_file
else
- echo "Reusing .patchnum and lib/Config_git.pl"
+ echo "Reusing $header_file and $config_file"
fi
diff --git a/patchlevel.h b/patchlevel.h
index a17a6e679d..a9f6ba4b48 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -116,7 +116,7 @@ hunk.
*/
#if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
-#include "unpushed.h"
+#include "git_version.h"
#if !defined(PERL_GIT_UNPUSHED_COMMITS)
#define PERL_GIT_UNPUSHED_COMMITS_PATCH /* no-op */
#else