mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-19 16:11:32 +00:00
build: embed git-commit-id as string inside libnm binary
In the 'configure.ac' script we already detect the git commit id for the current source version. When creating a tarball, it is also included inside the generated 'configure' script. Add the commit id as a static string to nm-utils.c. That way, having a build of libnm.so or NetworkManager, you can quickly find the corresponding git commit: strings src/NetworkManager | grep NM_GIT_SHA Note that this only works after a new `autogen.sh` run. Only rebuilding is not enough. Hence, you must rebuild all to ensure that the correct commit id is embedded. https://bugzilla.gnome.org/show_bug.cgi?id=741651
This commit is contained in:
parent
422fbf48b9
commit
924f7b2064
|
@ -59,6 +59,7 @@ AC_SUBST(NM_MAJOR_VERSION)
|
|||
AC_SUBST(NM_MINOR_VERSION)
|
||||
AC_SUBST(NM_MICRO_VERSION)
|
||||
AC_SUBST(NM_VERSION)
|
||||
AC_DEFINE_UNQUOTED(NM_GIT_SHA,"$NM_GIT_SHA",[git commit id of the original source code version])
|
||||
|
||||
dnl
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nm-setting-private.h"
|
||||
#include "crypto.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
#include "nm-utils-internal.h"
|
||||
|
||||
#include "nm-setting-bond.h"
|
||||
#include "nm-setting-bridge.h"
|
||||
|
@ -46,6 +47,9 @@
|
|||
#include "nm-setting-wired.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
|
||||
/* Embed the commit id in the build binary */
|
||||
static const char *const __nm_git_sha = STRLEN (NM_GIT_SHA) > 0 ? "NM_GIT_SHA:"NM_GIT_SHA : "";
|
||||
|
||||
/**
|
||||
* SECTION:nm-utils
|
||||
* @short_description: Utility functions
|
||||
|
@ -221,6 +225,8 @@ _nm_utils_init (void)
|
|||
GModule *self;
|
||||
gpointer func;
|
||||
|
||||
(void) __nm_git_sha;
|
||||
|
||||
if (initialized)
|
||||
return;
|
||||
initialized = TRUE;
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-setting-private.h"
|
||||
#include "crypto.h"
|
||||
#include "nm-utils-internal.h"
|
||||
|
||||
/* Embed the commit id in the build binary */
|
||||
static const char *const __nm_git_sha = STRLEN (NM_GIT_SHA) > 0 ? "NM_GIT_SHA:"NM_GIT_SHA : "";
|
||||
|
||||
/**
|
||||
* SECTION:nm-utils
|
||||
|
@ -232,6 +236,8 @@ static gboolean initialized = FALSE;
|
|||
gboolean
|
||||
nm_utils_init (GError **error)
|
||||
{
|
||||
(void) __nm_git_sha;
|
||||
|
||||
if (!initialized) {
|
||||
initialized = TRUE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue