summaryrefslogtreecommitdiff
blob: 17320543b9ee74cb899623f1abedfa0dd33c88ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From ac157ef9c7b90d995436d999f15f41f04bff6052 Mon Sep 17 00:00:00 2001
From: Marek Szuba <Marek.Szuba@cern.ch>
Date: Fri, 10 Apr 2020 22:08:00 +0100
Subject: [PATCH 2/2] Actually let meson use pre-generated introspection file

Unlike autoconf, meson scripts actually aborted if the program 'xxd' was
absent regardless of whether the pre-generated introspection file was
found or not. Make xxd optional, and if it is not found print a warning
and make the dependency object xml_introspection_h point at the relevant
file in the source directory instead of generating a new one in the build
directory. If that file does not exist either, abort.
---
 meson.build | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/meson.build b/meson.build
index 02e6c73..68fa23c 100644
--- a/meson.build
+++ b/meson.build
@@ -13,7 +13,7 @@ add_project_arguments(
 
 cc = meson.get_compiler('c')
 sh = find_program('sh')
-xxd = find_program('xxd')
+xxd = find_program('xxd', required: false)
 
 dbus_dep = dependency('dbus-1')
 libcap_dep = dependency('libcap')
@@ -80,14 +80,19 @@ config_h = configure_file(
         configuration: config,
 )
 
-xml_introspection_h = configure_file(
-        input: 'org.freedesktop.RealtimeKit1.xml',
-        output: 'xml-introspection.h',
-        command: [
-                sh, '-c', '"$1" -i < "$2" > "$3"', sh,
-                xxd, '@INPUT@', '@OUTPUT@'
-        ],
-)
+if xxd.found()
+        xml_introspection_h = configure_file(
+                input: 'org.freedesktop.RealtimeKit1.xml',
+                output: 'xml-introspection.h',
+                command: [
+                        sh, '-c', '"$1" -i < "$2" > "$3"', sh,
+                        xxd, '@INPUT@', '@OUTPUT@'
+                ],
+        )
+else
+        warning('xxd not found, cannot compile introspection XML. Looking for existing one...')
+        xml_introspection_h = files('xml-introspection.h')
+endif
 
 executable(
         'rtkit-daemon',
-- 
2.24.1