talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 3da40e5af0a50c1e3081aca4f1177b2992900d46
parent 4580575475a4bf97637c3cdd73cbd7430393066d
Author: Ricardo Mones <ricardo@mones.org>
Date:   Wed, 20 Mar 2013 00:10:58 +0100

Get configure.ac version values from git

Computes the VERSION, MAJOR_VERSION, MINOR_VERSION and MICRO_VERSION
values in configure.ac from 'git describe' output.

Adds new HASH_VERSION and GIT_VERSION, available as VERSION_GIT_HASH
and VERSION_GIT_FULL defines. On releases HASH_VERSION is empty and
GIT_VERSION is equal to VERSION (modulo EXTRA values). Full git version
is shown in about.

Requires latest release version to be tagged with an annotated tag.

Untested on win32 platforms, but should work as long as git and cut
binaries are on %PATH%.

Diffstat:
Mconfigure.ac | 33++++++++++++++++++++++++++-------
Msrc/common/version.h.in | 2++
Msrc/gtk/about.c | 2+-
3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -7,19 +7,36 @@ AC_CONFIG_MACRO_DIR([m4]) PACKAGE=claws-mail dnl version number -MAJOR_VERSION=3 -MINOR_VERSION=9 -MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=128 EXTRA_RELEASE= EXTRA_GTK2_VERSION= -if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then - VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION} +GIT_VERSION=`git describe --abbrev=6 --dirty --always` +MAJOR_VERSION=`echo $GIT_VERSION | cut -f1 -d- | cut -f1 -d.` +MINOR_VERSION=`echo $GIT_VERSION | cut -f1 -d- | cut -f2 -d.` +MICRO_VERSION=`echo $GIT_VERSION | cut -f1 -d- | cut -f3 -d.` +EXTRA_VERSION=`echo $GIT_VERSION | cut -f2 -d-` +HASH_VERSION=`echo $GIT_VERSION | cut -f3 -d-` +DIRTY_VERSION=`echo $GIT_VERSION | cut -f4 -d-` + +if test \( "x$EXTRA_VERSION" != "x" \); then + VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}git${EXTRA_VERSION} else - VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}${EXTRA_GTK2_VERSION} + VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION} + EXTRA_VERSION=0 +fi + +if test \( "x$HASH_VERSION" != "x" \); then + if test \( "x$DIRTY_VERSION" != "x" \); then + VERSION=${VERSION}+${HASH_VERSION}+local + else + VERSION=${VERSION}+${HASH_VERSION} + fi +fi + +if test \( "x$EXTRA_RELEASE" != "x" \); then + VERSION=${VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION} fi dnl set $target @@ -35,6 +52,8 @@ AC_SUBST(MAJOR_VERSION) AC_SUBST(MINOR_VERSION) AC_SUBST(MICRO_VERSION) AC_SUBST(EXTRA_VERSION) +AC_SUBST(GIT_VERSION) +AC_SUBST(HASH_VERSION) AC_CHECK_PROG(HAVE_GTK_ICON_CACHE, gtk-update-icon-cache, yes, no) AM_CONDITIONAL(UPDATE_GTK_ICON_CACHE, test x"$HAVE_GTK_ICON_CACHE" = xyes) diff --git a/src/common/version.h.in b/src/common/version.h.in @@ -30,5 +30,7 @@ #define PROG_VERSION "Claws Mail "VERSION #define VERSION_NUMERIC MAKE_NUMERIC_VERSION(@MAJOR_VERSION@, @MINOR_VERSION@, \ @MICRO_VERSION@, @EXTRA_VERSION@) +#define VERSION_GIT_FULL "@GIT_VERSION@" +#define VERSION_GIT_HASH "@HASH_VERSION@" #endif /* __VERSION_H__ */ diff --git a/src/gtk/about.c b/src/gtk/about.c @@ -821,7 +821,7 @@ static void about_create(void) gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0); markup = g_markup_printf_escaped ("<span weight=\"bold\" size=\"xx-large\">Claws Mail</span>\nversion %s", - VERSION); + VERSION_GIT_FULL); gtk_label_set_markup(GTK_LABEL(label), markup); g_free(markup);