Statistics
| Branch: | Revision:

ffmpeg / version.sh @ ebba2b3e

History | View | Annotate | Download (690 Bytes)

1 f1cc88a5 Diego Biurrun
#!/bin/sh
2
3 40eaf780 Aurelien Jacobs
# check for git short hash
4 faa6f1c3 Janne Grunau
revision=$(cd "$1" && git describe --always 2> /dev/null)
5
test "$revision" && revision=git-$revision
6 40eaf780 Aurelien Jacobs
7 de2c2b5a Diego Biurrun
# no revision number found
8 f318ee3e Mans Rullgard
test "$revision" || revision=UNKNOWN
9 123103ca Aurelien Jacobs
10 de2c2b5a Diego Biurrun
# releases extract the version number from the VERSION file
11 8202d905 Ramiro Polla
version=$(cd "$1" && cat VERSION 2> /dev/null)
12 f318ee3e Mans Rullgard
test "$version" || version=$revision
13 ac63af34 Diego Biurrun
14 de2c2b5a Diego Biurrun
test -n "$3" && version=$version-$3
15
16 16064462 Måns Rullgård
if [ -z "$2" ]; then
17
    echo "$version"
18
    exit
19
fi
20
21 a03be6e1 Janne Grunau
NEW_REVISION="#define LIBAV_VERSION \"$version\""
22 d33a14e4 Diego Biurrun
OLD_REVISION=$(cat version.h 2> /dev/null)
23 f1cc88a5 Diego Biurrun
24
# Update version.h only on revision changes to avoid spurious rebuilds
25
if test "$NEW_REVISION" != "$OLD_REVISION"; then
26 9e6165b5 Måns Rullgård
    echo "$NEW_REVISION" > "$2"
27 f1cc88a5 Diego Biurrun
fi