Statistics
| Branch: | Revision:

ffmpeg / version.sh @ 3732c483

History | View | Annotate | Download (738 Bytes)

1
#!/bin/sh
2

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

    
9
# no revision number found
10
test "$revision" || revision=UNKNOWN
11

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

    
16
test -n "$3" && version=$version-$3
17

    
18
if [ -z "$2" ]; then
19
    echo "$version"
20
    exit
21
fi
22

    
23
NEW_REVISION="#define FFMPEG_VERSION \"$version\""
24
OLD_REVISION=$(cat version.h 2> /dev/null)
25

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