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