summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dd51aaf)
raw | patch | inline | side by side (parent: dd51aaf)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 17 Feb 2011 08:16:45 +0000 (09:16 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 17 Feb 2011 08:16:45 +0000 (09:16 +0100) |
This script tries to get detailed information from Git about the current
version based on the latest reachable tag and git-describe.
version based on the latest reachable tag and git-describe.
Makefile.am | patch | blob | history | |
configure.ac | patch | blob | history | |
version-gen.sh | [new file with mode: 0755] | patch | blob |
diff --git a/Makefile.am b/Makefile.am
index 1f529a8a855d270b2f2b298bad350a42b95dfbe0..b3bbc9b1c7d0ec49772c266d6aca7edcd740e5b2 100644 (file)
--- a/Makefile.am
+++ b/Makefile.am
+EXTRA_DIST = version-gen.sh
+
SUBDIRS = share src
diff --git a/configure.ac b/configure.ac
index e27fd542bc2f4f40aeaae773f10601c5a1431393..b1bd1770f8c3851057f091e5254d93d635323a12 100644 (file)
--- a/configure.ac
+++ b/configure.ac
-AC_INIT(collection, 4.0.0)
+AC_INIT([collection], [m4_esyscmd(./version-gen.sh)])
AC_CONFIG_SRCDIR(src/main.c)
AC_CONFIG_HEADERS(src/config.h)
AM_INIT_AUTOMAKE(dist-bzip2)
diff --git a/version-gen.sh b/version-gen.sh
--- /dev/null
+++ b/version-gen.sh
@@ -0,0 +1,23 @@
+#! /bin/sh
+
+DEFAULT_VERSION="4.0.0.git"
+
+VERSION="$( git describe --tags 2> /dev/null \
+ | sed -e 's/^v//' || true )"
+
+if test -z "$VERSION"; then
+ VERSION="$DEFAULT_VERSION"
+else
+ git update-index -q --refresh || true
+ if test -n "$( git diff-index --name-only HEAD || true )"; then
+ VERSION="$VERSION-dirty"
+ fi
+fi
+
+VERSION="$( echo "$VERSION" | sed -e 's/-/./g' )"
+if test "x`uname -s`" = "xAIX" || test "x`uname -s`" = "xSunOS" ; then
+ echo "$VERSION\c"
+else
+ echo -n "$VERSION"
+fi
+