Statistics
| Branch: | Revision:

ffmpeg / version.sh @ ad9b2a41

History | View | Annotate | Download (840 Bytes)

1
#!/bin/sh
2

    
3
revision=$(cd "$1" && cat snapshot_version 2> /dev/null)
4
test "$revision" && revision=SVN-r$revision
5

    
6
# check for git short hash
7
if ! test "$revision"; then
8
    revision=$(cd "$1" && git describe --tags --match N 2> /dev/null)
9
    test "$revision" && revision=git-$revision
10
fi
11

    
12
# no revision number found
13
test "$revision" || revision=UNKNOWN
14

    
15
# releases extract the version number from the VERSION file
16
version=$(cd "$1" && cat VERSION 2> /dev/null)
17
test "$version" || version=$revision
18

    
19
test -n "$3" && version=$version-$3
20

    
21
if [ -z "$2" ]; then
22
    echo "$version"
23
    exit
24
fi
25

    
26
NEW_REVISION="#define FFMPEG_VERSION \"$version\""
27
OLD_REVISION=$(cat version.h 2> /dev/null)
28

    
29
# Update version.h only on revision changes to avoid spurious rebuilds
30
if test "$NEW_REVISION" != "$OLD_REVISION"; then
31
    echo "$NEW_REVISION" > "$2"
32
fi