fmt-conversion.h: fix pixfmt.h #include; fixes latest Libav
[mplayer.git] / version.sh
blob6f3be926395e56d4a8b4f23e3f00c8d1638c49d2
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-2012 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