aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Arnold <stephen.arnold42@gmail.com>2014-11-26 09:22:37 -0800
committerSteve Arnold <stephen.arnold42@gmail.com>2014-11-26 09:22:37 -0800
commit96916d1a4b95c61e04d28f3664e34ee0868679a3 (patch)
tree61047676bd868dd861f4fe12a9627a8f59908c8e /media-sound
parentadded a few more readme details (diff)
downloadarm-96916d1a4b95c61e04d28f3664e34ee0868679a3.tar.gz
arm-96916d1a4b95c61e04d28f3664e34ee0868679a3.tar.bz2
arm-96916d1a4b95c61e04d28f3664e34ee0868679a3.zip
bump pulseaudio neon workaround
Diffstat (limited to 'media-sound')
-rw-r--r--media-sound/pulseaudio/Manifest4
-rw-r--r--media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-1.patch26
-rw-r--r--media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-2.patch73
-rw-r--r--media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-3.patch77
-rw-r--r--media-sound/pulseaudio/pulseaudio-5.0-r3.ebuild356
5 files changed, 536 insertions, 0 deletions
diff --git a/media-sound/pulseaudio/Manifest b/media-sound/pulseaudio/Manifest
index 743cab0..a60f458 100644
--- a/media-sound/pulseaudio/Manifest
+++ b/media-sound/pulseaudio/Manifest
@@ -1,5 +1,8 @@
AUX pulseaudio-5.0-crash-udp.patch 2079 SHA256 c353bbc976ea810a0645536da9fae4a8f8e1557d7a91f8d534ec82e5dba7ff4a SHA512 399f4ed091e777d059ce78f26705cbc5650ffbb74a71f0d36324aad76ef965723b1c9ad9b6bacf1bfa64dc63ab4d078a1400627b91ea8371d41361cd4280c7fc WHIRLPOOL 00bffef5136297275fc4a68026f607a62f2496698e4820793b949eee44e60a18171a373f515c690b32febb7e026a2dd07983b09fae69ba9b2f1f10975924efbc
AUX pulseaudio-5.0-module-switch.patch 1458 SHA256 98efc7e8805158c0d2c767199ea9eef67a18df97c267f9cd723f4e1715e41755 SHA512 3c2b90aea6117053838662f8f1d5ebaa076112b84189d794c97bd4779321b8b650b66e6e53f890ac158c8f5f3c536f45519b6e4fb8dddea23a4e79914e8f4705 WHIRLPOOL b81187dd36debf890e70de0116f91088a455fd82c6b5ba8dadc10120ca727491d68b6cfb0e588d55114ba4209bc9366898cdf0d2e1566d8f85b1eb8cec4a9570
+AUX pulseaudio-5.0-zeroconf-crash-1.patch 974 SHA256 39e9579da5cbc880e5859fe61abc4754142257003ccd4651b0c15635da0d7315 SHA512 b72ac0b751be5bde82180bcf4fed72b3d7736087e2e3657d4f5e49d9e987c2f5ad3de3eb38d652423091376b3f5f06174182a10ce3d2513085e17dfc53c97bc8 WHIRLPOOL 7c0522a710449386a1c295640cfd7bd876b0cc2075f9937ddf9a62a034953c6301606f197e1131f20351a3cb7ad83c8eadf106028d332c25825eaf8dd6424b22
+AUX pulseaudio-5.0-zeroconf-crash-2.patch 2766 SHA256 d3d774e4b06e421ce463c4448dcfd333e0a55d02ec2a0349a4814df409fad329 SHA512 1be2651544f6b80213198f8ae8833e3856ad23192980b0dafa05644ee787b99e5b9305441b190cee56ec992ec645a3efc68b4bef1a1703e15ce28aba1677ee01 WHIRLPOOL 83fa6b4bdb210de1f1399d1fc3d1d70eb0f10d4d0c14370aaf7d88d23e5c2023c405fa1bcedef47be7212d6654a7457b730d23d89897a615e7bd03a240035593
+AUX pulseaudio-5.0-zeroconf-crash-3.patch 3191 SHA256 bdf09f59f66a3b842a106af124d557407019f13881a8467488932fe70593b227 SHA512 7cbc8b7e96bddefac9d652a6c786f3f9b05cf735c7f49debdfa5e86eccc81efc0f929b0c8d0739f518332dc4c7112f83d36c866c473ed3c5aeae7eba16822efc WHIRLPOOL bc5794b2b105eaee84e766d2894efe1c52e7a1749f0633680fd81c8cdf0c343b5dd59751eeb29759a182a48fd744479436e91f4274a9b5fe4fcc75848db22797
AUX pulseaudio.conf.d 275 SHA256 c03661e8cc902d27ff6b52f291207f2b008957571b942abdd92a873a52aae0dd SHA512 75b54581591519d63a3362b155c0f9b0501a60763ab394693a456c44d0216138cf3a40bdd0f7442028663bc045e9ffee286f8f8eaf2ee3bb17379b43615fee0e WHIRLPOOL 60c546c76c6de1d7f5244264829bac13fa5ed3993837e00a93eb6d1ac4ecd8e00d70dd9f5f92f5b6a42b8fb11aaaeb618d5f9a4db5e382ad5d6511c8e26889ba
AUX pulseaudio.init.d-5 2352 SHA256 60e4571a8af0437bd99cfd858fde1e6223544a60e591febf25e55e4a2918ff59 SHA512 c510ddc71509435946a4f5a29ee2deb124fddec1a078433651bee99fd71424a0673c6b67015c2b737878e0e6e1da0b0ee4935e419a00cbfe74d6f8c8dc91f243 WHIRLPOOL 9fd81ab29c74b5bfc75aa15d73490881d59c4a280dd6214baf714080e74cb8cdd263d70ec220ea30c08da7890345f5bee6e0d68d2b04c8f5711051fe2b330cbc
AUX pulseaudio.service 227 SHA256 62cd3b7e83845a27f437790cf293970f85ff02816da599a53cd5f3bf13da3788 SHA512 567663b231fe7c2682b08b1059cdad1fcb3c4cb01c1b24aed9afb6fb767b30f250b78bbbed48aadfb06c6d1a4963a6db24877d79a1d36c4be2a128b479c086d6 WHIRLPOOL bb548efc14d88b372abaafae557fe23681ce93d1b010fe7761458c5f7793a96886aa368df4cbec5a4fde078f9e8d940020e3ad2a36248ff6c8ab3b70f412d634
@@ -9,3 +12,4 @@ DIST pulseaudio-5.0.tar.xz 1455428 SHA256 99c13a8b1249ddbd724f195579df79484e9af6
EBUILD pulseaudio-4.0-r1.ebuild 8618 SHA256 b042e7609e230f478a558411f4f2a78957be70062de827a84d40043dd2fd190d SHA512 6cd695f0bcd66943bcc34d39f115a100b094bda211b44b692a690db5a75cb4c5bc3d46c66bfd395ec5c6b5e9192e589a07c2a58447a7c912bfc69a04cc434acb WHIRLPOOL 4f1163c1eaa067f3881efe35b783d4684af7ca400669a02dbdbed1dfd92bf46049a849e1fd285e2ce417432e3bd9476bf370d22bc8294a58f91c62f41cac3e46
EBUILD pulseaudio-5.0-r1.ebuild 9893 SHA256 61babeb38138d5ac6d719d850befc0bcfd73decbea976d08e5617b054a049c6e SHA512 060b8efe49c05f52132849bbae23cb4edf8146c569d6ff5bb4b9dd470066fb13336eed548246cb4170d2150bcdac1feda912225fb5df0e6af61915e8d38e91e6 WHIRLPOOL 815fc63a707a28fde2e9c69522a58681c26661c9d5e84bf5e2e10a3dcaf8ff937fa87b6a712fdc2e54a9ef7410c607daf7e764ee4d9a3d23b600a2b11b997e30
EBUILD pulseaudio-5.0-r2.ebuild 10068 SHA256 732d10e1688fdff36533c3f4067ddd053b94f602d99f109f2a5eac66ad8a11ed SHA512 821cd050f626a7ac5f27a3cce52d8db647f485a4e8da08f14e30141d78ed917cd6647a3cff630c67371cbf121e909bec26b229ba6cb901c60e724fdcfe5d73a5 WHIRLPOOL edf47fc82cfe3c873734e8fbff894ebf5cc977d71ba5a1ebeab3f369bf5e1de0199190df49b15351d34ee4731960d0d969aaf3dc63b5353ad4b1ca1121878bf8
+EBUILD pulseaudio-5.0-r3.ebuild 10276 SHA256 f2f5dceea9eb8c2b856cef882cfa28052bf887789496bea8f92345898bd2d067 SHA512 2525b664d57534decf81f116b090fd5aecd8f5ba0fbf22aa3447daff7ecdb67444c3a8b73e2e441f7e553bd1b61415c134fe5eeb3280cdab7379e2e811c8b438 WHIRLPOOL 094db7188db6e86b43914fb19e415a9a0579f20745b8e4ae2c59a977fedfb27c680b7fb79af922400f29ad0c5f0a625020dde86e8dfd33f84012e32fd7d64a5e
diff --git a/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-1.patch b/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-1.patch
new file mode 100644
index 0000000..d90399b
--- /dev/null
+++ b/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-1.patch
@@ -0,0 +1,26 @@
+From d03ffdccdb7286021e53876ba5d4adf9a1edd0d0 Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
+Date: Sat, 15 Mar 2014 09:37:05 +0200
+Subject: zeroconf-publish: Add locking around pa_mainloop_api_once()
+
+Commit e1e154c7377779377fa1a36655a10effd693f7b5 added locking around
+pa_mainloop_api_once() everywhere except pa__done(). This fixes that
+omission.
+
+diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c
+index 0110e1d..35277c2 100644
+--- a/src/modules/module-zeroconf-publish.c
++++ b/src/modules/module-zeroconf-publish.c
+@@ -807,7 +807,9 @@ void pa__done(pa_module*m) {
+ if (!(u = m->userdata))
+ return;
+
++ pa_threaded_mainloop_lock(u->mainloop);
+ pa_mainloop_api_once(u->api, client_free, u);
++ pa_threaded_mainloop_unlock(u->mainloop);
+ pa_asyncmsgq_wait_for(u->thread_mq.outq, AVAHI_MESSAGE_SHUTDOWN_COMPLETE);
+
+ pa_threaded_mainloop_stop(u->mainloop);
+--
+cgit v0.10.2
+
diff --git a/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-2.patch b/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-2.patch
new file mode 100644
index 0000000..7d4de45
--- /dev/null
+++ b/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-2.patch
@@ -0,0 +1,73 @@
+From 37e73e10be9e42544a4cc160ff85ccada2cc9aa9 Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
+Date: Sat, 15 Mar 2014 09:37:06 +0200
+Subject: zeroconf-publish: Don't react to messages while shutting down
+
+This fixes a case where pa__done() is called while
+AVAHI_MESSAGE_PUBLISH_ALL is waiting for processing. The
+pa_asyncmsgq_wait_for(AVAHI_MESSAGE_SHUTDOWN_COMPLETE) call will
+process all pending messages, and processing AVAHI_MESSAGE_PUBLISH_ALL
+causes publish_all_services(), and that in turn accesses u->services,
+which has been already freed at this point. If we are shutting down,
+we shouldn't react to any of the messages that the Avahi thread is
+sending to the main thread.
+
+BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=76184
+
+diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c
+index 35277c2..db92850 100644
+--- a/src/modules/module-zeroconf-publish.c
++++ b/src/modules/module-zeroconf-publish.c
+@@ -141,6 +141,8 @@ struct userdata {
+ pa_hook_slot *sink_new_slot, *source_new_slot, *sink_unlink_slot, *source_unlink_slot, *sink_changed_slot, *source_changed_slot;
+
+ pa_native_protocol *native;
++
++ bool shutting_down;
+ };
+
+ /* Runs in PA mainloop context */
+@@ -638,6 +640,11 @@ static void unpublish_all_services(struct userdata *u, bool rem) {
+ static int avahi_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
+ struct userdata *u = (struct userdata *) data;
+
++ pa_assert(u);
++
++ if (u->shutting_down)
++ return 0;
++
+ switch (code) {
+ case AVAHI_MESSAGE_PUBLISH_ALL:
+ publish_all_services(u);
+@@ -647,10 +654,6 @@ static int avahi_process_msg(pa_msgobject *o, int code, void *data, int64_t offs
+ pa_module_unload(u->core, u->module, true);
+ break;
+
+- case AVAHI_MESSAGE_SHUTDOWN_COMPLETE:
+- /* pa__done() is waiting for this */
+- break;
+-
+ default:
+ pa_assert_not_reached();
+ }
+@@ -797,7 +800,7 @@ static void client_free(pa_mainloop_api *api PA_GCC_UNUSED, void *userdata) {
+ if (u->avahi_poll)
+ pa_avahi_poll_free(u->avahi_poll);
+
+- pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->msg), AVAHI_MESSAGE_SHUTDOWN_COMPLETE, NULL, 0, NULL, NULL);
++ pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->msg), AVAHI_MESSAGE_SHUTDOWN_COMPLETE, u, 0, NULL, NULL);
+ }
+
+ void pa__done(pa_module*m) {
+@@ -807,6 +810,8 @@ void pa__done(pa_module*m) {
+ if (!(u = m->userdata))
+ return;
+
++ u->shutting_down = true;
++
+ pa_threaded_mainloop_lock(u->mainloop);
+ pa_mainloop_api_once(u->api, client_free, u);
+ pa_threaded_mainloop_unlock(u->mainloop);
+--
+cgit v0.10.2
+
diff --git a/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-3.patch b/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-3.patch
new file mode 100644
index 0000000..6bdd464
--- /dev/null
+++ b/media-sound/pulseaudio/files/pulseaudio-5.0-zeroconf-crash-3.patch
@@ -0,0 +1,77 @@
+From b75a20db10c8605d98324a7782a7da6483ae9f14 Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
+Date: Wed, 19 Mar 2014 09:50:39 +0200
+Subject: zeroconf-publish: Don't assume any particular defer event ordering
+
+Also, initialize userdata with zeros to avoid invalid pointers in
+client_free().
+
+This fixes a crash when client_free() is called before
+create_client(). The whole issue could be avoided by using some other
+mechanism than defer events for running the two functions, but I'll
+do that change later (I have also other cleanups planned for
+zeroconf-publish).
+
+BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=76184
+
+diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c
+index db92850..be8806e 100644
+--- a/src/modules/module-zeroconf-publish.c
++++ b/src/modules/module-zeroconf-publish.c
+@@ -142,7 +142,8 @@ struct userdata {
+
+ pa_native_protocol *native;
+
+- bool shutting_down;
++ bool shutting_down; /* Used in the main thread. */
++ bool client_freed; /* Used in the Avahi thread. */
+ };
+
+ /* Runs in PA mainloop context */
+@@ -707,6 +708,16 @@ static void create_client(pa_mainloop_api *api PA_GCC_UNUSED, void *userdata) {
+ struct userdata *u = (struct userdata *) userdata;
+ int error;
+
++ /* create_client() and client_free() are called via defer events. If the
++ * two defer events are created very quickly one after another, we can't
++ * assume that the defer event that runs create_client() will be dispatched
++ * before the defer event that runs client_free() (at the time of writing,
++ * pa_mainloop actually always dispatches queued defer events in reverse
++ * creation order). For that reason we must be prepared for the case where
++ * client_free() has already been called. */
++ if (u->client_freed)
++ return;
++
+ pa_thread_mq_install(&u->thread_mq);
+
+ if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) {
+@@ -733,7 +744,7 @@ int pa__init(pa_module*m) {
+ goto fail;
+ }
+
+- m->userdata = u = pa_xnew(struct userdata, 1);
++ m->userdata = u = pa_xnew0(struct userdata, 1);
+ u->core = m->core;
+ u->module = m;
+ u->native = pa_native_protocol_get(u->core);
+@@ -757,8 +768,6 @@ int pa__init(pa_module*m) {
+ u->source_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) device_new_or_changed_cb, u);
+ u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) device_unlink_cb, u);
+
+- u->main_entry_group = NULL;
+-
+ un = pa_get_user_name_malloc();
+ hn = pa_get_host_name_malloc();
+ u->service_name = pa_truncate_utf8(pa_sprintf_malloc("%s@%s", un, hn), AVAHI_LABEL_MAX-1);
+@@ -801,6 +810,8 @@ static void client_free(pa_mainloop_api *api PA_GCC_UNUSED, void *userdata) {
+ pa_avahi_poll_free(u->avahi_poll);
+
+ pa_asyncmsgq_post(u->thread_mq.outq, PA_MSGOBJECT(u->msg), AVAHI_MESSAGE_SHUTDOWN_COMPLETE, u, 0, NULL, NULL);
++
++ u->client_freed = true;
+ }
+
+ void pa__done(pa_module*m) {
+--
+cgit v0.10.2
+
diff --git a/media-sound/pulseaudio/pulseaudio-5.0-r3.ebuild b/media-sound/pulseaudio/pulseaudio-5.0-r3.ebuild
new file mode 100644
index 0000000..d193c8e
--- /dev/null
+++ b/media-sound/pulseaudio/pulseaudio-5.0-r3.ebuild
@@ -0,0 +1,356 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+inherit autotools bash-completion-r1 eutils flag-o-matic linux-info readme.gentoo systemd user versionator udev multilib-minimal
+
+DESCRIPTION="A networked sound server with an advanced plugin system"
+HOMEPAGE="http://www.pulseaudio.org/"
+SRC_URI="http://freedesktop.org/software/pulseaudio/releases/${P}.tar.xz"
+
+# libpulse-simple and libpulse link to libpulse-core; this is daemon's
+# library and can link to gdbm and other GPL-only libraries. In this
+# cases, we have a fully GPL-2 package. Leaving the rest of the
+# GPL-forcing USE flags for those who use them.
+LICENSE="!gdbm? ( LGPL-2.1 ) gdbm? ( GPL-2 )"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
+
+IUSE="+alsa +asyncns bluetooth +caps dbus doc equalizer +gdbm +glib gnome
+gtk ipv6 jack libsamplerate lirc neon +orc oss qt4 realtime ssl systemd
+system-wide tcpd test +udev +webrtc-aec +X xen zeroconf"
+
+# See "*** BLUEZ support not found (requires D-Bus)" in configure.ac
+REQUIRED_USE="bluetooth? ( dbus )"
+
+# libpcre needed in some cases, bug #472228
+RDEPEND="
+ || (
+ elibc_glibc? ( virtual/libc )
+ elibc_uclibc? ( virtual/libc )
+ dev-libs/libpcre
+ )
+ >=media-libs/libsndfile-1.0.20[${MULTILIB_USEDEP}]
+ X? (
+ >=x11-libs/libX11-1.4.0[${MULTILIB_USEDEP}]
+ >=x11-libs/libxcb-1.6[${MULTILIB_USEDEP}]
+ x11-libs/libSM[${MULTILIB_USEDEP}]
+ x11-libs/libICE[${MULTILIB_USEDEP}]
+ x11-libs/libXtst[${MULTILIB_USEDEP}]
+ )
+ caps? ( >=sys-libs/libcap-2.22-r2[${MULTILIB_USEDEP}] )
+ libsamplerate? ( >=media-libs/libsamplerate-0.1.1-r1 )
+ alsa? ( >=media-libs/alsa-lib-1.0.19 )
+ glib? ( >=dev-libs/glib-2.4.0[${MULTILIB_USEDEP}] )
+ zeroconf? ( >=net-dns/avahi-0.6.12[dbus] )
+ jack? ( >=media-sound/jack-audio-connection-kit-0.117 )
+ tcpd? ( sys-apps/tcp-wrappers[${MULTILIB_USEDEP}] )
+ lirc? ( app-misc/lirc )
+ dbus? ( >=sys-apps/dbus-1.0.0[${MULTILIB_USEDEP}] )
+ gtk? ( x11-libs/gtk+:3 )
+ gnome? ( >=gnome-base/gconf-2.4.0 )
+ bluetooth? (
+ net-wireless/bluez:=
+ >=sys-apps/dbus-1.0.0
+ media-libs/sbc
+ )
+ asyncns? ( net-libs/libasyncns[${MULTILIB_USEDEP}] )
+ udev? ( >=virtual/udev-143[hwdb(+)] )
+ realtime? ( sys-auth/rtkit )
+ equalizer? ( sci-libs/fftw:3.0 )
+ orc? ( >=dev-lang/orc-0.4.9 )
+ ssl? ( dev-libs/openssl )
+ >=media-libs/speex-1.2_rc1
+ gdbm? ( sys-libs/gdbm )
+ webrtc-aec? ( media-libs/webrtc-audio-processing )
+ xen? ( app-emulation/xen-tools )
+ systemd? ( sys-apps/systemd:0=[${MULTILIB_USEDEP}] )
+ dev-libs/json-c[${MULTILIB_USEDEP}]
+ abi_x86_32? ( !<=app-emulation/emul-linux-x86-soundlibs-20131008-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)] )
+ >=sys-devel/libtool-2.4.2
+"
+# it's a valid RDEPEND, libltdl.so is used
+
+DEPEND="${RDEPEND}
+ sys-devel/m4
+ doc? ( app-doc/doxygen )
+ test? ( dev-libs/check )
+ X? (
+ x11-proto/xproto[${MULTILIB_USEDEP}]
+ >=x11-libs/libXtst-1.0.99.2[${MULTILIB_USEDEP}]
+ )
+ dev-libs/libatomic_ops
+ virtual/pkgconfig
+ system-wide? ( || ( dev-util/unifdef sys-freebsd/freebsd-ubin ) )
+ dev-util/intltool
+ >=sys-devel/gettext-0.18.1
+"
+# This is a PDEPEND to avoid a circular dep
+PDEPEND="alsa? ( >=media-plugins/alsa-plugins-1.0.27-r1[pulseaudio] )"
+
+# alsa-utils dep is for the alsasound init.d script (see bug #155707)
+# bluez dep is for the bluetooth init.d script
+# PyQt4 dep is for the qpaeq script
+RDEPEND="${RDEPEND}
+ equalizer? ( qt4? ( dev-python/PyQt4[dbus] ) )
+ system-wide? (
+ alsa? ( media-sound/alsa-utils )
+ bluetooth? ( net-wireless/bluez:= )
+ )
+"
+
+pkg_pretend() {
+ CONFIG_CHECK="~HIGH_RES_TIMERS"
+ WARNING_HIGH_RES_TIMERS="CONFIG_HIGH_RES_TIMERS:\tis not set (required for enabling timer-based scheduling in pulseaudio)\n"
+ check_extra_config
+
+ if linux_config_exists; then
+ local snd_hda_prealloc_size=$(linux_chkconfig_string SND_HDA_PREALLOC_SIZE)
+ if [ -n "${snd_hda_prealloc_size}" ] && [ "${snd_hda_prealloc_size}" -lt 2048 ]; then
+ ewarn "A preallocated buffer-size of 2048 (kB) or higher is recommended for the HD-audio driver!"
+ ewarn "CONFIG_SND_HDA_PREALLOC_SIZE=${snd_hda_prealloc_size}"
+ fi
+ fi
+}
+
+pkg_setup() {
+ linux-info_pkg_setup
+
+ enewgroup audio 18 # Just make sure it exists
+
+ if use system-wide; then
+ enewgroup pulse-access
+ enewgroup pulse
+ enewuser pulse -1 -1 /var/run/pulse pulse,audio
+ fi
+}
+
+src_prepare() {
+ # Skip test that cannot work with sandbox, bug #501846
+ sed -i -e '/lock-autospawn-test/d' src/Makefile.am || die
+
+ # Fix CVE-2014-3970, bug #512516 (from 'master')
+ epatch "${FILESDIR}/${P}-crash-udp.patch"
+
+ # module-switch-on-port-available: Don't switch profiles on uninitialized cards (from 'master')
+ epatch "${FILESDIR}/${P}-module-switch.patch"
+
+ # Fix module-zeroconf-publish crashes, bug #504612 (from 'master')
+ epatch "${FILESDIR}"/${P}-zeroconf-crash-{1,2,3}.patch
+
+ epatch_user
+ eautoreconf
+}
+
+multilib_src_configure() {
+ # failure on arm with neon
+ if [[ ${CHOST} == armv* ]] ; then
+ use neon && append-cflags -mfpu=neon
+ fi
+
+ local myconf=()
+
+ if use gdbm; then
+ myconf+=( --with-database=gdbm )
+ #elif use tdb; then
+ # myconf+=( --with-database=tdb )
+ else
+ myconf+=( --with-database=simple )
+ fi
+
+ if use bluetooth; then
+ if has_version '<net-wireless/bluez-5'; then
+ myconf+=( --disable-bluez5 --enable-bluez4 )
+ else
+ myconf+=( --enable-bluez5 --disable-bluez4 )
+ fi
+ else
+ myconf+=( --disable-bluez5 --disable-bluez4 )
+ fi
+
+ myconf+=(
+ --enable-largefile
+ $(use_enable glib glib2)
+ --disable-solaris
+ $(use_enable asyncns)
+ $(use_enable oss oss-output)
+ $(use_enable alsa)
+ $(use_enable lirc)
+ $(use_enable neon neon-opt)
+ $(use_enable tcpd tcpwrap)
+ $(use_enable jack)
+ $(use_enable zeroconf avahi)
+ $(use_enable dbus)
+ $(use_enable gnome gconf)
+ $(use_enable gtk gtk3)
+ $(use_enable libsamplerate samplerate)
+ $(use_enable orc)
+ $(use_enable X x11)
+ $(use_enable test default-build-tests)
+ $(use_enable udev)
+ $(use_enable systemd)
+ $(use_enable systemd systemd-journal)
+ $(use_enable ipv6)
+ $(use_enable ssl openssl)
+ $(use_enable webrtc-aec)
+ $(use_enable xen)
+ $(use_with caps)
+ $(use_with equalizer fftw)
+ --disable-adrian-aec
+ --disable-esound
+ --localstatedir="${EPREFIX}"/var
+ --with-udev-rules-dir="${EPREFIX}/$(get_udevdir)"/rules.d
+ )
+
+ if ! multilib_is_native_abi; then
+ # disable all the modules and stuff
+ myconf+=(
+ --disable-oss-output
+ --disable-alsa
+ --disable-lirc
+ --disable-jack
+ --disable-avahi
+ --disable-gconf
+ --disable-gtk3
+ --disable-samplerate
+ --disable-bluez4
+ --disable-bluez5
+ --disable-udev
+ --disable-systemd
+ --disable-openssl
+ --disable-orc
+ --disable-webrtc-aec
+ --disable-xen
+ --without-fftw
+
+ # tests involve random modules, so just do them for the native
+ --disable-default-build-tests
+
+ # hack around unnecessary checks
+ # (results don't matter, we're not building anything using it)
+ ac_cv_lib_ltdl_lt_dladvise_init=yes
+ --with-database=simple
+ LIBSPEEX_CFLAGS=' '
+ LIBSPEEX_LIBS=' '
+ )
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi; then
+ emake
+ else
+ emake -C src libpulse{,dsp,-simple,-mainloop-glib}.la
+ fi
+}
+
+src_compile() {
+ multilib-minimal_src_compile
+
+ if use doc; then
+ pushd doxygen
+ doxygen doxygen.conf
+ popd
+ fi
+}
+
+multilib_src_test() {
+ # We avoid running the toplevel check target because that will run
+ # po/'s tests too, and they are broken. Officially, it should work
+ # with intltool 0.41, but that doesn't look like a stable release.
+ if multilib_is_native_abi; then
+ emake -C src check
+ fi
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi; then
+ emake -j1 DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)" install
+ else
+ emake DESTDIR="${D}" install-pkgconfigDATA
+ emake DESTDIR="${D}" -C src \
+ install-libLTLIBRARIES \
+ install-padsplibLTLIBRARIES \
+ lib_LTLIBRARIES="libpulse.la libpulse-simple.la libpulse-mainloop-glib.la" \
+ install-pulseincludeHEADERS
+ fi
+}
+
+multilib_src_install_all() {
+ # Drop the script entirely if X is disabled
+ use X || rm "${ED}"/usr/bin/start-pulseaudio-x11
+
+ if use system-wide; then
+ newconfd "${FILESDIR}/pulseaudio.conf.d" pulseaudio
+
+ use_define() {
+ local define=${2:-$(echo $1 | tr '[:lower:]' '[:upper:]')}
+
+ use "$1" && echo "-D$define" || echo "-U$define"
+ }
+
+ unifdef $(use_define avahi) \
+ $(use_define alsa) \
+ $(use_define bluetooth) \
+ $(use_define udev) \
+ "${FILESDIR}/pulseaudio.init.d-5" \
+ > "${T}/pulseaudio"
+
+ doinitd "${T}/pulseaudio"
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ fi
+
+ use zeroconf && sed -i -e '/module-zeroconf-publish/s:^#::' "${ED}/etc/pulse/default.pa"
+
+ dodoc NEWS README todo
+
+ if use doc; then
+ pushd doxygen/html
+ dohtml *
+ popd
+ fi
+
+ # Create the state directory
+ use prefix || diropts -o pulse -g pulse -m0755
+
+ # We need /var/run/pulse, bug #442852
+ use system-wide && systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles" "${PN}.conf"
+
+ # Prevent warnings when system-wide is not used, bug #447694
+ use system-wide || rm "${ED}"/etc/dbus-1/system.d/pulseaudio-system.conf
+
+ prune_libtool_files --all
+}
+
+pkg_postinst() {
+ if use system-wide; then
+ elog "PulseAudio in Gentoo can use a system-wide pulseaudio daemon."
+ elog "This support is enabled by starting the pulseaudio init.d ."
+ elog "To be able to access that you need to be in the group pulse-access."
+ elog "If you choose to use this feature, please make sure that you"
+ elog "really want to run PulseAudio this way:"
+ elog " http://pulseaudio.org/wiki/WhatIsWrongWithSystemMode"
+ elog "For more information about system-wide support, please refer to:"
+ elog " http://pulseaudio.org/wiki/SystemWideInstance"
+ if use gnome ; then
+ elog
+ elog "By enabling gnome USE flag, you enabled gconf support. Please note"
+ elog "that you might need to remove the gnome USE flag or disable the"
+ elog "gconf module on /etc/pulse/system.pa to be able to use PulseAudio"
+ elog "with a system-wide instance."
+ fi
+ fi
+
+ if use equalizer && ! use qt4; then
+ elog "You've enabled the 'equalizer' USE-flag but not the 'qt4' USE-flag."
+ elog "This will build the equalizer module, but the 'qpaeq' tool"
+ elog "which is required to set equalizer levels will not work."
+ fi
+}