OSDN Git Service

Merge remote-tracking branch 'qatar/master'
[coroid/ffmpeg_saccubus.git] / version.sh
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 fi
7
8 # no revision number found
9 test "$revision" || revision=$(cd "$1" && cat RELEASE 2> /dev/null)
10
11 # releases extract the version number from the VERSION file
12 version=$(cd "$1" && cat VERSION 2> /dev/null)
13 test "$version" || version=$revision
14
15 test -n "$3" && version=$version-$3
16
17 if [ -z "$2" ]; then
18     echo "$version"
19     exit
20 fi
21
22 NEW_REVISION="#define FFMPEG_VERSION \"$version\""
23 OLD_REVISION=$(cat version.h 2> /dev/null)
24
25 # Update version.h only on revision changes to avoid spurious rebuilds
26 if test "$NEW_REVISION" != "$OLD_REVISION"; then
27     echo "$NEW_REVISION" > "$2"
28 fi