From: Sebastian Harl Date: Thu, 17 Feb 2011 08:16:45 +0000 (+0100) Subject: build system: Use the script version-gen.sh to determine the pkg version. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=795364d7b79a11cfb2ecea22827c873263730315;p=collection4.git build system: Use the script version-gen.sh to determine the pkg version. This script tries to get detailed information from Git about the current version based on the latest reachable tag and git-describe. --- diff --git a/Makefile.am b/Makefile.am index 1f529a8..b3bbc9b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,3 @@ +EXTRA_DIST = version-gen.sh + SUBDIRS = share src diff --git a/configure.ac b/configure.ac index e27fd54..b1bd177 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 0000000..5eafe09 --- /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 +