Squashed 'yocto-poky/' content from commit ea562de

git-subtree-dir: yocto-poky
git-subtree-split: ea562de57590c966cd5a75fda8defecd397e6436
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio.inc b/meta/recipes-multimedia/pulseaudio/pulseaudio.inc
new file mode 100644
index 0000000..5b806d7
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio.inc
@@ -0,0 +1,197 @@
+SUMMARY = "Sound server for Linux and Unix-like operating systems"
+HOMEPAGE = "http://www.pulseaudio.org"
+AUTHOR = "Lennart Poettering"
+SECTION = "libs/multimedia"
+LICENSE = "GPLv2+ & LGPLv2.1"
+LIC_FILES_CHKSUM = "file://GPL;md5=4325afd396febcb659c36b49533135d4 \
+                    file://LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+                    file://src/pulsecore/resampler.h;beginline=4;endline=21;md5=09794012ae16912c0270f3280cc8ff84"
+
+DEPENDS = "libatomic-ops liboil libsndfile1 libtool"
+# optional
+DEPENDS += "udev alsa-lib glib-2.0 gconf"
+DEPENDS += "json-c gdbm speexdsp libxml-parser-perl-native libcap"
+
+inherit autotools pkgconfig useradd gettext perlnative bluetooth systemd
+
+# *.desktop rules wont be generated during configure and build will fail
+# if using --disable-nls
+USE_NLS = "yes"
+
+EXTRA_OECONF = "\
+		--disable-hal-compat \
+		--disable-orc \
+		--enable-tcpwrap=no \
+		--with-access-group=audio \
+		--disable-openssl \
+		--disable-xen \
+		--with-database=simple \
+		--without-fftw \
+		--without-zsh-completion-dir \
+		--with-udev-rules-dir=`pkg-config --variable=udevdir udev`/rules.d \
+                ac_cv_header_valgrind_memcheck_h=no \
+"
+
+PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', '${BLUEZ}', '', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', '3g', 'ofono', '', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
+                   dbus \
+                   "
+
+PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
+PACKAGECONFIG[bluez4] = "--enable-bluez4,--disable-bluez4,bluez4 sbc"
+PACKAGECONFIG[bluez5] = "--enable-bluez5,--disable-bluez5,bluez5 sbc"
+PACKAGECONFIG[ofono] = "--enable-bluez5-ofono-headset,--disable-bluez5-ofono-headset,ofono"
+PACKAGECONFIG[gtk] = "--enable-gtk3,--disable-gtk3,gtk+3"
+PACKAGECONFIG[systemd] = "--enable-systemd-daemon --enable-systemd-login --enable-systemd-journal --with-systemduserunitdir=${systemd_user_unitdir},--disable-systemd-daemon --disable-systemd-login --disable-systemd-journal,systemd"
+PACKAGECONFIG[x11] = "--enable-x11,--disable-x11,virtual/libx11 libxtst libice libsm libxcb"
+PACKAGECONFIG[avahi] = "--enable-avahi,--disable-avahi,avahi"
+PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack"
+# Since many embedded systems don't have non-root users, it's useful to be
+# able to use pulseaudio autospawn for root as well.
+PACKAGECONFIG[autospawn-for-root] = ",,,"
+
+EXTRA_OECONF_append_arm = "${@bb.utils.contains("TUNE_FEATURES", "neon", "", " --enable-neon-opt=no", d)}"
+EXTRA_OECONF_append_armeb = "${@bb.utils.contains("TUNE_FEATURES", "neon", "", " --enable-neon-opt=no", d)}"
+
+
+export TARGET_PFPU = "${TARGET_FPU}"
+
+# TODO: Use more fine granular version
+#OE_LT_RPATH_ALLOW=":${libdir}/pulse-0.9:"
+OE_LT_RPATH_ALLOW = "any"
+OE_LT_RPATH_ALLOW[export]="1"
+
+set_cfg_value () {
+	sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
+	if ! grep -q "^$2 = $3\$" "$1"; then
+		die "Use of sed to set '$2' to '$3' in '$1' failed"
+	fi
+}
+
+do_compile_append () {
+	if ${@bb.utils.contains('PACKAGECONFIG', 'autospawn-for-root', 'true', 'false', d)}; then
+		set_cfg_value src/client.conf allow-autospawn-for-root yes
+	fi
+}
+
+do_install_append() {
+	install -d ${D}${sysconfdir}/default/volatiles
+	install -m 0644 ${WORKDIR}/volatiles.04_pulse  ${D}${sysconfdir}/default/volatiles/volatiles.04_pulse
+}
+
+USERADD_PACKAGES = "pulseaudio-server"
+GROUPADD_PARAM_pulseaudio-server = "pulse"
+USERADD_PARAM_pulseaudio-server = "--system --home /var/run/pulse \
+                              --no-create-home --shell /bin/false \
+                              --groups audio,pulse --gid pulse pulse"
+
+# The console-kit module is included here explicitly so bitbake can map to the
+# RDEPENDS we define for it in this recipe, and thereby ensure that when
+# adding the console-kit module to an image, we also get the necessary
+# consolekit package produced.
+PACKAGES =+ "libpulsecore libpulsecommon libpulse libpulse-simple libpulse-mainloop-glib \
+             pulseaudio-server pulseaudio-misc ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'pulseaudio-module-console-kit', '', d)}"
+
+#upgrade path:
+RREPLACES_pulseaudio-server = "libpulse-bin libpulse-conf"
+
+PACKAGES_DYNAMIC += "^pulseaudio-lib-.* ^pulseaudio-module-.*"
+
+FILES_libpulsecore = "${libdir}/libpulsecore*.so"
+FILES_libpulsecommon = "${libdir}/pulseaudio/libpulsecommon*.so"
+
+# client.conf configures the behaviour of libpulse, so it belongs in the same
+# package.
+FILES_libpulse = "${libdir}/libpulse.so.* ${sysconfdir}/pulse/client.conf"
+
+FILES_libpulse-simple = "${libdir}/libpulse-simple.so.*"
+FILES_libpulse-mainloop-glib = "${libdir}/libpulse-mainloop-glib.so.*"
+
+FILES_${PN}-dbg += "${libexecdir}/pulse/.debug \
+                    ${libdir}/pulse-${PV}/modules/.debug"
+FILES_${PN}-dev += "${libdir}/pulse-${PV}/modules/*.la ${datadir}/vala ${libdir}/cmake"   
+FILES_${PN}-conf = "${sysconfdir}"
+FILES_${PN}-bin += "${sysconfdir}/default/volatiles/volatiles.04_pulse"
+FILES_${PN}-server = "${bindir}/pulseaudio ${bindir}/start-* ${sysconfdir} ${bindir}/pactl */udev/rules.d/*.rules */*/udev/rules.d/*.rules ${systemd_user_unitdir}/*"
+
+#SYSTEMD_PACKAGES = "${PN}-server"
+SYSTEMD_SERVICE_${PN}-server = "pulseaudio.service"
+
+FILES_${PN}-misc = "${bindir}/* ${libdir}/pulseaudio/libpulsedsp.so"
+
+# Allow the pulseaudio package to be created empty as a placeholder (-dbg and -dev depend on it)
+ALLOW_EMPTY_${PN} = "1"
+
+CONFFILES_libpulse = "${sysconfdir}/pulse/client.conf"
+
+CONFFILES_pulseaudio-server = "\ 
+  ${sysconfdir}/pulse/default.pa \
+  ${sysconfdir}/pulse/daemon.conf \
+  ${sysconfdir}/pulse/system.pa \
+  "
+
+pkg_postinst_${PN}-server() {
+        if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ] ; then
+            ${sysconfdir}/init.d/populate-volatile.sh update
+        fi
+}
+
+python populate_packages_prepend() {
+    #d.setVar('PKG_pulseaudio', 'pulseaudio')
+
+    plugindir = d.expand('${libdir}/pulse-${PV}/modules/')
+    do_split_packages(d, plugindir, '^module-(.*)\.so$', 'pulseaudio-module-%s', 'PulseAudio module for %s', extra_depends='', prepend=True)
+    do_split_packages(d, plugindir, '^lib(.*)\.so$', 'pulseaudio-lib-%s', 'PulseAudio library for %s', extra_depends='', prepend=True)
+}
+
+RDEPENDS_pulseaudio-server = " \
+    pulseaudio-module-filter-apply \
+    pulseaudio-module-filter-heuristics \
+    pulseaudio-module-udev-detect \
+    pulseaudio-module-null-sink \
+    pulseaudio-module-device-restore \
+    pulseaudio-module-stream-restore \
+    pulseaudio-module-card-restore \
+    pulseaudio-module-augment-properties \
+    pulseaudio-module-detect \
+    pulseaudio-module-alsa-sink \
+    pulseaudio-module-alsa-source \
+    pulseaudio-module-alsa-card \
+    pulseaudio-module-native-protocol-unix \
+    pulseaudio-module-default-device-restore \
+    pulseaudio-module-intended-roles \
+    pulseaudio-module-rescue-streams \
+    pulseaudio-module-always-sink \
+    pulseaudio-module-suspend-on-idle \
+    pulseaudio-module-position-event-sounds \
+    pulseaudio-module-role-cork \
+    pulseaudio-module-switch-on-port-available"
+
+# If the server is installed, it's usually desirable to make ALSA applications
+# use PulseAudio. alsa-plugins-pulseaudio-conf will install the configuration
+# that makes the PulseAudio plugin the default ALSA device.
+RDEPENDS_pulseaudio-server += "alsa-plugins-pulseaudio-conf"
+
+# pulseaudio-module-console-kit is built whenever dbus is enabled by PACKAGECONFIG
+# but consolekit depends on libx11 and is available only for DISTRO with x11 in DISTRO_FEATURES
+RDEPENDS_pulseaudio-module-console-kit =+ "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d)}"
+RDEPENDS_pulseaudio-misc += "pulseaudio-module-cli-protocol-unix"
+
+FILES_pulseaudio-module-gconf += "${libexecdir}/pulse/gconf-helper"
+FILES_pulseaudio-module-alsa-card += "${datadir}/pulseaudio/alsa-mixer"
+
+# The console-kit module is good to have on X11 systems (it keeps PulseAudio
+# running for the duration of the user login session). The device-manager and
+# x11-* modules are referenced from the start-pulseaudio-x11 script, so those
+# modules must be installed when X11 is enabled.
+RDEPENDS_pulseaudio-server += "\
+        ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '\
+                pulseaudio-module-console-kit \
+                pulseaudio-module-device-manager \
+                pulseaudio-module-x11-cork-request \
+                pulseaudio-module-x11-publish \
+                pulseaudio-module-x11-xsmp \
+        ', '', d)}"
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-client-conf-Add-allow-autospawn-for-root.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-client-conf-Add-allow-autospawn-for-root.patch
new file mode 100644
index 0000000..d19eb7c
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-client-conf-Add-allow-autospawn-for-root.patch
@@ -0,0 +1,92 @@
+From 1cb5647f76dc8cd7bacbce2a64fac9e6c2dc3b16 Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
+Date: Tue, 28 Apr 2015 14:32:43 +0300
+Subject: [PATCH] client-conf: Add allow-autospawn-for-root
+
+Usually autospawning for root is a bad idea, since it can easily
+interfere with other users' PulseAudio instances, but in embedded
+environments where only root exists, autospawning is fine.
+
+Upstream-Status: Submitted [http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/23549]
+
+Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
+---
+ man/pulse-client.conf.5.xml.in | 9 +++++++++
+ src/pulse/client-conf.c        | 1 +
+ src/pulse/client-conf.h        | 1 +
+ src/pulse/client.conf.in       | 1 +
+ src/pulse/context.c            | 2 +-
+ 5 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/man/pulse-client.conf.5.xml.in b/man/pulse-client.conf.5.xml.in
+index 1002dbe..0058490 100644
+--- a/man/pulse-client.conf.5.xml.in
++++ b/man/pulse-client.conf.5.xml.in
+@@ -71,6 +71,15 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
+     </option>
+ 
+     <option>
++      <p><opt>allow-autospawn-for-root=</opt> Allow autospawning also for root.
++      Takes a boolean value, defaults to <opt>no</opt>. If the <opt>autospawn
++      </opt> option is disabled, this option has no effect. Autospawning for
++      root is disabled by default, because running PulseAudio as root will
++      interfere with regular users' PulseAudio instances. This option should be
++      enabled only in environments where there are no regular users at all.</p>
++    </option>
++
++    <option>
+       <p><opt>daemon-binary=</opt> Path to the PulseAudio daemon to
+       run when autospawning. Defaults to a path configured at compile
+       time.</p>
+diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
+index 83331f8..0474583 100644
+--- a/src/pulse/client-conf.c
++++ b/src/pulse/client-conf.c
+@@ -138,6 +138,7 @@ void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_e
+         { "default-server",         pa_config_parse_string,   &c->default_server, NULL },
+         { "default-dbus-server",    pa_config_parse_string,   &c->default_dbus_server, NULL },
+         { "autospawn",              pa_config_parse_bool,     &c->autospawn, NULL },
++        { "allow-autospawn-for-root", pa_config_parse_bool,   &c->allow_autospawn_for_root, NULL },
+         { "cookie-file",            pa_config_parse_string,   &c->cookie_file_from_client_conf, NULL },
+         { "disable-shm",            pa_config_parse_bool,     &c->disable_shm, NULL },
+         { "enable-shm",             pa_config_parse_not_bool, &c->disable_shm, NULL },
+diff --git a/src/pulse/client-conf.h b/src/pulse/client-conf.h
+index eac705a..131393a 100644
+--- a/src/pulse/client-conf.h
++++ b/src/pulse/client-conf.h
+@@ -38,6 +38,7 @@ typedef struct pa_client_conf {
+     char *cookie_file_from_application;
+     char *cookie_file_from_client_conf;
+     bool autospawn, disable_shm, auto_connect_localhost, auto_connect_display;
++    bool allow_autospawn_for_root;
+     size_t shm_size;
+ } pa_client_conf;
+ 
+diff --git a/src/pulse/client.conf.in b/src/pulse/client.conf.in
+index 26b7790..69830ef 100644
+--- a/src/pulse/client.conf.in
++++ b/src/pulse/client.conf.in
+@@ -23,6 +23,7 @@
+ ; default-dbus-server =
+ 
+ ; autospawn = yes
++; allow-autospawn-for-root = no
+ ; daemon-binary = @PA_BINARY@
+ ; extra-arguments = --log-target=syslog
+ 
+diff --git a/src/pulse/context.c b/src/pulse/context.c
+index 4bc445f..d6c3f6d 100644
+--- a/src/pulse/context.c
++++ b/src/pulse/context.c
+@@ -976,7 +976,7 @@ int pa_context_connect(
+     if (!(flags & PA_CONTEXT_NOAUTOSPAWN) && c->conf->autospawn) {
+ 
+ #ifdef HAVE_GETUID
+-        if (getuid() == 0)
++        if (!c->conf->allow_autospawn_for_root && getuid() == 0)
+             pa_log_debug("Not doing autospawn since we are root.");
+         else {
+             c->do_autospawn = true;
+-- 
+1.9.3
+
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-conf-parser-add-support-for-.d-directories.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-conf-parser-add-support-for-.d-directories.patch
new file mode 100644
index 0000000..a9f1b2a
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-conf-parser-add-support-for-.d-directories.patch
@@ -0,0 +1,196 @@
+From 8cb643bbf0a287d67794e680d26f49c503f31053 Mon Sep 17 00:00:00 2001
+From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
+Date: Thu, 21 May 2015 21:00:59 +0300
+Subject: [PATCH] conf-parser: add support for .d directories
+
+This allows a configuration scheme where prior to loading
+configuration from "somefile", the parser first loads configuration
+from files in directory "somefile.d". This feature is currently
+enabled only for client.conf and daemon.conf.
+
+This makes it easier to create configuration packages in distributions
+when there's need to have different configuration in different setups.
+For example, the graphical Sato environment in OpenEmbedded-core needs
+to set allow-autospawn-for-root=true in client.conf, but the default
+configuration in OpenEmbedded-core should not set that option. With
+this patch, I can create a Sato-specific package that simply installs
+50-sato.conf in /etc/pulse/client.conf.d without conflicting with the
+main client.conf file coming from a different package.
+
+Upstream-Status: Submitted [http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/23592]
+
+Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
+---
+ src/daemon/daemon-conf.c                |  2 +-
+ src/modules/alsa/alsa-mixer.c           |  4 ++--
+ src/modules/module-augment-properties.c |  2 +-
+ src/pulse/client-conf.c                 |  2 +-
+ src/pulsecore/conf-parser.c             | 42 +++++++++++++++++++++++++++++++--
+ src/pulsecore/conf-parser.h             |  8 ++++++-
+ 6 files changed, 52 insertions(+), 8 deletions(-)
+
+diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
+index 21a8edb..1332fc6 100644
+--- a/src/daemon/daemon-conf.c
++++ b/src/daemon/daemon-conf.c
+@@ -617,7 +617,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
+     ci.default_channel_map_set = ci.default_sample_spec_set = false;
+     ci.conf = c;
+ 
+-    r = f ? pa_config_parse(c->config_file, f, table, NULL, NULL) : 0;
++    r = f ? pa_config_parse(c->config_file, f, table, NULL, true, NULL) : 0;
+ 
+     if (r >= 0) {
+ 
+diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
+index 2314612..988b4fe 100644
+--- a/src/modules/alsa/alsa-mixer.c
++++ b/src/modules/alsa/alsa-mixer.c
+@@ -2483,7 +2483,7 @@ pa_alsa_path* pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa
+ 
+     fn = pa_maybe_prefix_path(fname, paths_dir);
+ 
+-    r = pa_config_parse(fn, NULL, items, p->proplist, p);
++    r = pa_config_parse(fn, NULL, items, p->proplist, false, p);
+     pa_xfree(fn);
+ 
+     if (r < 0)
+@@ -4288,7 +4288,7 @@ pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel
+                               pa_run_from_build_tree() ? PA_SRCDIR "/modules/alsa/mixer/profile-sets/" :
+                               PA_ALSA_PROFILE_SETS_DIR);
+ 
+-    r = pa_config_parse(fn, NULL, items, NULL, ps);
++    r = pa_config_parse(fn, NULL, items, NULL, false, ps);
+     pa_xfree(fn);
+ 
+     if (r < 0)
+diff --git a/src/modules/module-augment-properties.c b/src/modules/module-augment-properties.c
+index 42b6fd9..541f0e7 100644
+--- a/src/modules/module-augment-properties.c
++++ b/src/modules/module-augment-properties.c
+@@ -204,7 +204,7 @@ static void update_rule(struct rule *r) {
+     table[0].data = &r->application_name;
+     table[1].data = &r->icon_name;
+ 
+-    if (pa_config_parse(fn, NULL, table, NULL, r) < 0)
++    if (pa_config_parse(fn, NULL, table, NULL, false, r) < 0)
+         pa_log_warn("Failed to parse .desktop file %s.", fn);
+ 
+     pa_xfree(fn);
+diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
+index 83331f8..3c3384d 100644
+--- a/src/pulse/client-conf.c
++++ b/src/pulse/client-conf.c
+@@ -149,7 +149,7 @@ void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_e
+ 
+     f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn);
+     if (f) {
+-        pa_config_parse(fn, f, table, NULL, NULL);
++        pa_config_parse(fn, f, table, NULL, true, NULL);
+         pa_xfree(fn);
+         fclose(f);
+     }
+diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
+index 2dcd45a..d473232 100644
+--- a/src/pulsecore/conf-parser.c
++++ b/src/pulsecore/conf-parser.c
+@@ -21,6 +21,7 @@
+ #include <config.h>
+ #endif
+ 
++#include <dirent.h>
+ #include <string.h>
+ #include <stdio.h>
+ #include <errno.h>
+@@ -103,7 +104,7 @@ static int parse_line(pa_config_parser_state *state) {
+             }
+         }
+ 
+-        r = pa_config_parse(fn, NULL, state->item_table, state->proplist, state->userdata);
++        r = pa_config_parse(fn, NULL, state->item_table, state->proplist, false, state->userdata);
+         pa_xfree(path);
+         return r;
+     }
+@@ -152,8 +153,13 @@ static int parse_line(pa_config_parser_state *state) {
+         return normal_assignment(state);
+ }
+ 
++static int conf_filter(const struct dirent *entry) {
++    return pa_endswith(entry->d_name, ".conf");
++}
++
+ /* Go through the file and parse each line */
+-int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, void *userdata) {
++int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, bool use_dot_d,
++                    void *userdata) {
+     int r = -1;
+     bool do_close = !f;
+     pa_config_parser_state state;
+@@ -163,6 +169,38 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_p
+ 
+     pa_zero(state);
+ 
++    if (use_dot_d) {
++        char *dir_name;
++        int n;
++        struct dirent **entries = NULL;
++
++        dir_name = pa_sprintf_malloc("%s.d", filename);
++
++        n = scandir(dir_name, &entries, conf_filter, alphasort);
++        if (n >= 0) {
++            int i;
++
++            for (i = 0; i < n; i++) {
++                char *filename2;
++
++                filename2 = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", dir_name, entries[i]->d_name);
++                pa_config_parse(filename2, NULL, t, proplist, false, userdata);
++                pa_xfree(filename2);
++
++                free(entries[i]);
++            }
++
++            free(entries);
++        } else {
++            if (errno == ENOENT)
++                pa_log_debug("scandir(\"%s\") failed: %s", dir_name, pa_cstrerror(errno));
++            else
++                pa_log_warn("scandir(\"%s\") failed: %s", dir_name, pa_cstrerror(errno));
++        }
++
++        pa_xfree(dir_name);
++    }
++
+     if (!f && !(f = pa_fopen_cloexec(filename, "r"))) {
+         if (errno == ENOENT) {
+             pa_log_debug("Failed to open configuration file '%s': %s", filename, pa_cstrerror(errno));
+diff --git a/src/pulsecore/conf-parser.h b/src/pulsecore/conf-parser.h
+index dbb6f5c..cc20d7d 100644
+--- a/src/pulsecore/conf-parser.h
++++ b/src/pulsecore/conf-parser.h
+@@ -59,6 +59,11 @@ struct pa_config_parser_state {
+  * pa_config_items in *t that is terminated by an item where lvalue is
+  * NULL.
+  *
++ * If use_dot_d is true, then before parsing the file named by the filename
++ * argument, the function will parse all files ending with ".conf" in
++ * alphabetical order from a directory whose name is filename + ".d", if such
++ * directory exists.
++ *
+  * Some configuration files may contain a Properties section, which
+  * is a bit special. Normally all accepted lvalues must be predefined
+  * in the pa_config_item table, but in the Properties section the
+@@ -68,7 +73,8 @@ struct pa_config_parser_state {
+  * properties, and those properties will be merged into the given
+  * proplist. If proplist is NULL, then sections named "Properties"
+  * are not allowed at all in the configuration file. */
+-int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, void *userdata);
++int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, bool use_dot_d,
++                    void *userdata);
+ 
+ /* Generic parsers for integers, size_t, booleans and strings */
+ int pa_config_parse_int(pa_config_parser_state *state);
+-- 
+1.9.3
+
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-padsp-Make-it-compile-on-musl.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-padsp-Make-it-compile-on-musl.patch
new file mode 100644
index 0000000..8555995
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/0001-padsp-Make-it-compile-on-musl.patch
@@ -0,0 +1,70 @@
+From f6ab3c3aa7a1841c8add04828029356d2a8c88e7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 6 Apr 2015 21:56:31 -0700
+Subject: [PATCH] padsp: Make it compile on musl
+
+break assumptions on glibc and there is no stat64 on non
+glibc C libraries
+
+See pulseaudio bug
+
+https://bugs.freedesktop.org/show_bug.cgi?id=85319
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/utils/padsp.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/src/utils/padsp.c b/src/utils/padsp.c
+index e61373c..684721a 100644
+--- a/src/utils/padsp.c
++++ b/src/utils/padsp.c
+@@ -2368,7 +2368,7 @@ fail:
+     return ret;
+ }
+ 
+-#ifdef sun
++#ifndef __GLIBC__
+ int ioctl(int fd, int request, ...) {
+ #else
+ int ioctl(int fd, unsigned long request, ...) {
+@@ -2508,10 +2508,13 @@ int stat(const char *pathname, struct stat *buf) {
+ 
+     return 0;
+ }
+-
+ #ifdef HAVE_OPEN64
+-
++#undef stat64
++#ifdef __GLIBC__
+ int stat64(const char *pathname, struct stat64 *buf) {
++#else
++int stat64(const char *pathname, struct stat *buf) {
++#endif
+     struct stat oldbuf;
+     int ret;
+ 
+@@ -2544,7 +2547,7 @@ int stat64(const char *pathname, struct stat64 *buf) {
+ 
+     return 0;
+ }
+-
++#undef open64
+ int open64(const char *filename, int flags, ...) {
+     va_list args;
+     mode_t mode = 0;
+@@ -2670,8 +2673,8 @@ FILE* fopen(const char *filename, const char *mode) {
+ }
+ 
+ #ifdef HAVE_OPEN64
+-
+-FILE *fopen64(const char *filename, const char *mode) {
++#undef fopen64
++FILE *fopen64(const char *__restrict filename, const char *__restrict mode) {
+ 
+     debug(DEBUG_LEVEL_VERBOSE, __FILE__": fopen64(%s)\n", filename?filename:"NULL");
+ 
+-- 
+2.1.4
+
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/fix-git-version-gen.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio/fix-git-version-gen.patch
new file mode 100644
index 0000000..ed94250
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/fix-git-version-gen.patch
@@ -0,0 +1,24 @@
+git-version-gen gets confused if a tarball is being built inside a git directory
+(ie your build directory is a subdirectory of a poky clone), and ends up calling
+the release 6.0-dirty.  Add a shortcut exit so if a tarball is detected it
+doesn't attempt to look at the git status.
+
+Upstream-Status: Submitted (https://bugs.freedesktop.org/show_bug.cgi?id=90936)
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/git-version-gen b/git-version-gen
+index 7546884..079b93e 100755
+--- a/git-version-gen
++++ b/git-version-gen
+@@ -84,7 +84,10 @@ then
+     v=`cat $tarball_version_file` || exit 1
+     case $v in
+ 	*$nl*) v= ;; # reject multi-line output
+-	[0-9]*) ;;
++	[0-9]*)
++		echo "$v" | tr -d '\012'
++		exit 0
++		;;
+ 	*) v= ;;
+     esac
+     test -z "$v" \
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio/volatiles.04_pulse b/meta/recipes-multimedia/pulseaudio/pulseaudio/volatiles.04_pulse
new file mode 100644
index 0000000..5b19980
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio/volatiles.04_pulse
@@ -0,0 +1,2 @@
+# <type> <owner> <group> <mode> <path> <linksource>
+d pulse pulse 0755 /var/run/pulse none
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_6.0.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_6.0.bb
new file mode 100644
index 0000000..31e9096
--- /dev/null
+++ b/meta/recipes-multimedia/pulseaudio/pulseaudio_6.0.bb
@@ -0,0 +1,16 @@
+require pulseaudio.inc
+
+SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/${BP}.tar.xz \
+           file://0001-padsp-Make-it-compile-on-musl.patch \
+           file://0001-client-conf-Add-allow-autospawn-for-root.patch \
+           file://0001-conf-parser-add-support-for-.d-directories.patch \
+           file://fix-git-version-gen.patch \
+           file://volatiles.04_pulse \
+"
+SRC_URI[md5sum] = "b691e83b7434c678dffacfa3a027750e"
+SRC_URI[sha256sum] = "b50640e0b80b1607600accfad2e45aabb79d379bf6354c9671efa2065477f6f6"
+
+do_compile_prepend() {
+    mkdir -p ${S}/libltdl
+    cp ${STAGING_LIBDIR}/libltdl* ${S}/libltdl
+}