2001-04-14 22:26:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2006-06-20 10:08:19 +00:00
|
|
|
test "$1" && extra="-$1"
|
2006-06-06 12:01:34 +00:00
|
|
|
|
2009-02-24 23:15:26 +00:00
|
|
|
# Extract revision number from file used by daily tarball snapshots
|
2011-01-24 23:06:48 +00:00
|
|
|
# or from "git describe" output
|
2009-11-23 03:40:52 +00:00
|
|
|
git_revision=$(cat snapshot_version 2> /dev/null)
|
2011-02-19 17:01:07 +00:00
|
|
|
test $git_revision || test ! -d .git || git_revision=`git describe --match "v[0-9]*" --always`
|
|
|
|
git_revision=$(expr "$git_revision" : v*'\(.*\)')
|
2009-11-23 03:40:52 +00:00
|
|
|
test $git_revision || git_revision=UNKNOWN
|
2006-06-23 15:12:56 +00:00
|
|
|
|
2009-03-05 23:36:28 +00:00
|
|
|
# releases extract the version number from the VERSION file
|
|
|
|
version=$(cat VERSION 2> /dev/null)
|
2009-11-23 03:40:52 +00:00
|
|
|
test $version || version=$git_revision
|
2009-03-05 23:36:28 +00:00
|
|
|
|
|
|
|
NEW_REVISION="#define VERSION \"${version}${extra}\""
|
2009-04-04 19:50:57 +00:00
|
|
|
OLD_REVISION=$(head -n 1 version.h 2> /dev/null)
|
2012-01-28 11:49:13 +00:00
|
|
|
TITLE='#define MP_TITLE "%s "VERSION" (C) 2000-2012 MPlayer Team\n"'
|
2006-06-22 13:47:50 +00:00
|
|
|
|
|
|
|
# Update version.h only on revision changes to avoid spurious rebuilds
|
|
|
|
if test "$NEW_REVISION" != "$OLD_REVISION"; then
|
2009-01-29 00:16:09 +00:00
|
|
|
cat <<EOF > version.h
|
|
|
|
$NEW_REVISION
|
|
|
|
$TITLE
|
|
|
|
EOF
|
2006-06-22 13:47:50 +00:00
|
|
|
fi
|