Fix typo in message.
[mplayer/glamo.git] / version.sh
blobe6a39c18fed38455766b6768a428ebbe33ed1e86
1 #!/bin/sh
3 test "$1" && extra="-$1"
5 # Extract revision number from file used by daily tarball snapshots
6 # or from the places different Subversion versions have it.
7 svn_revision=$(cat snapshot_version 2> /dev/null)
8 test $svn_revision || svn_revision=$(LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2)
9 test $svn_revision || svn_revision=$(grep revision .svn/entries 2>/dev/null | cut -d '"' -f2)
10 test $svn_revision || svn_revision=$(sed -n -e '/^dir$/{n;p;q;}' .svn/entries 2>/dev/null)
11 test $svn_revision && svn_revision=SVN-r$svn_revision
12 test $svn_revision || svn_revision=UNKNOWN
14 # releases extract the version number from the VERSION file
15 version=$(cat VERSION 2> /dev/null)
16 test $version || version=$svn_revision
18 NEW_REVISION="#define VERSION \"${version}${extra}\""
19 OLD_REVISION=$(head -n 1 version.h 2> /dev/null)
20 TITLE='#define MP_TITLE "%s "VERSION" (C) 2000-2010 MPlayer Team\n"'
22 # Update version.h only on revision changes to avoid spurious rebuilds
23 if test "$NEW_REVISION" != "$OLD_REVISION"; then
24 cat <<EOF > version.h
25 $NEW_REVISION
26 $TITLE
27 EOF