Statistics
| Branch: | Revision:

ffmpeg / version.sh @ 9c5a9e6b

History | View | Annotate | Download (1.2 KB)

1 f1cc88a5 Diego Biurrun
#!/bin/sh
2
3 123103ca Aurelien Jacobs
# check for SVN revision number
4 2b229186 Diego Biurrun
revision=$(cat snapshot_version 2> /dev/null)
5 10671cf5 Diego Biurrun
test $revision || revision=$(cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2)
6 d33a14e4 Diego Biurrun
test $revision || revision=$(cd "$1" && grep revision .svn/entries 2>/dev/null | cut -d '"' -f2)
7 7f6d9b30 Måns Rullgård
test $revision || revision=$(cd "$1" && sed -n -e '/^dir$/{n
8
p
9
q
10
}' .svn/entries 2>/dev/null)
11 123103ca Aurelien Jacobs
test $revision && revision=SVN-r$revision
12 a66d63a9 Diego Biurrun
13 d38b7b80 Alex Converse
# check for git svn revision number
14
if ! test $revision; then
15
    revision=$(cd "$1" && git svn find-rev HEAD)
16
    test $revision && revision=git-svn-r$revision
17
fi
18
19 40eaf780 Aurelien Jacobs
# check for git short hash
20
if ! test $revision; then
21 d33a14e4 Diego Biurrun
    revision=$(cd "$1" && git log -1 --pretty=format:%h)
22 40eaf780 Aurelien Jacobs
    test $revision && revision=git-$revision
23
fi
24
25 de2c2b5a Diego Biurrun
# no revision number found
26 123103ca Aurelien Jacobs
test $revision || revision=UNKNOWN
27
28 de2c2b5a Diego Biurrun
# releases extract the version number from the VERSION file
29
version=$(cat VERSION 2> /dev/null)
30
test $version || version=$revision
31 ac63af34 Diego Biurrun
32 de2c2b5a Diego Biurrun
test -n "$3" && version=$version-$3
33
34
NEW_REVISION="#define FFMPEG_VERSION \"$version\""
35 d33a14e4 Diego Biurrun
OLD_REVISION=$(cat version.h 2> /dev/null)
36 f1cc88a5 Diego Biurrun
37
# Update version.h only on revision changes to avoid spurious rebuilds
38
if test "$NEW_REVISION" != "$OLD_REVISION"; then
39 9e6165b5 Måns Rullgård
    echo "$NEW_REVISION" > "$2"
40 f1cc88a5 Diego Biurrun
fi