extract revision from svn-1.4 .svn/entries files
[libav.git] / version.sh
CommitLineData
f1cc88a5
DB
1#!/bin/sh
2
59d0fc57 3svn_revision=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2`
837f0ad7
MB
4test $svn_revision || svn_revision=`cd "$1" && grep revision .svn/entries | \
5 cut -d '"' -f2 2> /dev/null`
c1047cda 6test $svn_revision || svn_revision=`cd "$1" && sed -n '/^dir$/{n;p;q}' < .svn/entries`
a66d63a9
DB
7test $svn_revision || svn_revision=UNKNOWN
8
f1cc88a5
DB
9NEW_REVISION="#define FFMPEG_VERSION \"SVN-r$svn_revision\""
10OLD_REVISION=`cat version.h 2> /dev/null`
11
12# Update version.h only on revision changes to avoid spurious rebuilds
13if test "$NEW_REVISION" != "$OLD_REVISION"; then
14 echo "$NEW_REVISION" > version.h
15fi