Code

build system: Use the script version-gen.sh to determine the pkg version. sh/next
authorSebastian Harl <sh@tokkee.org>
Thu, 17 Feb 2011 08:16:45 +0000 (09:16 +0100)
committerSebastian 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.

Makefile.am
configure.ac
version-gen.sh [new file with mode: 0755]

index 1f529a8a855d270b2f2b298bad350a42b95dfbe0..b3bbc9b1c7d0ec49772c266d6aca7edcd740e5b2 100644 (file)
@@ -1 +1,3 @@
+EXTRA_DIST = version-gen.sh
+
 SUBDIRS = share src
index e27fd542bc2f4f40aeaae773f10601c5a1431393..b1bd1770f8c3851057f091e5254d93d635323a12 100644 (file)
@@ -1,4 +1,4 @@
-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
new file mode 100755 (executable)
index 0000000..5eafe09
--- /dev/null
@@ -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
+