config: remove pointless cfg-mplayer-def.h file
[mplayer/greg.git] / version.sh
blobaaf6c1cfaac160f87ad28321fe37274a57b68ff2
1 #!/bin/sh
3 test "$1" && extra="-$1"
5 # Extract revision number from file used by daily tarball snapshots
6 # or from "git describe" output
7 git_revision=$(cat snapshot_version 2> /dev/null)
8 test $git_revision || test ! -d .git || git_revision=`git describe --match "v[0-9]*" --always`
9 git_revision=$(expr "$git_revision" : v*'\(.*\)')
10 test $git_revision || git_revision=UNKNOWN
12 # releases extract the version number from the VERSION file
13 version=$(cat VERSION 2> /dev/null)
14 test $version || version=$git_revision
16 NEW_REVISION="#define VERSION \"${version}${extra}\""
17 OLD_REVISION=$(head -n 1 version.h 2> /dev/null)
18 TITLE='#define MP_TITLE "%s "VERSION" (C) 2000-2011 MPlayer Team\n"'
20 # Update version.h only on revision changes to avoid spurious rebuilds
21 if test "$NEW_REVISION" != "$OLD_REVISION"; then
22 cat <<EOF > version.h
23 $NEW_REVISION
24 $TITLE
25 EOF