From 2e94f15c5206f15d0770e91144c481784818e7fb Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 16 Oct 2015 11:42:39 -0700 Subject: [PATCH] add package 'pulseaudio' Signed-off-by: Stephan Raue --- config/functions | 1 + distributions/OpenELEC/options | 3 + packages/audio/pulseaudio/config/system.pa | 74 ++++++++++ packages/audio/pulseaudio/package.mk | 128 ++++++++++++++++++ ...ppend-dirty-to-server-module-version.patch | 24 ++++ .../pulseaudio-0900.02-check_uid.patch | 13 ++ .../pulseaudio/profile.d/04-pulseaudio.conf | 1 + .../pulseaudio/system.d/pulseaudio.service | 15 ++ 8 files changed, 259 insertions(+) create mode 100644 packages/audio/pulseaudio/config/system.pa create mode 100644 packages/audio/pulseaudio/package.mk create mode 100644 packages/audio/pulseaudio/patches/pulseaudio-0900.01-never-append-dirty-to-server-module-version.patch create mode 100644 packages/audio/pulseaudio/patches/pulseaudio-0900.02-check_uid.patch create mode 100644 packages/audio/pulseaudio/profile.d/04-pulseaudio.conf create mode 100644 packages/audio/pulseaudio/system.d/pulseaudio.service diff --git a/config/functions b/config/functions index 986b7c2498..75469dcc41 100644 --- a/config/functions +++ b/config/functions @@ -343,6 +343,7 @@ show_config() { config_message="$config_message\n $dashes$dashes" config_message="$config_message\n - ALSA support:\t\t\t $ALSA_SUPPORT" + config_message="$config_message\n - Pulseaudio support:\t\t\t $PULSEAUDIO_SUPPORT" config_message="$config_message\n - Bluetooth support:\t\t\t $BLUETOOTH_SUPPORT" config_message="$config_message\n - LCD drivers:\t\t\t\t $LCD_DRIVER" diff --git a/distributions/OpenELEC/options b/distributions/OpenELEC/options index f3416a9f4a..0bcdf39d6e 100644 --- a/distributions/OpenELEC/options +++ b/distributions/OpenELEC/options @@ -31,6 +31,9 @@ # install extra subtitle Fonts for KODI (yes / no) KODI_EXTRA_FONTS="yes" +# build and install PulseAudio support (yes / no) + PULSEAUDIO_SUPPORT="no" + # build and install espeak support (yes / no) ESPEAK_SUPPORT="yes" diff --git a/packages/audio/pulseaudio/config/system.pa b/packages/audio/pulseaudio/config/system.pa new file mode 100644 index 0000000000..303370dd97 --- /dev/null +++ b/packages/audio/pulseaudio/config/system.pa @@ -0,0 +1,74 @@ +#!/usr/bin/pulseaudio -nF +# +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see . + +# This startup script is used only if PulseAudio is started in system +# mode. + +### Automatically load driver modules depending on the hardware available +.ifexists module-udev-detect.so +load-module module-udev-detect +.else +### Use the static hardware detection module (for systems that lack udev/hal support) +load-module module-detect +.endif + +### Load several protocols +.ifexists module-esound-protocol-unix.so +load-module module-esound-protocol-unix +.endif +load-module module-native-protocol-unix + +### Automatically restore the volume of streams and devices +load-module module-stream-restore +load-module module-device-restore + +### Automatically restore the default sink/source when changed by the user +### during runtime +### NOTE: This should be loaded as early as possible so that subsequent modules +### that look up the default sink/source get the right value +load-module module-default-device-restore + +### Automatically move streams to the default sink if the sink they are +### connected to dies, similar for sources +load-module module-rescue-streams + +### Make sure we always have a sink around, even if it is a null sink. +load-module module-always-sink + +### Automatically suspend sinks/sources that become idle for too long +load-module module-suspend-on-idle + +### Enable positioned event sounds +load-module module-position-event-sounds + +### Automatically load modules for bluetooth +.ifexists module-bluetooth-policy.so + load-module module-bluetooth-policy +.endif + +.ifexists module-bluetooth-discover.so + load-module module-bluetooth-discover +.endif + +.ifexists module-zeroconf-publish.so + load-module module-zeroconf-publish + load-module module-zeroconf-discover +.endif + +load-module module-native-protocol-tcp auth-anonymous=1 +load-module module-switch-on-connect + diff --git a/packages/audio/pulseaudio/package.mk b/packages/audio/pulseaudio/package.mk new file mode 100644 index 0000000000..9f23d4b21a --- /dev/null +++ b/packages/audio/pulseaudio/package.mk @@ -0,0 +1,128 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="pulseaudio" +PKG_VERSION="7.0" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://pulseaudio.org/" +PKG_URL="http://www.freedesktop.org/software/pulseaudio/releases/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_DEPENDS_TARGET="toolchain libtool json-c alsa-lib libsndfile soxr dbus systemd libressl libcap" +PKG_PRIORITY="optional" +PKG_SECTION="audio" +PKG_SHORTDESC="pulseaudio: Yet another sound server for Unix" +PKG_LONGDESC="PulseAudio is a sound server for Linux and other Unix-like operating systems. It is intended to be an improved drop-in replacement for the Enlightened Sound Daemon (esound or esd). In addition to the features esound provides, PulseAudio has an extensible plugin architecture, support for more than one sink per source, better low-latency behavior, the ability to be embedded into other software, a completely asynchronous C API, a simple command line interface for reconfiguring the daemon while running, flexible and implicit sample type conversion and resampling, and a "Zero-Copy" architecture." + +PKG_IS_ADDON="no" + +# broken +PKG_AUTORECONF="no" + +if [ "$BLUETOOTH_SUPPORT" = "yes" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET sbc" + PULSEAUDIO_BLUETOOTH="--enable-bluez5" +else + PULSEAUDIO_BLUETOOTH="--disable-bluez5" +fi + +if [ "$AVAHI_DAEMON" = "yes" ]; then + PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET avahi" + PULSEAUDIO_AVAHI="--enable-avahi" +else + PULSEAUDIO_AVAHI="--disable-avahi" +fi + +# package specific configure options +PKG_CONFIGURE_OPTS_TARGET="--disable-silent-rules \ + --disable-nls \ + --enable-largefile \ + --disable-rpath \ + --disable-x11 \ + --disable-tests \ + --disable-samplerate \ + --disable-oss-output \ + --disable-oss-wrapper \ + --disable-coreaudio-output \ + --enable-alsa \ + --disable-esound \ + --disable-solaris \ + --disable-waveout \ + --disable-glib2 \ + --disable-gtk3 \ + --disable-gconf \ + $PULSEAUDIO_AVAHI \ + --disable-jack \ + --disable-asyncns \ + --disable-tcpwrap \ + --disable-lirc \ + --enable-dbus \ + --disable-bluez4 \ + $PULSEAUDIO_BLUETOOTH \ + --disable-bluez5-ofono-headset \ + --disable-bluez5-native-headset \ + --enable-udev \ + --disable-hal-compat \ + --enable-ipv6 \ + --enable-openssl \ + --disable-xen \ + --disable-orc \ + --disable-manpages \ + --disable-per-user-esound-socket \ + --disable-default-build-tests \ + --disable-legacy-database-entry-format \ + --with-system-user=root \ + --with-system-group=root \ + --with-access-group=root \ + --without-caps \ + --without-fftw \ + --without-speex \ + --with-soxr \ + --with-module-dir=/usr/lib/pulse" + +post_makeinstall_target() { +# add_user pulse x 499 498 "PulseAudio System Daemon" "/var/run/pulse" "/bin/sh" +# add_group pulse 498 +# add_group pulse-access 497 + + sed -e 's%user="pulse"%user="root"%g' -i $INSTALL/etc/dbus-1/system.d/pulseaudio-system.conf + + rm -rf $INSTALL/usr/bin/esdcompat + rm -rf $INSTALL/usr/include + rm -rf $INSTALL/usr/lib/cmake + rm -rf $INSTALL/usr/lib/pkgconfig + rm -rf $INSTALL/usr/lib/systemd + rm -rf $INSTALL/usr/share/vala + rm -rf $INSTALL/usr/share/zsh + rm -rf $INSTALL/usr/share/bash-completion + + cp $PKG_DIR/config/system.pa $INSTALL/etc/pulse/ + + # Remove unwanted symlinks + for file in $INSTALL/*; do + if [ -L "$file" ]; then + rm $file + fi + done +} + +post_install() { + enable_service pulseaudio.service +} diff --git a/packages/audio/pulseaudio/patches/pulseaudio-0900.01-never-append-dirty-to-server-module-version.patch b/packages/audio/pulseaudio/patches/pulseaudio-0900.01-never-append-dirty-to-server-module-version.patch new file mode 100644 index 0000000000..8bea8d95fb --- /dev/null +++ b/packages/audio/pulseaudio/patches/pulseaudio-0900.01-never-append-dirty-to-server-module-version.patch @@ -0,0 +1,24 @@ +From c9d7dcaa87f9ada49d75483a7c604dba27a0d71a Mon Sep 17 00:00:00 2001 +From: Stefan Saraev +Date: Tue, 7 Jan 2014 13:22:48 +0200 +Subject: [PATCH] never append -dirty to server/module version + +--- + git-version-gen | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/git-version-gen b/git-version-gen +index 9d65b80..fcf11fd 100755 +--- a/git-version-gen ++++ b/git-version-gen +@@ -152,6 +152,7 @@ v=`echo "$v" |sed 's/^v//'` + git status > /dev/null 2>&1 + + dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= ++dirty= + case "$dirty" in + '') ;; + *) # Append the suffix only if there isn't one already. +-- +1.7.2.5 + diff --git a/packages/audio/pulseaudio/patches/pulseaudio-0900.02-check_uid.patch b/packages/audio/pulseaudio/patches/pulseaudio-0900.02-check_uid.patch new file mode 100644 index 0000000000..a54ede3b8a --- /dev/null +++ b/packages/audio/pulseaudio/patches/pulseaudio-0900.02-check_uid.patch @@ -0,0 +1,13 @@ +--- pulseaudio-4.0.orig/src/pulsecore/core-util.c 2014-01-12 23:31:26.281525000 -0800 ++++ pulseaudio-4.0/src/pulsecore/core-util.c 2014-01-12 23:32:32.977118803 -0800 +@@ -1524,10 +1524,6 @@ + if (stat(p, &st) < 0) + return -errno; + +-#ifdef HAVE_GETUID +- if (st.st_uid != getuid()) +- return -EACCES; +-#endif + + return 0; + } \ No newline at end of file diff --git a/packages/audio/pulseaudio/profile.d/04-pulseaudio.conf b/packages/audio/pulseaudio/profile.d/04-pulseaudio.conf new file mode 100644 index 0000000000..0c72f573cb --- /dev/null +++ b/packages/audio/pulseaudio/profile.d/04-pulseaudio.conf @@ -0,0 +1 @@ +export SDL_AUDIODRIVER=pulse diff --git a/packages/audio/pulseaudio/system.d/pulseaudio.service b/packages/audio/pulseaudio/system.d/pulseaudio.service new file mode 100644 index 0000000000..e0b774248c --- /dev/null +++ b/packages/audio/pulseaudio/system.d/pulseaudio.service @@ -0,0 +1,15 @@ +[Unit] +Description=PulseAudio Sound System +After=syslog.target local-fs.target +Requires=bluetooth.service + +[Service] +Type=forking +ExecStart=/usr/bin/pulseaudio --start --daemonize --log-level=0 +TimeoutStopSec=5 +Restart=always +RestartSec=2 +StartLimitInterval=0 + +[Install] +WantedBy=multi-user.target