summaryrefslogtreecommitdiff
path: root/ffms2/version.sh
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2014-02-20 12:12:20 +0000
committerTim Redfern <tim@eclectronics.org>2014-02-20 12:12:20 +0000
commitad1c66acec6575ecd078336ee18016c5f4748084 (patch)
treef601334142a687d5dab29507db946b50d5842eeb /ffms2/version.sh
parentc83f900c4337f8bb07c1cd6e60c2cebaba24192c (diff)
adding ffms2 with small files fix
Diffstat (limited to 'ffms2/version.sh')
-rwxr-xr-xffms2/version.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/ffms2/version.sh b/ffms2/version.sh
new file mode 100755
index 0000000..47fed12
--- /dev/null
+++ b/ffms2/version.sh
@@ -0,0 +1,27 @@
+#! /bin/sh
+
+strip_echo () {
+ printf '%s' "$(echo "$@" | tr -d '\n')"
+}
+
+echo_maybe () {
+ if test -n "$2"; then
+ strip_echo "$1$2"
+ exit 1
+ fi
+}
+
+# Make sure we're in an useful dir (for out-of-tree builds)
+cd "$(dirname $0)"
+
+echo_maybe '' "$(cat .version 2>/dev/null)"
+echo_maybe '' "$(awk -F '[(< |)]+' '/define FFMS_VERSION/ { printf "%d.%d.%d%s", $3, $5, $7, ($9 ? sprintf(".%d", $9) : "") }' include/ffms.h)"
+echo_maybe '' "$(perl -ne '/define FFMS_VERSION.*?(\d+) << 24.*?(\d+) << 16.*?(\d+) << 8.*?(\d+)/ && print "$1.$2.$3". ($4 ? ".$4" : "")' include/ffms.h)"
+# All of the following break pkg-config version checking!
+# But if we get to this point we can't output anything "proper" anymore so at least try to be useful
+echo_maybe 'r' "$(git log HEAD~1.. 2>/dev/null | grep git-svn-id | cut -d@ -f2 | cut -d' ' -f1)"
+echo_maybe 'git-r' "$(git log HEAD~1.. 2>/dev/null | sed 1q | cut -d' ' -f2 | head -c7)"
+# While git returns no output when not on a git repository,
+# svnversion still does, so run it last
+echo_maybe 'r' "$(svnversion 2>/dev/null)"
+echo_maybe '' "unknown"