[recipes] Make the git describe hack work with meson
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Make the git describe hack work with meson
- Date: Sun, 5 Mar 2017 05:43:15 +0000 (UTC)
commit 1cc3795077231742cb045bed556ef5347e002338
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 4 22:45:47 2017 -0500
Make the git describe hack work with meson
This was quitely skipped in the meson build, because
MICRO_VERSION was never defined. Change things around
to parse the version at runtime.
meson.build | 8 ++++++++
src/Makefile.am | 3 +--
src/gr-about-dialog.c | 16 +++++++++++-----
3 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index be7baa7..271b3ac 100644
--- a/meson.build
+++ b/meson.build
@@ -25,6 +25,14 @@ else
conf.set_quoted('LIBGD_INFO', 'unknown')
endif
+git_run = run_command('git', ['-C', meson.source_root(), 'describe'])
+if git_run.returncode() == 0
+ conf.set_quoted('COMMIT_ID', git_run.stdout().strip())
+else
+ message('Failed to extract git commit ID for recipes:\n' + git_run.stderr())
+ conf.set_quoted('COMMIT_ID', 'unknown')
+endif
+
# Options + dependency checking is overly verbose and repetitive right now, but
# there is work ongoing to fix it: https://github.com/mesonbuild/meson/pull/1330
autoar_dep = []
diff --git a/src/Makefile.am b/src/Makefile.am
index 9166175..0ecd6b4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,14 +8,13 @@ gnome_recipes_CFLAGS = \
-Wno-sign-compare \
-O0 -ggdb \
$(RECIPES_CFLAGS) \
- -DG_LOG_DOMAIN=\"$(PACKAGE_NAME)\" \
+ -DG_LOG_DOMAIN=\"org.gnome.Recipes\" \
-DPACKAGE_NAME=\"$(PACKAGE_NAME)\" \
-DPKGDATADIR=\"$(pkgdatadir)\" \
-DDATADIR=\"$(datadir)\" \
-DLOCALEDIR=\"$(localedir)\" \
-DCOMMIT_ID=\"$(commitid)\" \
-DLIBGD_INFO=\"$(libgd_info)\" \
- -DMICRO_VERSION=$(MICRO_VERSION) \
-I "$(top_srcdir)/libgd" \
-I "$(top_srcdir)/src" \
-I "$(top_builddir)/src"
diff --git a/src/gr-about-dialog.c b/src/gr-about-dialog.c
index ad9f5b4..a8d21e9 100644
--- a/src/gr-about-dialog.c
+++ b/src/gr-about-dialog.c
@@ -27,6 +27,8 @@
#include "gr-about-dialog.h"
#include "gr-utils.h"
+#include <stdlib.h>
+
#ifdef GDK_WINDOWING_QUARTZ
#include <sys/sysctl.h>
#endif
@@ -841,6 +843,8 @@ gr_about_dialog_new (void)
NULL
};
g_autoptr(GdkPixbuf) logo = NULL;
+ const char *p;
+ const char *version;
logo = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
"org.gnome.Recipes",
@@ -848,13 +852,15 @@ gr_about_dialog_new (void)
GTK_ICON_LOOKUP_FORCE_SIZE,
NULL);
+ p = strrchr (PACKAGE_VERSION, '.');
+ if (p && (atoi (p + 1) % 2 == 1))
+ version = COMMIT_ID;
+ else
+ version = PACKAGE_VERSION;
+
about = g_object_new (GR_TYPE_ABOUT_DIALOG,
"program-name", _("Recipes"),
-#if MICRO_VERSION % 2 == 1
- "version", COMMIT_ID,
-#else
- "version", PACKAGE_VERSION,
-#endif
+ "version", version,
"copyright", "© 2016, 2017 Matthias Clasen",
"license-type", GTK_LICENSE_GPL_3_0,
"comments", _("GNOME loves to cook"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]