Updated the revision header with git revision

This commit is contained in:
Sam Lantinga 2021-02-12 08:50:16 -08:00
parent 39153f81b9
commit 9deffcd325
2 changed files with 6 additions and 7 deletions

View File

@ -5,9 +5,9 @@
SDL_ROOT=$(dirname $0)/.. SDL_ROOT=$(dirname $0)/..
cd $SDL_ROOT cd $SDL_ROOT
if [ -x "$(command -v hg)" ]; then if [ -x "$(command -v git)" ]; then
rev="$(hg parents --template 'hg-{rev}:{node|short}' 2>/dev/null)" rev=$(echo "$(git remote get-url origin 2>/dev/null)@$(git rev-list HEAD~.. 2>/dev/null)")
if [ $? = 0 ]; then if [ "$rev" != "@" ]; then
echo $rev echo $rev
exit 0 exit 0
fi fi
@ -21,5 +21,5 @@ if [ -x "$(command -v p4)" ]; then
fi fi
fi fi
echo "hg-0:baadf00d" echo ""
exit 1 exit 1

View File

@ -8,10 +8,9 @@ srcdir=..
header=$outdir/include/SDL_revision.h header=$outdir/include/SDL_revision.h
rev=`sh showrev.sh 2>/dev/null` rev=`sh showrev.sh 2>/dev/null`
if [ "$rev" != "" -a "$rev" != "hg-0:baadf00d" ]; then if [ "$rev" != "" ]; then
revnum=`echo $rev | sed 's,hg-\([0-9]*\).*,\1,'`
echo "#define SDL_REVISION \"$rev\"" >"$header.new" echo "#define SDL_REVISION \"$rev\"" >"$header.new"
echo "#define SDL_REVISION_NUMBER $revnum" >>"$header.new" echo "#define SDL_REVISION_NUMBER 0" >>"$header.new"
if diff $header $header.new >/dev/null 2>&1; then if diff $header $header.new >/dev/null 2>&1; then
rm "$header.new" rm "$header.new"
else else