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