[PATCH libinput] tools: add the git version in the libinput-record output

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 1 02:09:42 UTC 2018


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 meson.build                   | 5 +++++
 src/libinput-git-version.h.in | 3 +++
 tools/libinput-record.c       | 2 ++
 3 files changed, 10 insertions(+)
 create mode 100644 src/libinput-git-version.h.in

diff --git a/meson.build b/meson.build
index 60caf997..c5c7dcca 100644
--- a/meson.build
+++ b/meson.build
@@ -231,6 +231,11 @@ pkgconfig.generate(
 	libraries : lib_libinput
 )
 
+vcs_tag(['git', 'describe'],
+	'unknown',
+	input : 'src/libinput-git-version.h.in',
+	output :'libinput-git-version.h')
+
 # Restore the SELinux context for the libinput.so.a.b.c on install
 # meson bug https://github.com/mesonbuild/meson/issues/1967
 meson.add_install_script('src/libinput-restore-selinux-context.sh',
diff --git a/src/libinput-git-version.h.in b/src/libinput-git-version.h.in
new file mode 100644
index 00000000..c2d68af9
--- /dev/null
+++ b/src/libinput-git-version.h.in
@@ -0,0 +1,3 @@
+#pragma once
+
+#define LIBINPUT_GIT_VERSION "@VCS_TAG@"
diff --git a/tools/libinput-record.c b/tools/libinput-record.c
index 73336957..32031fad 100644
--- a/tools/libinput-record.c
+++ b/tools/libinput-record.c
@@ -38,6 +38,7 @@
 
 #include "libinput-util.h"
 #include "libinput-version.h"
+#include "libinput-git-version.h"
 
 static const int FILE_VERSION_NUMBER = 1;
 
@@ -278,6 +279,7 @@ print_libinput_header(struct record_context *ctx)
 	iprintf(ctx, "libinput:\n");
 	indent_push(ctx);
 	iprintf(ctx, "version: \"%s\"\n", LIBINPUT_VERSION);
+	iprintf(ctx, "git: \"%s\"\n", LIBINPUT_GIT_VERSION);
 	if (ctx->timeout > 0)
 		iprintf(ctx, "autorestart: %d\n", ctx->timeout);
 	indent_pop(ctx);
-- 
2.14.3



More information about the wayland-devel mailing list