Add GNUCASH_BUILD_ID cmake/configure variable which allows packagers to define their own

For example distros may want to set the version of their package source (rpm, dpkg,...) rather than
our git id.
This commit is contained in:
Geert Janssens
2017-10-26 13:30:29 +02:00
parent 67ae241075
commit 1a8cf021d2
6 changed files with 43 additions and 8 deletions

View File

@@ -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")

View File

@@ -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@"

View File

@@ -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"

View File

@@ -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,

View File

@@ -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);

View File

@@ -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);
}