summaryrefslogtreecommitdiff
blob: 9b18310f9e246df552e4ce7f238706dd96925d5a (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
From 5bcbd2ba656ac38ba500dc110cc13dbaa0d77853 Mon Sep 17 00:00:00 2001
From: Mart Raudsepp <mart@leio.tech>
Date: Fri, 24 Sep 2021 15:19:05 +0300
Subject: [PATCH] build-sys: meson: Allow building the daemon only

---
 meson.build                       | 23 ++++++++++++++++++++---
 meson_options.txt                 |  3 +++
 po/meson.build                    |  3 ---
 shell-completion/bash/meson.build |  2 ++
 src/daemon/meson.build            |  4 ++--
 src/meson.build                   | 11 +++++++++++
 src/modules/gsettings/meson.build |  3 +--
 src/tests/meson.build             |  9 +++++++--
 src/utils/meson.build             | 10 ++++++----
 9 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/meson.build b/meson.build
index 63ed62342..420cc6fac 100644
--- a/meson.build
+++ b/meson.build
@@ -53,6 +53,8 @@ libpulse_mainloop_glib_version = '@0@.@1@.@2@'.format(
   libpulse_mainloop_glib_version_info[1],
 )
 
+i18n = import('i18n')
+
 # Paths
 
 prefix = get_option('prefix')
@@ -68,6 +70,7 @@ localedir = join_paths(prefix, get_option('localedir'))
 localstatedir = join_paths(prefix, get_option('localstatedir'))
 sysconfdir = join_paths(prefix, get_option('sysconfdir'))
 privlibdir = join_paths(libdir, 'pulseaudio')
+po_dir = join_paths(meson.current_source_dir(), 'po')
 
 if host_machine.system() == 'windows'
   # Windows only supports loading libraries from the same dir as the executable
@@ -796,20 +799,28 @@ check_dep = dependency('check', version : '>= 0.9.10', required : get_option('te
 if get_option('doxygen')
   subdir('doxygen')
 endif
-subdir('po')
+if not get_option('daemon-only')
+  subdir('po')
+endif
 if get_option('man')
   subdir('man')
 endif
 subdir('shell-completion/bash')
-subdir('shell-completion/zsh')
+if not get_option('daemon-only')
+  subdir('shell-completion/zsh')
+endif
 subdir('src')
-subdir('vala')
+if not get_option('daemon-only')
+ subdir('vala')
+endif
 
 # Now generate config.h from everything above
 configure_file(output : 'config.h', configuration : cdata)
 
 # pkg-config files
 
+if not get_option('daemon-only')
+
 pc_cdata = configuration_data()
 
 pc_cdata.set('prefix', prefix)
@@ -842,8 +853,12 @@ foreach file : pc_files
     install_dir : pkgconfigdir)
 endforeach
 
+endif # !daemon-only
+
 # CMake files
 
+if not get_option('daemon-only')
+
 m4 = find_program('m4', required: true)
 
 cmakedir = join_paths(libdir, 'cmake', 'PulseAudio')
@@ -872,6 +887,8 @@ configure_file(
   install_dir : cmakedir,
 )
 
+endif # !daemon-only
+
 ############################################################
 
 # Final summary
diff --git a/meson_options.txt b/meson_options.txt
index bb41a42a7..62828ac5c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,9 @@
 option('daemon',
        type : 'boolean', value : true,
        description : 'Enable building and installation of pulseaudio daemon and supporting configuration files')
+option('daemon-only',
+       type : 'boolean', value : false,
+       description : 'Build and install only the pulseaudio daemon and supporting configuration files, relying on a system installation of libpulse')
 option('doxygen',
        type : 'boolean', value : true,
        description : 'Enable building and installation of documentation generated with doxygen')
diff --git a/po/meson.build b/po/meson.build
index 34278db47..33429373c 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,4 +1,3 @@
-i18n = import('i18n')
 i18n.gettext(
   meson.project_name(),
   preset: 'glib',
@@ -7,5 +6,3 @@ i18n.gettext(
   args: ['--msgid-bugs-address=https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/new',
          '--width=90'],
 )
-
-po_dir = meson.current_source_dir()
diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build
index 3ba5cb16f..83d90b94b 100644
--- a/shell-completion/bash/meson.build
+++ b/shell-completion/bash/meson.build
@@ -8,6 +8,7 @@ if bashcompletiondir != 'no'
     ]
   endif
 
+  if not get_option('daemon-only')
   aliases += [
     'pacat',
     'pactl',
@@ -16,6 +17,7 @@ if bashcompletiondir != 'no'
     'parec',
     'parecord',
   ]
+  endif
 
   install_data('pulseaudio', install_dir : bashcompletiondir)
 
diff --git a/src/daemon/meson.build b/src/daemon/meson.build
index 262e193b2..e8f70a453 100644
--- a/src/daemon/meson.build
+++ b/src/daemon/meson.build
@@ -30,8 +30,8 @@ executable('pulseaudio',
   install_rpath : privlibdir,
   include_directories : [configinc, topinc],
   link_args : ['-ffast-math'],
-  link_with : [libpulsecore, libpulsecommon, libpulse],
-  dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep, dl_dep, libintl_dep, platform_dep, platform_socket_dep],
+  link_with : [libpulsecore],
+  dependencies : [ltdl_dep, cap_dep, dbus_dep, libsystemd_dep, dl_dep, libintl_dep, platform_dep, platform_socket_dep, libpulsecommon_dep, libpulse_dep],
   c_args : pa_c_args,
 )
 
diff --git a/src/meson.build b/src/meson.build
index e2860811b..a56667271 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -188,6 +188,15 @@ else
 endif
 # FIXME: Do SIMD things
 
+if get_option('daemon-only')
+  libpulsecommon_dep = cc.find_library('pulsecommon-' + pa_version_major_minor, dirs : privlibdir, required : true)
+  libpulse_dep = dependency('libpulse', required : true)
+  libpulse_simple_dep = dependency('libpulse-simple', required : true)
+  if glib_dep.found()
+    libpulse_mainloop_glib_dep = dependency('libpulse-mainloop-glib', required : true)
+  endif
+else
+
 libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
   libpulsecommon_sources,
   libpulsecommon_headers,
@@ -207,6 +216,8 @@ libpulsecommon = shared_library('pulsecommon-' + pa_version_major_minor,
 libpulsecommon_dep = declare_dependency(link_with: libpulsecommon)
 
 subdir('pulse')
+endif
+
 if get_option('daemon')
   subdir('pulsecore')
   subdir('daemon')
diff --git a/src/modules/gsettings/meson.build b/src/modules/gsettings/meson.build
index 68a72c3ff..9604699e7 100644
--- a/src/modules/gsettings/meson.build
+++ b/src/modules/gsettings/meson.build
@@ -8,8 +8,7 @@ gsettings_helper = executable('gsettings-helper',
   gsettings_helper_sources,
   c_args : pa_c_args,
   include_directories : [configinc, topinc],
-  link_with : [libpulsecommon, libpulse],
-  dependencies : [gio_dep],
+  dependencies : [gio_dep, libpulsecommon_dep, libpulse_dep],
   install_dir : pulselibexecdir,
   install_rpath : privlibdir,
   install : true,
diff --git a/src/tests/meson.build b/src/tests/meson.build
index acd301037..56d71299f 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -20,8 +20,6 @@ default_tests += [
     [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
   [ 'json-test', 'json-test.c',
     [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
-  [ 'mainloop-test', 'mainloop-test.c',
-    [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
   [ 'proplist-test', 'proplist-test.c',
     [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
   [ 'thread-mainloop-test', 'thread-mainloop-test.c',
@@ -32,6 +30,13 @@ default_tests += [
     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep ] ],
 ]
 
+if not get_option('daemon-only')
+  default_tests += [
+    [ 'mainloop-test', 'mainloop-test.c',
+      [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
+  ]
+endif
+
 if get_option('daemon')
   default_tests += [
     [ 'asyncmsgq-test', 'asyncmsgq-test.c',
diff --git a/src/utils/meson.build b/src/utils/meson.build
index c9635fdb6..7ed6e738f 100644
--- a/src/utils/meson.build
+++ b/src/utils/meson.build
@@ -1,3 +1,4 @@
+if not get_option('daemon-only')
 pacat_sources = [
   'pacat.c',
 ]
@@ -41,6 +42,7 @@ executable('pactl',
   dependencies : [sndfile_dep, libintl_dep],
   c_args : pa_c_args,
 )
+endif
 
 if get_option('daemon')
   if host_machine.system() != 'windows'
@@ -53,8 +55,7 @@ if get_option('daemon')
       install: true,
       install_rpath : privlibdir,
       include_directories : [configinc, topinc],
-      link_with : [libpulsecommon, libpulse],
-      dependencies: [libintl_dep],
+      dependencies: [libintl_dep, libpulsecommon_dep, libpulse_dep],
       c_args : pa_c_args,
     )
 
@@ -67,13 +68,13 @@ if get_option('daemon')
       install: true,
       install_rpath : privlibdir,
       include_directories : [configinc, topinc],
-      link_with : [libpulsecommon, libpulse],
-      dependencies: [libintl_dep],
+      dependencies: [libintl_dep, libpulsecommon_dep, libpulse_dep],
       c_args : pa_c_args,
     )
   endif
 endif
 
+if not get_option('daemon-only')
 if x11_dep.found()
   pax11publish_sources = [
     'pax11publish.c',
@@ -121,3 +122,4 @@ if dbus_dep.found() and fftw_dep.found()
 endif
 
 install_data('pa-info', install_dir : bindir)
+endif
-- 
2.32.0