Statistics
| Branch: | Revision:

ffmpeg / version.sh @ faa6f1c3

History | View | Annotate | Download (690 Bytes)

1
#!/bin/sh
2

    
3
# check for git short hash
4
revision=$(cd "$1" && git describe --always 2> /dev/null)
5
test "$revision" && revision=git-$revision
6

    
7
# no revision number found
8
test "$revision" || revision=UNKNOWN
9

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

    
14
test -n "$3" && version=$version-$3
15

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

    
21
NEW_REVISION="#define LIBAV_VERSION \"$version\""
22
OLD_REVISION=$(cat version.h 2> /dev/null)
23

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