Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/pulseaudio/, media-sound/pulseaudio/files/
Date: Sun, 30 Jun 2019 11:23:06
Message-Id: 1561893770.a4f08a1601d56e585c3c724d68b80e1614f9c49e.pacho@gentoo
1 commit: a4f08a1601d56e585c3c724d68b80e1614f9c49e
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jun 30 11:20:56 2019 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sun Jun 30 11:22:50 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4f08a16
7
8 media-sound/pulseaudio: Fix relogin issues and alsa-lib compat
9
10 Closes: https://bugs.gentoo.org/686206
11 Package-Manager: Portage-2.3.67, Repoman-2.3.16
12 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
13
14 .../files/pulseaudio-12.2-alsa-header-path.patch | 130 ++++++++
15 .../files/pulseaudio-12.2-alsa-header-path2.patch | 45 +++
16 .../files/pulseaudio-12.2-exit-time-session.patch | 181 ++++++++++
17 media-sound/pulseaudio/pulseaudio-12.2-r2.ebuild | 366 +++++++++++++++++++++
18 4 files changed, 722 insertions(+)
19
20 diff --git a/media-sound/pulseaudio/files/pulseaudio-12.2-alsa-header-path.patch b/media-sound/pulseaudio/files/pulseaudio-12.2-alsa-header-path.patch
21 new file mode 100644
22 index 00000000000..334af3ee755
23 --- /dev/null
24 +++ b/media-sound/pulseaudio/files/pulseaudio-12.2-alsa-header-path.patch
25 @@ -0,0 +1,130 @@
26 +From 993d3fd89e5611997f1e165bf03edefb0204b0a4 Mon Sep 17 00:00:00 2001
27 +From: Olaf Hering <olaf@××××××.de>
28 +Date: Wed, 27 Mar 2019 09:35:05 +0100
29 +Subject: [PATCH 287/375] alsa: Use correct header path
30 +
31 +Consumers are expected to use <alsa/asoundlib.h> instead of
32 +<asoundlib.h>.
33 +
34 +This is in preparation of an change to pkgconfig(alsa) to
35 +not pollute CFLAGS with -I/usr/include/alsa anymore.
36 +
37 +Signed-off-by: Olaf Hering <olaf@××××××.de>
38 +---
39 + src/modules/alsa/alsa-mixer.c | 2 +-
40 + src/modules/alsa/alsa-mixer.h | 2 +-
41 + src/modules/alsa/alsa-sink.c | 2 +-
42 + src/modules/alsa/alsa-source.c | 2 +-
43 + src/modules/alsa/alsa-ucm.c | 2 +-
44 + src/modules/alsa/alsa-util.c | 2 +-
45 + src/modules/alsa/alsa-util.h | 2 +-
46 + src/modules/alsa/module-alsa-source.c | 2 +-
47 + 8 files changed, 8 insertions(+), 8 deletions(-)
48 +
49 +diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
50 +index 5cb99c8fd..cd99a75f8 100644
51 +--- a/src/modules/alsa/alsa-mixer.c
52 ++++ b/src/modules/alsa/alsa-mixer.c
53 +@@ -23,7 +23,7 @@
54 + #endif
55 +
56 + #include <sys/types.h>
57 +-#include <asoundlib.h>
58 ++#include <alsa/asoundlib.h>
59 + #include <math.h>
60 +
61 + #ifdef HAVE_VALGRIND_MEMCHECK_H
62 +diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h
63 +index 3ea4d7329..65b071165 100644
64 +--- a/src/modules/alsa/alsa-mixer.h
65 ++++ b/src/modules/alsa/alsa-mixer.h
66 +@@ -21,7 +21,7 @@
67 + along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
68 + ***/
69 +
70 +-#include <asoundlib.h>
71 ++#include <alsa/asoundlib.h>
72 +
73 + #include <pulse/sample.h>
74 + #include <pulse/mainloop-api.h>
75 +diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
76 +index 28143402a..4b46708ce 100644
77 +--- a/src/modules/alsa/alsa-sink.c
78 ++++ b/src/modules/alsa/alsa-sink.c
79 +@@ -25,7 +25,7 @@
80 + #include <signal.h>
81 + #include <stdio.h>
82 +
83 +-#include <asoundlib.h>
84 ++#include <alsa/asoundlib.h>
85 +
86 + #ifdef HAVE_VALGRIND_MEMCHECK_H
87 + #include <valgrind/memcheck.h>
88 +diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
89 +index 8129220b0..c8bf649e1 100644
90 +--- a/src/modules/alsa/alsa-source.c
91 ++++ b/src/modules/alsa/alsa-source.c
92 +@@ -25,7 +25,7 @@
93 + #include <signal.h>
94 + #include <stdio.h>
95 +
96 +-#include <asoundlib.h>
97 ++#include <alsa/asoundlib.h>
98 +
99 + #include <pulse/rtclock.h>
100 + #include <pulse/timeval.h>
101 +diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
102 +index 341c8012e..0a40ca8fe 100644
103 +--- a/src/modules/alsa/alsa-ucm.c
104 ++++ b/src/modules/alsa/alsa-ucm.c
105 +@@ -27,7 +27,7 @@
106 + #include <ctype.h>
107 + #include <sys/types.h>
108 + #include <limits.h>
109 +-#include <asoundlib.h>
110 ++#include <alsa/asoundlib.h>
111 +
112 + #ifdef HAVE_VALGRIND_MEMCHECK_H
113 + #include <valgrind/memcheck.h>
114 +diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
115 +index e8d712e72..bd0a47e50 100644
116 +--- a/src/modules/alsa/alsa-util.c
117 ++++ b/src/modules/alsa/alsa-util.c
118 +@@ -23,7 +23,7 @@
119 + #endif
120 +
121 + #include <sys/types.h>
122 +-#include <asoundlib.h>
123 ++#include <alsa/asoundlib.h>
124 +
125 + #include <pulse/sample.h>
126 + #include <pulse/xmalloc.h>
127 +diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
128 +index 6b27339ec..4ceaa06ee 100644
129 +--- a/src/modules/alsa/alsa-util.h
130 ++++ b/src/modules/alsa/alsa-util.h
131 +@@ -21,7 +21,7 @@
132 + along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
133 + ***/
134 +
135 +-#include <asoundlib.h>
136 ++#include <alsa/asoundlib.h>
137 +
138 + #include <pulse/sample.h>
139 + #include <pulse/channelmap.h>
140 +diff --git a/src/modules/alsa/module-alsa-source.c b/src/modules/alsa/module-alsa-source.c
141 +index af6800dd2..747ba9342 100644
142 +--- a/src/modules/alsa/module-alsa-source.c
143 ++++ b/src/modules/alsa/module-alsa-source.c
144 +@@ -24,7 +24,7 @@
145 +
146 + #include <stdio.h>
147 +
148 +-#include <asoundlib.h>
149 ++#include <alsa/asoundlib.h>
150 +
151 + #ifdef HAVE_VALGRIND_MEMCHECK_H
152 + #include <valgrind/memcheck.h>
153 +--
154 +2.21.0
155 +
156
157 diff --git a/media-sound/pulseaudio/files/pulseaudio-12.2-alsa-header-path2.patch b/media-sound/pulseaudio/files/pulseaudio-12.2-alsa-header-path2.patch
158 new file mode 100644
159 index 00000000000..c592da2205e
160 --- /dev/null
161 +++ b/media-sound/pulseaudio/files/pulseaudio-12.2-alsa-header-path2.patch
162 @@ -0,0 +1,45 @@
163 +From b89d33bb182c42db5ad3987b0e91b7bf62f421e8 Mon Sep 17 00:00:00 2001
164 +From: Takashi Iwai <tiwai@××××.de>
165 +Date: Sun, 21 Apr 2019 11:59:30 +0200
166 +Subject: [PATCH 304/375] alsa: Fix inclusion of use-case.h
167 +
168 +The recent change in ALSA upstream stripped -I$include/alsa path from
169 +pkgconfig. We already fixed for this change in some places but still
170 +the code for UCM was overlooked, and this resulted in the unresolved
171 +symbols in alsa card module. Fix them as well.
172 +
173 +Signed-off-by: Takashi Iwai <tiwai@××××.de>
174 +---
175 + configure.ac | 2 +-
176 + src/modules/alsa/alsa-ucm.h | 2 +-
177 + 2 files changed, 2 insertions(+), 2 deletions(-)
178 +
179 +diff --git a/configure.ac b/configure.ac
180 +index c004bd70d..b44ed1595 100644
181 +--- a/configure.ac
182 ++++ b/configure.ac
183 +@@ -826,7 +826,7 @@ AS_IF([test "x$enable_alsa" = "xyes" && test "x$HAVE_ALSA" = "x0"],
184 + AS_IF([test "x$HAVE_ALSA" = "x1"],
185 + [
186 + save_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$CPPFLAGS $ASOUNDLIB_CFLAGS"
187 +- AC_CHECK_HEADERS([use-case.h], HAVE_ALSA_UCM=1, HAVE_ALSA_UCM=0)
188 ++ AC_CHECK_HEADERS([alsa/use-case.h], HAVE_ALSA_UCM=1, HAVE_ALSA_UCM=0)
189 + CPPFLAGS="$save_CPPFLAGS"
190 + ],
191 + HAVE_ALSA_UCM=0)
192 +diff --git a/src/modules/alsa/alsa-ucm.h b/src/modules/alsa/alsa-ucm.h
193 +index 53abf3f90..c926f3cc3 100644
194 +--- a/src/modules/alsa/alsa-ucm.h
195 ++++ b/src/modules/alsa/alsa-ucm.h
196 +@@ -23,7 +23,7 @@
197 + ***/
198 +
199 + #ifdef HAVE_ALSA_UCM
200 +-#include <use-case.h>
201 ++#include <alsa/use-case.h>
202 + #else
203 + typedef void snd_use_case_mgr_t;
204 + #endif
205 +--
206 +2.21.0
207 +
208
209 diff --git a/media-sound/pulseaudio/files/pulseaudio-12.2-exit-time-session.patch b/media-sound/pulseaudio/files/pulseaudio-12.2-exit-time-session.patch
210 new file mode 100644
211 index 00000000000..045ab5567d8
212 --- /dev/null
213 +++ b/media-sound/pulseaudio/files/pulseaudio-12.2-exit-time-session.patch
214 @@ -0,0 +1,181 @@
215 +From de705a0eeaa27a8ac1abdc2625e639340323595a Mon Sep 17 00:00:00 2001
216 +From: Tanu Kaskinen <tanuk@×××.fi>
217 +Date: Tue, 6 Mar 2018 15:09:06 +0200
218 +Subject: [PATCH 08/77] set exit_idle_time to 0 when we detect a session
219 +
220 +As the comments explain, this fixes relogin problems on some systems
221 +that remove our sockets on logout without terminating the daemon.
222 +---
223 + man/pulse-daemon.conf.5.xml.in | 15 ++++++++++++---
224 + man/pulseaudio.1.xml.in | 17 +++++++++++++++--
225 + src/modules/module-console-kit.c | 13 +++++++++++++
226 + src/modules/module-systemd-login.c | 14 ++++++++++++++
227 + src/modules/x11/module-x11-xsmp.c | 13 +++++++++++++
228 + src/pulsecore/core.c | 10 ++++++++++
229 + src/pulsecore/core.h | 2 ++
230 + 7 files changed, 79 insertions(+), 5 deletions(-)
231 +
232 +diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
233 +index f0550f3b..f49fa9b0 100644
234 +--- a/man/pulse-daemon.conf.5.xml.in
235 ++++ b/man/pulse-daemon.conf.5.xml.in
236 +@@ -292,9 +292,18 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
237 + <option>
238 + <p><opt>exit-idle-time=</opt> Terminate the daemon after the
239 + last client quit and this time in seconds passed. Use a negative value to
240 +- disable this feature. Defaults to 20. The
241 +- <opt>--exit-idle-time</opt> command line option takes
242 +- precedence.</p>
243 ++ disable this feature. Defaults to 20. The <opt>--exit-idle-time</opt>
244 ++ command line option takes precedence.</p>
245 ++
246 ++ <p>When PulseAudio runs in the per-user mode and detects a login
247 ++ session, then any positive value will be reset to 0 so that PulseAudio
248 ++ will terminate immediately on logout. A positive value therefore has
249 ++ effect only in environments where there's no support for login session
250 ++ tracking. A negative value can still be used to disable any automatic
251 ++ exit.</p>
252 ++
253 ++ <p>When PulseAudio runs in the system mode, automatic exit is always
254 ++ disabled, so this option does nothing.</p>
255 + </option>
256 +
257 + <option>
258 +diff --git a/man/pulseaudio.1.xml.in b/man/pulseaudio.1.xml.in
259 +index f732b8ae..824eddb4 100644
260 +--- a/man/pulseaudio.1.xml.in
261 ++++ b/man/pulseaudio.1.xml.in
262 +@@ -189,8 +189,21 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
263 + <option>
264 + <p><opt>--exit-idle-time</opt><arg>=SECS</arg></p>
265 +
266 +- <optdesc><p>Terminate the daemon when idle and the specified
267 +- number of seconds passed.</p></optdesc>
268 ++ <optdesc>
269 ++ <p>Terminate the daemon after the last client quit and this time in
270 ++ seconds passed. Use a negative value to disable this feature. Defaults
271 ++ to 20.</p>
272 ++
273 ++ <p>When PulseAudio runs in the per-user mode and detects a login
274 ++ session, then any positive value will be reset to 0 so that PulseAudio
275 ++ will terminate immediately on logout. A positive value therefore has
276 ++ effect only in environments where there's no support for login session
277 ++ tracking. A negative value can still be used to disable any automatic
278 ++ exit.</p>
279 ++
280 ++ <p>When PulseAudio runs in the system mode, automatic exit is always
281 ++ disabled, so this option does nothing.</p>
282 ++ </optdesc>
283 + </option>
284 +
285 + <option>
286 +diff --git a/src/modules/module-console-kit.c b/src/modules/module-console-kit.c
287 +index c7938849..c8fe2ed2 100644
288 +--- a/src/modules/module-console-kit.c
289 ++++ b/src/modules/module-console-kit.c
290 +@@ -118,6 +118,19 @@ static void add_session(struct userdata *u, const char *id) {
291 +
292 + pa_log_debug("Added new session %s", id);
293 +
294 ++ /* Positive exit_idle_time is only useful when we have no session tracking
295 ++ * capability, so we can set it to 0 now that we have detected a session.
296 ++ * The benefit of setting exit_idle_time to 0 is that pulseaudio will exit
297 ++ * immediately when the session ends. That in turn is useful, because some
298 ++ * systems (those that use pam_systemd but don't use systemd for managing
299 ++ * pulseaudio) clean $XDG_RUNTIME_DIR on logout, but fail to terminate all
300 ++ * services that depend on the files in $XDG_RUNTIME_DIR. The directory
301 ++ * contains our sockets, and if the sockets are removed without terminating
302 ++ * pulseaudio, a quick relogin will likely cause trouble, because a new
303 ++ * instance will be spawned while the old instance is still running. */
304 ++ if (u->core->exit_idle_time > 0)
305 ++ pa_core_set_exit_idle_time(u->core, 0);
306 ++
307 + fail:
308 +
309 + if (m)
310 +diff --git a/src/modules/module-systemd-login.c b/src/modules/module-systemd-login.c
311 +index 87981592..51401575 100644
312 +--- a/src/modules/module-systemd-login.c
313 ++++ b/src/modules/module-systemd-login.c
314 +@@ -84,6 +84,20 @@ static int add_session(struct userdata *u, const char *id) {
315 + pa_hashmap_put(u->sessions, session->id, session);
316 +
317 + pa_log_debug("Added new session %s", id);
318 ++
319 ++ /* Positive exit_idle_time is only useful when we have no session tracking
320 ++ * capability, so we can set it to 0 now that we have detected a session.
321 ++ * The benefit of setting exit_idle_time to 0 is that pulseaudio will exit
322 ++ * immediately when the session ends. That in turn is useful, because some
323 ++ * systems (those that use pam_systemd but don't use systemd for managing
324 ++ * pulseaudio) clean $XDG_RUNTIME_DIR on logout, but fail to terminate all
325 ++ * services that depend on the files in $XDG_RUNTIME_DIR. The directory
326 ++ * contains our sockets, and if the sockets are removed without terminating
327 ++ * pulseaudio, a quick relogin will likely cause trouble, because a new
328 ++ * instance will be spawned while the old instance is still running. */
329 ++ if (u->core->exit_idle_time > 0)
330 ++ pa_core_set_exit_idle_time(u->core, 0);
331 ++
332 + return 0;
333 + }
334 +
335 +diff --git a/src/modules/x11/module-x11-xsmp.c b/src/modules/x11/module-x11-xsmp.c
336 +index 0238e516..6f801237 100644
337 +--- a/src/modules/x11/module-x11-xsmp.c
338 ++++ b/src/modules/x11/module-x11-xsmp.c
339 +@@ -206,6 +206,19 @@ int pa__init(pa_module*m) {
340 + if (!u->client)
341 + goto fail;
342 +
343 ++ /* Positive exit_idle_time is only useful when we have no session tracking
344 ++ * capability, so we can set it to 0 now that we have detected a session.
345 ++ * The benefit of setting exit_idle_time to 0 is that pulseaudio will exit
346 ++ * immediately when the session ends. That in turn is useful, because some
347 ++ * systems (those that use pam_systemd but don't use systemd for managing
348 ++ * pulseaudio) clean $XDG_RUNTIME_DIR on logout, but fail to terminate all
349 ++ * services that depend on the files in $XDG_RUNTIME_DIR. The directory
350 ++ * contains our sockets, and if the sockets are removed without terminating
351 ++ * pulseaudio, a quick relogin will likely cause trouble, because a new
352 ++ * instance will be spawned while the old instance is still running. */
353 ++ if (u->core->exit_idle_time > 0)
354 ++ pa_core_set_exit_idle_time(u->core, 0);
355 ++
356 + pa_modargs_free(ma);
357 +
358 + return 0;
359 +diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
360 +index 79abbc04..da42a13e 100644
361 +--- a/src/pulsecore/core.c
362 ++++ b/src/pulsecore/core.c
363 +@@ -426,6 +426,16 @@ void pa_core_update_default_source(pa_core *core) {
364 + pa_hook_fire(&core->hooks[PA_CORE_HOOK_DEFAULT_SOURCE_CHANGED], core->default_source);
365 + }
366 +
367 ++void pa_core_set_exit_idle_time(pa_core *core, int time) {
368 ++ pa_assert(core);
369 ++
370 ++ if (time == core->exit_idle_time)
371 ++ return;
372 ++
373 ++ pa_log_info("exit_idle_time: %i -> %i", core->exit_idle_time, time);
374 ++ core->exit_idle_time = time;
375 ++}
376 ++
377 + static void exit_callback(pa_mainloop_api *m, pa_time_event *e, const struct timeval *t, void *userdata) {
378 + pa_core *c = userdata;
379 + pa_assert(c->exit_event == e);
380 +diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
381 +index 213964ce..38622f61 100644
382 +--- a/src/pulsecore/core.h
383 ++++ b/src/pulsecore/core.h
384 +@@ -258,6 +258,8 @@ void pa_core_set_configured_default_source(pa_core *core, const char *source);
385 + void pa_core_update_default_sink(pa_core *core);
386 + void pa_core_update_default_source(pa_core *core);
387 +
388 ++void pa_core_set_exit_idle_time(pa_core *core, int time);
389 ++
390 + /* Check whether no one is connected to this core */
391 + void pa_core_check_idle(pa_core *c);
392 +
393 +--
394 +2.17.1
395 +
396
397 diff --git a/media-sound/pulseaudio/pulseaudio-12.2-r2.ebuild b/media-sound/pulseaudio/pulseaudio-12.2-r2.ebuild
398 new file mode 100644
399 index 00000000000..4e7497c6168
400 --- /dev/null
401 +++ b/media-sound/pulseaudio/pulseaudio-12.2-r2.ebuild
402 @@ -0,0 +1,366 @@
403 +# Copyright 1999-2019 Gentoo Authors
404 +# Distributed under the terms of the GNU General Public License v2
405 +
406 +EAPI=6
407 +inherit autotools bash-completion-r1 flag-o-matic gnome2-utils linux-info systemd user udev multilib-minimal
408 +
409 +DESCRIPTION="A networked sound server with an advanced plugin system"
410 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/PulseAudio/"
411 +SRC_URI="https://freedesktop.org/software/pulseaudio/releases/${P}.tar.xz"
412 +
413 +# libpulse-simple and libpulse link to libpulse-core; this is daemon's
414 +# library and can link to gdbm and other GPL-only libraries. In this
415 +# cases, we have a fully GPL-2 package. Leaving the rest of the
416 +# GPL-forcing USE flags for those who use them.
417 +LICENSE="!gdbm? ( LGPL-2.1 ) gdbm? ( GPL-2 )"
418 +
419 +SLOT="0"
420 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux"
421 +
422 +# +alsa-plugin as discussed in bug #519530
423 +IUSE="+alsa +alsa-plugin +asyncns bluetooth +caps dbus doc equalizer elogind gconf
424 ++gdbm +glib gtk ipv6 jack libsamplerate libressl lirc native-headset neon
425 +ofono-headset +orc oss qt5 realtime selinux sox ssl systemd system-wide tcpd test
426 ++udev +webrtc-aec +X zeroconf"
427 +
428 +# See "*** BLUEZ support not found (requires D-Bus)" in configure.ac
429 +REQUIRED_USE="
430 + ?? ( elogind systemd )
431 + bluetooth? ( dbus )
432 + equalizer? ( dbus )
433 + ofono-headset? ( bluetooth )
434 + native-headset? ( bluetooth )
435 + realtime? ( dbus )
436 + udev? ( || ( alsa oss ) )
437 +"
438 +
439 +# libpcre needed in some cases, bug #472228
440 +CDEPEND="
441 + || (
442 + elibc_glibc? ( virtual/libc )
443 + elibc_uclibc? ( virtual/libc )
444 + dev-libs/libpcre
445 + )
446 + >=media-libs/libsndfile-1.0.20[${MULTILIB_USEDEP}]
447 + X? (
448 + >=x11-libs/libX11-1.4.0[${MULTILIB_USEDEP}]
449 + >=x11-libs/libxcb-1.6[${MULTILIB_USEDEP}]
450 + x11-libs/libSM[${MULTILIB_USEDEP}]
451 + x11-libs/libICE[${MULTILIB_USEDEP}]
452 + x11-libs/libXtst[${MULTILIB_USEDEP}]
453 + )
454 + caps? ( >=sys-libs/libcap-2.22-r2[${MULTILIB_USEDEP}] )
455 + libsamplerate? ( >=media-libs/libsamplerate-0.1.1-r1 )
456 + alsa? ( >=media-libs/alsa-lib-1.0.19 )
457 + glib? ( >=dev-libs/glib-2.26.0:2[${MULTILIB_USEDEP}] )
458 + zeroconf? ( >=net-dns/avahi-0.6.12[dbus] )
459 + jack? ( virtual/jack )
460 + tcpd? ( sys-apps/tcp-wrappers[${MULTILIB_USEDEP}] )
461 + lirc? ( app-misc/lirc )
462 + dbus? ( >=sys-apps/dbus-1.0.0[${MULTILIB_USEDEP}] )
463 + gtk? ( x11-libs/gtk+:3 )
464 + bluetooth? (
465 + >=net-wireless/bluez-5
466 + >=sys-apps/dbus-1.0.0
467 + media-libs/sbc
468 + )
469 + asyncns? ( net-libs/libasyncns[${MULTILIB_USEDEP}] )
470 + udev? ( >=virtual/udev-143[hwdb(+)] )
471 + equalizer? ( sci-libs/fftw:3.0 )
472 + ofono-headset? ( >=net-misc/ofono-1.13 )
473 + orc? ( >=dev-lang/orc-0.4.15 )
474 + sox? ( >=media-libs/soxr-0.1.1 )
475 + ssl? (
476 + !libressl? ( dev-libs/openssl:0= )
477 + libressl? ( dev-libs/libressl:= )
478 + )
479 + media-libs/speexdsp
480 + gdbm? ( sys-libs/gdbm:= )
481 + webrtc-aec? ( >=media-libs/webrtc-audio-processing-0.2 )
482 + elogind? ( sys-auth/elogind )
483 + systemd? ( sys-apps/systemd:0=[${MULTILIB_USEDEP}] )
484 + dev-libs/libltdl:0
485 + selinux? ( sec-policy/selinux-pulseaudio )
486 +" # libltdl is a valid RDEPEND, libltdl.so is used for native abi in pulsecore and daemon
487 +
488 +RDEPEND="${CDEPEND}
489 + realtime? ( sys-auth/rtkit )
490 + gconf? ( >=gnome-base/gconf-3.2.6 )
491 +"
492 +
493 +DEPEND="${RDEPEND}
494 + sys-devel/m4
495 + doc? ( app-doc/doxygen )
496 + test? ( >=dev-libs/check-0.9.10 )
497 + X? (
498 + x11-base/xorg-proto
499 + >=x11-libs/libXtst-1.0.99.2[${MULTILIB_USEDEP}]
500 + )
501 + dev-libs/libatomic_ops
502 + virtual/pkgconfig
503 + system-wide? ( || ( dev-util/unifdef sys-freebsd/freebsd-ubin ) )
504 + dev-util/intltool
505 + >=sys-devel/gettext-0.18.1
506 +"
507 +# This is a PDEPEND to avoid a circular dep
508 +PDEPEND="
509 + alsa? ( alsa-plugin? ( >=media-plugins/alsa-plugins-1.0.27-r1[pulseaudio,${MULTILIB_USEDEP}] ) )
510 +"
511 +
512 +# alsa-utils dep is for the alsasound init.d script (see bug #155707)
513 +# bluez dep is for the bluetooth init.d script
514 +# PyQt5 dep is for the qpaeq script
515 +RDEPEND="${RDEPEND}
516 + equalizer? ( qt5? ( dev-python/PyQt5[dbus,widgets] ) )
517 + system-wide? (
518 + alsa? ( media-sound/alsa-utils )
519 + bluetooth? ( >=net-wireless/bluez-5 )
520 + )
521 +"
522 +
523 +PATCHES=(
524 + "${FILESDIR}"/pulseaudio-11.1-disable-flat-volumes.patch # bug 627894
525 + # Backports from Fedora
526 + "${FILESDIR}"/${P}-exit-time-session.patch
527 + "${FILESDIR}"/${P}-alsa-header-path.patch
528 + "${FILESDIR}"/${P}-alsa-header-path2.patch
529 +)
530 +
531 +pkg_pretend() {
532 + CONFIG_CHECK="~HIGH_RES_TIMERS"
533 + WARNING_HIGH_RES_TIMERS="CONFIG_HIGH_RES_TIMERS:\tis not set (required for enabling timer-based scheduling in pulseaudio)\n"
534 + check_extra_config
535 +
536 + if linux_config_exists; then
537 + local snd_hda_prealloc_size=$(linux_chkconfig_string SND_HDA_PREALLOC_SIZE)
538 + if [ -n "${snd_hda_prealloc_size}" ] && [ "${snd_hda_prealloc_size}" -lt 2048 ]; then
539 + ewarn "A preallocated buffer-size of 2048 (kB) or higher is recommended for the HD-audio driver!"
540 + ewarn "CONFIG_SND_HDA_PREALLOC_SIZE=${snd_hda_prealloc_size}"
541 + fi
542 + fi
543 +}
544 +
545 +pkg_setup() {
546 + linux-info_pkg_setup
547 + gnome2_environment_reset #543364
548 +
549 + enewgroup audio 18 # Just make sure it exists
550 +
551 + if use system-wide; then
552 + enewgroup pulse-access
553 + enewgroup pulse
554 + enewuser pulse -1 -1 /var/run/pulse pulse,audio
555 + fi
556 +}
557 +
558 +src_prepare() {
559 + default
560 +
561 + # Skip test that cannot work with sandbox, bug #501846
562 + sed -i -e '/lock-autospawn-test /d' src/Makefile.am || die
563 + sed -i -e 's/lock-autospawn-test$(EXEEXT) //' src/Makefile.in || die
564 +
565 + eautoreconf
566 +}
567 +
568 +multilib_src_configure() {
569 + local myconf=(
570 + --disable-adrian-aec
571 + --disable-bluez4
572 + --disable-esound
573 + --disable-gconf
574 + --disable-solaris
575 + --enable-largefile
576 + --localstatedir="${EPREFIX}"/var
577 + --with-systemduserunitdir=$(systemd_get_userunitdir)
578 + --with-udev-rules-dir="${EPREFIX}/$(get_udevdir)"/rules.d
579 + $(multilib_native_use_enable alsa)
580 + $(multilib_native_use_enable bluetooth bluez5)
581 + $(multilib_native_use_enable glib gsettings)
582 + $(multilib_native_use_enable gtk gtk3)
583 + $(multilib_native_use_enable jack)
584 + $(multilib_native_use_enable libsamplerate samplerate)
585 + $(multilib_native_use_enable lirc)
586 + $(multilib_native_use_enable orc)
587 + $(multilib_native_use_enable oss oss-output)
588 + $(multilib_native_use_enable ssl openssl)
589 + # tests involve random modules, so just do them for the native
590 + $(multilib_native_use_enable test default-build-tests)
591 + $(multilib_native_use_enable udev)
592 + $(multilib_native_use_enable webrtc-aec)
593 + $(multilib_native_use_enable zeroconf avahi)
594 + $(multilib_native_use_with equalizer fftw)
595 + $(multilib_native_use_with sox soxr)
596 + $(multilib_native_usex gdbm '--with-database=gdbm' '--with-database=simple')
597 + $(use_enable glib glib2)
598 + $(use_enable asyncns)
599 + $(use_enable neon neon-opt)
600 + $(use_enable tcpd tcpwrap)
601 + $(use_enable dbus)
602 + $(use_enable X x11)
603 + $(use_enable systemd systemd-daemon)
604 + # systemd-login isn't necessary for non-native, but the rest of systemd are; not changing it at this point close to a meson port
605 + $(use_enable systemd systemd-login)
606 + $(use_enable systemd systemd-journal)
607 + $(use_enable ipv6)
608 + $(use_with caps)
609 + )
610 +
611 + if use elogind && multilib_is_native_abi; then
612 + myconf+=(
613 + --enable-systemd-login
614 + SYSTEMDLOGIN_CFLAGS=`pkg-config --cflags "libelogind" 2>/dev/null`
615 + SYSTEMDLOGIN_LIBS=`pkg-config --libs "libelogind" 2>/dev/null`
616 + )
617 + fi
618 +
619 + if use bluetooth; then
620 + myconf+=(
621 + $(multilib_native_use_enable native-headset bluez5-native-headset)
622 + $(multilib_native_use_enable ofono-headset bluez5-ofono-headset)
623 + )
624 + fi
625 +
626 + if ! multilib_is_native_abi; then
627 + myconf+=(
628 + # hack around unnecessary checks
629 + # (results don't matter, we're not building anything using it)
630 + ac_cv_lib_ltdl_lt_dladvise_init=yes
631 + LIBSPEEX_CFLAGS=' '
632 + LIBSPEEX_LIBS=' '
633 + )
634 + else
635 + # Make padsp work for non-native ABI, supposedly only possible with glibc; this is used by /usr/bin/padsp that comes from native build, thus we need this argument for native build
636 + if use elibc_glibc ; then
637 + myconf+=( --with-pulsedsp-location="${EPREFIX}"'/usr/\\$$LIB/pulseaudio' )
638 + fi
639 + fi
640 +
641 + ECONF_SOURCE=${S} \
642 + econf "${myconf[@]}"
643 +}
644 +
645 +multilib_src_compile() {
646 + if multilib_is_native_abi; then
647 + emake
648 + use doc && emake doxygen
649 + else
650 + local targets=( libpulse.la libpulsedsp.la libpulse-simple.la )
651 + use glib && targets+=( libpulse-mainloop-glib.la )
652 + emake -C src ${targets[*]}
653 + fi
654 +}
655 +
656 +multilib_src_test() {
657 + # We avoid running the toplevel check target because that will run
658 + # po/'s tests too, and they are broken. Officially, it should work
659 + # with intltool 0.41, but that doesn't look like a stable release.
660 + if multilib_is_native_abi; then
661 + emake -C src check
662 + fi
663 +}
664 +
665 +multilib_src_install() {
666 + if multilib_is_native_abi; then
667 + emake -j1 DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)" install
668 + if use doc ; then
669 + docinto html
670 + dodoc -r doxygen/html/
671 + fi
672 + else
673 + local targets=( libpulse.la libpulse-simple.la )
674 + use glib && targets+=( libpulse-mainloop-glib.la )
675 + emake DESTDIR="${D}" install-pkgconfigDATA
676 + emake DESTDIR="${D}" -C src \
677 + install-libLTLIBRARIES \
678 + install-padsplibLTLIBRARIES \
679 + lib_LTLIBRARIES="${targets[*]}" \
680 + install-pulseincludeHEADERS
681 + fi
682 +}
683 +
684 +multilib_src_install_all() {
685 + if use system-wide; then
686 + newconfd "${FILESDIR}/pulseaudio.conf.d" pulseaudio
687 +
688 + use_define() {
689 + local define=${2:-$(echo $1 | tr '[:lower:]' '[:upper:]')}
690 +
691 + use "$1" && echo "-D$define" || echo "-U$define"
692 + }
693 +
694 + unifdef $(use_define zeroconf AVAHI) \
695 + $(use_define alsa) \
696 + $(use_define bluetooth) \
697 + $(use_define udev) \
698 + "${FILESDIR}/pulseaudio.init.d-5" \
699 + > "${T}/pulseaudio"
700 +
701 + doinitd "${T}/pulseaudio"
702 +
703 + systemd_dounit "${FILESDIR}/${PN}.service"
704 +
705 + # We need /var/run/pulse, bug #442852
706 + systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles" "${PN}.conf"
707 + else
708 + # Prevent warnings when system-wide is not used, bug #447694
709 + if use dbus ; then
710 + rm "${ED%/}"/etc/dbus-1/system.d/pulseaudio-system.conf || die
711 + fi
712 + fi
713 +
714 + if use zeroconf ; then
715 + sed -e '/module-zeroconf-publish/s:^#::' \
716 + -i "${ED%/}/etc/pulse/default.pa" || die
717 + fi
718 +
719 + dodoc NEWS README todo
720 +
721 + # Create the state directory
722 + use prefix || diropts -o pulse -g pulse -m0755
723 +
724 + find "${ED}" \( -name '*.a' -o -name '*.la' \) -delete || die
725 +}
726 +
727 +pkg_postinst() {
728 + gnome2_schemas_update
729 + if use system-wide; then
730 + elog "You have enabled the 'system-wide' USE flag for pulseaudio."
731 + elog "This mode should only be used on headless servers, embedded systems,"
732 + elog "or thin clients. It will usually require manual configuration, and is"
733 + elog "incompatible with many expected pulseaudio features."
734 + elog "On normal desktop systems, system-wide mode is STRONGLY DISCOURAGED."
735 + elog "For more information, see"
736 + elog " https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/"
737 + elog " https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/"
738 + elog " https://wiki.gentoo.org/wiki/PulseAudio#Headless_server"
739 + fi
740 +
741 + if use equalizer && ! use qt5; then
742 + elog "You've enabled the 'equalizer' USE-flag but not the 'qt5' USE-flag."
743 + elog "This will build the equalizer module, but the 'qpaeq' tool"
744 + elog "which is required to set equalizer levels will not work."
745 + fi
746 +
747 + if use equalizer && use qt5; then
748 + elog "You will need to load some extra modules to make qpaeq work."
749 + elog "You can do that by adding the following two lines in"
750 + elog "/etc/pulse/default.pa and restarting pulseaudio:"
751 + elog "load-module module-equalizer-sink"
752 + elog "load-module module-dbus-protocol"
753 + fi
754 +
755 + if use native-headset && use ofono-headset; then
756 + elog "You have enabled both native and ofono headset profiles. The runtime decision"
757 + elog "which to use is done via the 'headset' argument of module-bluetooth-discover."
758 + fi
759 +
760 + if use libsamplerate; then
761 + elog "The libsamplerate based resamplers are now deprecated, because they offer no"
762 + elog "particular advantage over speex. Upstream suggests disabling them."
763 + fi
764 +}
765 +
766 +pkg_postrm() {
767 + gnome2_schemas_update
768 +}