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