[PATCH spice-gtk 05/12] meson: add vcs_tag to session init debug log

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Use the trick recommended here to generate a vcs_tag.h at build-time:
https://github.com/mesonbuild/meson/issues/3903

Hopefully, meson will learn to generate project version from git:
https://github.com/mesonbuild/meson/issues/688

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 src/meson.build     | 12 ++++++++++++
 src/spice-session.c |  3 ++-
 src/vcs_tag.h.in    |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 src/vcs_tag.h.in

diff --git a/src/meson.build b/src/meson.build
index c55db44..e580429 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -82,9 +82,21 @@ spice_client_glib_introspection_sources = [
   'usb-device-manager.c',
 ]
 
+vcs_conf = configuration_data()
+vcs_conf.set('VCS_TAG', '@VCS_TAG@')
+vcs_tag_h = vcs_tag(
+  input : configure_file(
+    input : 'vcs_tag.h.in',
+    output : 'vcs_tag.h.in',
+    configuration: vcs_conf,
+  ),
+  output : 'vcs_tag.h',
+)
+
 spice_client_glib_sources = [
   spice_marshals,
   spice_client_glib_introspection_sources,
+  vcs_tag_h,
   'bio-gio.c',
   'bio-gio.h',
   'channel-base.c',
diff --git a/src/spice-session.c b/src/spice-session.c
index 5609c9b..d9825e3 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -32,6 +32,7 @@
 #include "spice-uri-priv.h"
 #include "channel-playback-priv.h"
 #include "spice-audio-priv.h"
+#include "vcs_tag.h"
 
 #define IMAGES_CACHE_SIZE_DEFAULT (1024 * 1024 * 80)
 #define MIN_GLZ_WINDOW_SIZE_DEFAULT (1024 * 1024 * 12)
@@ -277,7 +278,7 @@ static void spice_session_init(SpiceSession *session)
     SpiceSessionPrivate *s;
     gchar *channels;
 
-    SPICE_DEBUG("New session (compiled from package " PACKAGE_STRING ")");
+    SPICE_DEBUG("New session (package version: " VCS_TAG ")");
     s = session->priv = spice_session_get_instance_private(session);
 
     channels = spice_channel_supported_string();
diff --git a/src/vcs_tag.h.in b/src/vcs_tag.h.in
new file mode 100644
index 0000000..5d8985d
--- /dev/null
+++ b/src/vcs_tag.h.in
@@ -0,0 +1 @@
+#define VCS_TAG "@VCS_TAG@"
-- 
2.20.1.98.gecbdaf0899

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]