summaryrefslogtreecommitdiffstats
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/git-version-gen24
1 files changed, 24 insertions, 0 deletions
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
new file mode 100755
index 0000000..2cc88fc
--- /dev/null
+++ b/build-aux/git-version-gen
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ "$#" -ne 1 ]
+then
+ echo "usage: git-version-gen <verfile>" >&2
+ exit 1
+fi
+
+VERFILE="$1"
+
+if [ -d '.git' ]
+then
+ VERSION=`git describe --abbrev=4 --match='v[0-9]*' --dirty | sed 's/^v//'`
+ echo -n "$VERSION" > "$VERFILE"
+fi
+
+if [ -f "$VERFILE" ]
+then
+ cat "$VERFILE"
+else
+ echo "git-version-gen: unknown version number." >&2
+ exit 1
+fi
+