summaryrefslogtreecommitdiffstats
path: root/version.sh
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-11-23 05:40:52 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-11-23 06:22:15 +0200
commit1dba61a67063fac2c6f02dc31ab84e61ff279617 (patch)
treefcf4469f5e9b3152c738849809b7d4dd441d7187 /version.sh
parentd3a1fa98f4e20ce707a7da54d381adf1e3d1eb87 (diff)
downloadmpv-1dba61a67063fac2c6f02dc31ab84e61ff279617.tar.bz2
mpv-1dba61a67063fac2c6f02dc31ab84e61ff279617.tar.xz
build: Generate version numbers for git
Update the version.sh script for git so it'll generate version numbers more useful than "UNKNOWN". At the moment it only generates the short SHA1 name, but adding a tag as a starting point should allow more useful output. Rather than update the Makefile logic that tried to guess whether the svn revision had changed since the last version.h update, just run the version.sh script from configure so the version is updated at least at that time.
Diffstat (limited to 'version.sh')
-rwxr-xr-xversion.sh12
1 files changed, 5 insertions, 7 deletions
diff --git a/version.sh b/version.sh
index dd8b7b4fe1..1a3f14049e 100755
--- a/version.sh
+++ b/version.sh
@@ -4,16 +4,14 @@ test "$1" && extra="-$1"
# Extract revision number from file used by daily tarball snapshots
# or from the places different Subversion versions have it.
-svn_revision=$(cat snapshot_version 2> /dev/null)
-test $svn_revision || svn_revision=$(LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2)
-test $svn_revision || svn_revision=$(grep revision .svn/entries 2>/dev/null | cut -d '"' -f2)
-test $svn_revision || svn_revision=$(sed -n -e '/^dir$/{n;p;q;}' .svn/entries 2>/dev/null)
-test $svn_revision && svn_revision=SVN-r$svn_revision
-test $svn_revision || svn_revision=UNKNOWN
+git_revision=$(cat snapshot_version 2> /dev/null)
+test $git_revision || test -d .git && git_revision=`git describe --always`
+test $git_revision && git_revision=git-$git_revision
+test $git_revision || git_revision=UNKNOWN
# releases extract the version number from the VERSION file
version=$(cat VERSION 2> /dev/null)
-test $version || version=$svn_revision
+test $version || version=$git_revision
NEW_REVISION="#define VERSION \"${version}${extra}\""
OLD_REVISION=$(head -n 1 version.h 2> /dev/null)