summaryrefslogtreecommitdiff
blob: 15558b47be3d58fb68dabe664059387451bda8f9 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
From b561bd29d8797ae2e72d45df8fc122164fc88b6c Mon Sep 17 00:00:00 2001
From: Mart Raudsepp <leio@gentoo.org>
Date: Sun, 20 Oct 2019 14:57:43 +0300
Subject: [PATCH] build: Support disabling introspection and vapi generation

---
 meson_options.txt | 14 +++++++++++
 src/meson.build   | 64 ++++++++++++++++++++++++++---------------------
 2 files changed, 49 insertions(+), 29 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index a7ce738..c794d4b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,3 +4,17 @@ option (
   description: 'Find devices via udev',
   value: 'auto'
 )
+
+option (
+  'introspection',
+  type: 'boolean',
+  description: 'Generate introspection data (requires gobject-introspection)',
+  value: true
+)
+
+option (
+  'vapi',
+  type: 'boolean',
+  description: 'Generate vapi data (requires vapigen and introspection option)',
+  value: true
+)
diff --git a/src/meson.build b/src/meson.build
index 7ac916b..50cad92 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -90,39 +90,45 @@ if gudev.found()
   libmanette_gir_includes += [ 'GUdev-1.0' ]
 endif
 
-libmanette_gir = gnome.generate_gir(
-  libmanette_lib,
-  extra_args: libmanette_gir_args,
-  export_packages: libmanette_module,
-  sources: libmanette_headers + libmanette_sources,
-  nsversion: api_version,
-  namespace: 'Manette',
-  identifier_prefix: 'Manette',
-  includes: libmanette_gir_includes,
-  header: libmanette_main_header,
-  install: true,
-  symbol_prefix: 'manette',
-)
-
-libmanette_vapi_packages = [
-  'gobject-2.0',
-  'gio-2.0',
-]
-
-if gudev.found()
-  libmanette_vapi_packages += [ 'gudev-1.0' ]
+built_girs = []
+if get_option('introspection')
+  libmanette_gir = gnome.generate_gir(
+    libmanette_lib,
+    extra_args: libmanette_gir_args,
+    export_packages: libmanette_module,
+    sources: libmanette_headers + libmanette_sources,
+    nsversion: api_version,
+    namespace: 'Manette',
+    identifier_prefix: 'Manette',
+    includes: libmanette_gir_includes,
+    header: libmanette_main_header,
+    install: true,
+    symbol_prefix: 'manette',
+  )
+  built_girs += [ libmanette_gir ]
+
+  if get_option('vapi')
+    libmanette_vapi_packages = [
+      'gobject-2.0',
+      'gio-2.0',
+    ]
+
+    if gudev.found()
+      libmanette_vapi_packages += [ 'gudev-1.0' ]
+    endif
+
+    gnome.generate_vapi(
+      libmanette_module,
+      install: true,
+      packages: libmanette_vapi_packages,
+      sources: libmanette_gir[0],
+    )
+  endif
 endif
 
-gnome.generate_vapi(
-  libmanette_module,
-  install: true,
-  packages: libmanette_vapi_packages,
-  sources: libmanette_gir[0],
-)
-
 libmanette_dep = declare_dependency(
   link_with: libmanette_lib,
-  sources: libmanette_gir,
+  sources: built_girs,
   include_directories: confinc,
   dependencies: libmanette_deps,
 )
-- 
2.20.1