diff --git a/CMakeLists.txt b/CMakeLists.txt index f6f7139a97..5f6be6fb4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ OPTION (AUTOTOOLS_IN_DIST "Add autotools support to distribution tarballs." ON) # These are also settable from the command line in a similar way. +SET(GNUCASH_BUILD_ID "" CACHE STRING "Overrides the GnuCash build identification (Build ID) which defaults to a description of the vcs commit from which gnucash is built. Distributions may want to insert a package management based version number instead") SET(BINDIR ${CMAKE_INSTALL_PREFIX}/bin CACHE STRING "user executables") SET(SYSCONFDIR ${CMAKE_INSTALL_PREFIX}/etc CACHE STRING "read-only single-machine data") SET(DATAROOTDIR ${CMAKE_INSTALL_PREFIX}/share CACHE STRING "read-only arch.-independent data root") diff --git a/common/config.h.cmake.in b/common/config.h.cmake.in index fe6ecc9226..34e7e9c348 100644 --- a/common/config.h.cmake.in +++ b/common/config.h.cmake.in @@ -49,6 +49,11 @@ /* Don't use deprecated gnome functions */ #cmakedefine GNOME_DISABLE_DEPRECATED +/* GnuCash build identification, which defaults to a description of the vcs + commit from which gnucash is built. Distributions may want to insert a + package management based version string instead. */ +#define GNUCASH_BUILD_ID "@GNUCASH_BUILD_ID@" + /* Most recent stable GnuCash series */ #define GNUCASH_LATEST_STABLE_SERIES "@GNUCASH_LATEST_STABLE_SERIES@" diff --git a/configure.ac b/configure.ac index fcf0a37885..6592592972 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,14 @@ AC_DEFINE_UNQUOTED(GNUCASH_RESAVE_VERSION, $GNUCASH_RESAVE_VERSION, AC_DEFINE_UNQUOTED(GNUCASH_LATEST_STABLE_SERIES, "$GNUCASH_LATEST_STABLE_SERIES", [Most recent stable GnuCash series]) +AC_ARG_VAR([GNUCASH_BUILD_ID],[Overrides the GnuCash build identification (Build ID) which defaults +to a description of the vcs commit from which gnucash is built. Distributions may want to insert a package +management based version number instead]) +AC_DEFINE_UNQUOTED(GNUCASH_BUILD_ID, "$GNUCASH_BUILD_ID", + [GnuCash build identification, which defaults + to a description of the vcs commit from which gnucash is built. Distributions may want + to insert a package management based version string instead.]) + dnl Set of available languages: dnl managed at the Translation Project: TP_LINGUAS="az ca cs da eu fa ja nl rw sk sr sv tr uk zh_CN" diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c index 6944fcda64..ea67b82ed7 100644 --- a/gnucash/gnome-utils/gnc-main-window.c +++ b/gnucash/gnome-utils/gnc-main-window.c @@ -4476,14 +4476,20 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window) GTK_ICON_LOOKUP_USE_BUILTIN, NULL); - #ifdef GNC_VCS vcs = GNC_VCS " "; #else vcs = ""; #endif - version = g_strdup_printf ("%s: %s\n%s: %s%s (%s)", _("Version"), VERSION, - _("Build ID"), vcs, GNC_VCS_REV, GNC_VCS_REV_DATE); + + /* Allow builder to override the build id (eg distributions may want to + * print an package source version number (rpm, dpkg,...) instead of our git ref */ + if (g_strcmp0("", GNUCASH_BUILD_ID) != 0) + version = g_strdup_printf ("%s: %s\n%s: %s", _("Version"), VERSION, + _("Build ID"), GNUCASH_BUILD_ID); + else + version = g_strdup_printf ("%s: %s\n%s: %s%s (%s)", _("Version"), VERSION, + _("Build ID"), vcs, GNC_VCS_REV, GNC_VCS_REV_DATE); priv->about_dialog = gtk_about_dialog_new (); g_object_set (priv->about_dialog, "authors", authors, diff --git a/gnucash/gnome-utils/gnc-splash.c b/gnucash/gnome-utils/gnc-splash.c index d8c63783ce..1cb20b36d0 100644 --- a/gnucash/gnome-utils/gnc-splash.c +++ b/gnucash/gnome-utils/gnc-splash.c @@ -93,14 +93,22 @@ gnc_show_splash_screen (void) gtk_box_set_homogeneous (GTK_BOX (vbox), FALSE); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_box_set_homogeneous (GTK_BOX (hbox), FALSE); + #ifdef GNC_VCS vcs = GNC_VCS " "; #else vcs = ""; #endif - ver_string = g_strdup_printf("%s: %s, %s: %s%s (%s)", _("Version"), - VERSION, _("Build ID"), vcs, GNC_VCS_REV, - GNC_VCS_REV_DATE); + + /* Allow builder to override the build id (eg distributions may want to + * print an package source version number (rpm, dpkg,...) instead of our git ref */ + if (g_strcmp0("", GNUCASH_BUILD_ID) != 0) + ver_string = g_strdup_printf("%s: %s, %s: %s", _("Version"), + VERSION, _("Build ID"), GNUCASH_BUILD_ID); + else + ver_string = g_strdup_printf("%s: %s, %s: %s%s (%s)", _("Version"), + VERSION, _("Build ID"), vcs, GNC_VCS_REV, + GNC_VCS_REV_DATE); version = gtk_label_new(NULL); markup = g_markup_printf_escaped(MARKUP_STRING, ver_string); diff --git a/gnucash/gnucash-bin.c b/gnucash/gnucash-bin.c index fb3094adb0..1569a416d1 100644 --- a/gnucash/gnucash-bin.c +++ b/gnucash/gnucash-bin.c @@ -452,8 +452,15 @@ gnc_parse_command_line(int *argc, char ***argv) #else vcs = ""; #endif - g_print ("\n%s: %s%s (%s)\n", - _("Build ID"), vcs, GNC_VCS_REV, GNC_VCS_REV_DATE); + + /* Allow builder to override the build id (eg distributions may want to + * print an package source version number (rpm, dpkg,...) instead of our git ref */ + if (g_strcmp0("", GNUCASH_BUILD_ID) != 0) + g_print ("\n%s: %s\n", + _("Build ID"), GNUCASH_BUILD_ID); + else + g_print ("\n%s: %s%s (%s)\n", + _("Build ID"), vcs, GNC_VCS_REV, GNC_VCS_REV_DATE); exit(0); }