1#!/bin/sh
2
3# This file is taken from the MPlayer sources, and adapted a little bit.
4# It gets the SVN revision number and then saves it in two files:
5# src/svn_revision.h and svn_revision
6
7svn_revision=`LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2`
8test $svn_revision || svn_revision=`git rev-list --count HEAD`
9test $svn_revision || svn_revision=0UNKNOWN
10
11NEW_REVISION="#define SVN_REVISION \"${svn_revision}\""
12OLD_REVISION=`cat src/svn_revision.h 2> /dev/null`
13
14# Update svn_revision.h only on revision changes to avoid spurious rebuilds
15if test "$NEW_REVISION" != "$OLD_REVISION"; then
16    echo "$NEW_REVISION" > src/svn_revision.h
17fi
18echo "${svn_revision}" > svn_revision
19