Add Git version string support.

Introduce a script to auto-generate version strings. Use `git describe`
to create descriptive version strings when building from a Git checkout,
use ".version" files for release tarballs.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2011-04-18 17:45:50 +02:00
parent cbd66b13b1
commit c5e4187590
4 changed files with 32 additions and 1 deletions

24
build-aux/git-version-gen Executable file
View File

@@ -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