Commit | Line | Data |
---|---|---|
f1cc88a5 DB |
1 | #!/bin/sh |
2 | ||
40eaf780 | 3 | # check for git short hash |
faa6f1c3 | 4 | revision=$(cd "$1" && git describe --always 2> /dev/null) |
40eaf780 | 5 | |
de2c2b5a | 6 | # no revision number found |
8fab4007 | 7 | test "$revision" || revision=$(cd "$1" && cat RELEASE 2> /dev/null) |
123103ca | 8 | |
de2c2b5a | 9 | # releases extract the version number from the VERSION file |
8202d905 | 10 | version=$(cd "$1" && cat VERSION 2> /dev/null) |
f318ee3e | 11 | test "$version" || version=$revision |
ac63af34 | 12 | |
de2c2b5a DB |
13 | test -n "$3" && version=$version-$3 |
14 | ||
16064462 MR |
15 | if [ -z "$2" ]; then |
16 | echo "$version" | |
17 | exit | |
18 | fi | |
19 | ||
a03be6e1 | 20 | NEW_REVISION="#define LIBAV_VERSION \"$version\"" |
15fcf629 | 21 | OLD_REVISION=$(cat "$2" 2> /dev/null) |
f1cc88a5 DB |
22 | |
23 | # Update version.h only on revision changes to avoid spurious rebuilds | |
24 | if test "$NEW_REVISION" != "$OLD_REVISION"; then | |
9e6165b5 | 25 | echo "$NEW_REVISION" > "$2" |
f1cc88a5 | 26 | fi |