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

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ depcomp
install-sh
missing
stamp-h1
.version
autom4te.cache/
m4/

View File

@ -7,3 +7,7 @@ SUBDIRS = doc po src
EXTRA_DIST = \
INSTALL \
ABOUT-NLS
BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@

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

View File

@ -2,7 +2,9 @@
# Init
#-------------------------------------------------------------------------------
AC_PREREQ(2.59)
AC_INIT(calcurse, 2.8, bugs@calcurse.org)
AC_INIT([calcurse],
m4_esyscmd([build-aux/git-version-gen .version]),
[bugs@calcurse.org])
AM_INIT_AUTOMAKE
#m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AM_GNU_GETTEXT([external])