Statistics
| Branch: | Revision:

ffmpeg / version.sh @ 004cda8e

History | View | Annotate | Download (1.28 KB)

1 f1cc88a5 Diego Biurrun
#!/bin/sh
2
3 123103ca Aurelien Jacobs
# check for SVN revision number
4 31c194e7 Ramiro Polla
revision=$(cd "$1" && cat snapshot_version 2> /dev/null)
5 15ccfff1 Ramiro Polla
test $revision || revision=$(cd "$1" && LC_ALL=C svn info 2> /dev/null | grep "Last Changed Rev" | cut -d' ' -f4)
6
test $revision || revision=$(cd "$1" && grep committed-rev .svn/entries 2>/dev/null | head -n 1 | 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 9a02c3e1 Ramiro Polla
    revision=$(cd "$1" && git svn find-rev HEAD 2> /dev/null)
16 d38b7b80 Alex Converse
    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 9a02c3e1 Ramiro Polla
    revision=$(cd "$1" && git log -1 --pretty=format:%h 2> /dev/null)
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 8202d905 Ramiro Polla
version=$(cd "$1" && cat VERSION 2> /dev/null)
30 de2c2b5a Diego Biurrun
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