1SUMMARY = "Sound server for Linux and Unix-like operating systems"
2DESCRIPTION = "A general purpose sound server intended to run as a middleware \
3between your applications and your hardware devices, either using ALSA or OSS."
4HOMEPAGE = "http://www.pulseaudio.org"
5SECTION = "libs/multimedia"
6
7# Most of PulseAudio code is under LGPL-2.1-or-later. There are a few
8# exceptions:
9#
10# The "adrian" echo canceller variant has code under a non-standard permissive
11# license. See src/modules/echo-cancel/adrian-license.txt for details. This
12# recipe disables the adrian echo canceller to avoid hassle with the unusual
13# license.
14#
15# The src/modules/reserve* and src/pulsecore/rtkit* files are under the MIT
16# license.
17#
18# The src/pulsecore/filter/ directory contains code under the 3-clause BSD
19# license.
20#
21# People who distribute PulseAudio binaries need to also consider that there
22# are some dependencies to GPL libraries. LGPL code that depends on GPL
23# libraries probably becomes effectively GPL-licensed (at compile-time? or at
24# at link-time?). I'm not a lawyer, though, so I'm not sure of the exact
25# implications. The GPL dependencies only affect the server, not the client
26# library, with the exception of libdbus that affects both. These are the GPL
27# library dependencies:
28#
29# One of the resampler implementations uses libsamplerate. This recipe doesn't
30# enable that resampler, however.
31#
32# One of the database implementations uses gdbm. This recipe doesn't enable
33# that database implementation, however.
34#
35# module-lirc (enabled by PACKAGECONFIG[lirc]) uses LIRC.
36#
37# module-equalizer-sink uses FFTW. This recipe disables that, however.
38#
39# The dependency with the most complicated licensing considerations is libdbus.
40# When PACKAGECONFIG[dbus] is enabled (like it is by default), libdbus will be
41# used by both the server and the client library (libpulse). Does this affect
42# applications that use libpulse? It should also be noted that libdbus is
43# dual-licensed: either GPL-2.0-or-later or AFL-2.0 terms apply. Whose decision
44# is it which of the licenses apply? What a mess. Some people hold the view that
45# libdbus is a system library that is covered by the "special exception" in
46# GPLv2's section 3, and therefore libdbus's GPL license doesn't affect
47# PulseAudio.
48LICENSE = "LGPL-2.1-or-later & MIT & BSD-3-Clause"
49
50LIC_FILES_CHKSUM = "file://LICENSE;md5=0e5cd938de1a7a53ea5adac38cc10c39 \
51                    file://GPL;md5=4325afd396febcb659c36b49533135d4 \
52                    file://LGPL;md5=2d5025d4aa3495befef8f17206a5b0a1 \
53                    file://src/modules/echo-cancel/adrian-license.txt;md5=abbab006a561fbffccedf1c3531f34ab \
54                    file://src/pulsecore/filter/LICENSE.WEBKIT;md5=49defbaffddf8c51faf606ff7fc3b1f7 \
55                    file://src/pulsecore/resampler.h;beginline=4;endline=21;md5=09794012ae16912c0270f3280cc8ff84 \
56                    file://src/modules/reserve.h;beginline=6;endline=28;md5=0e23094760367d51b6609750e9b31fbb \
57                    file://src/pulsecore/rtkit.h;beginline=6;endline=29;md5=3f00ff966716ae0817c31576d1473528 \
58                    file://src/modules/echo-cancel/adrian-aec.h;beginline=3;endline=12;md5=d3ed4fad1c073f8b06f37495dc5d1026 \
59                    file://src/pulsecore/filter/biquad.h;beginline=1;endline=4;md5=6d46d1365206528a20137355924233c1 \
60"
61
62# libtool is needed for libltdl, used in module loading.
63DEPENDS = "m4-native libatomic-ops libsndfile1 libtool"
64# optional
65DEPENDS += "udev alsa-lib glib-2.0"
66DEPENDS += "speexdsp libxml-parser-perl-native libcap"
67
68inherit bash-completion meson pkgconfig useradd gettext perlnative systemd manpages gsettings
69
70# *.desktop rules wont be generated during configure and build will fail
71# if using --disable-nls
72USE_NLS = "yes"
73
74EXTRA_OEMESON = "\
75		-Dhal-compat=false \
76		-Dorc=disabled \
77		-Daccess_group=audio \
78		-Dopenssl=disabled \
79		-Ddatabase=simple \
80		-Dzshcompletiondir=no \
81		-Dudevrulesdir=`pkg-config --variable=udevdir udev`/rules.d \
82		-Dvalgrind=disabled \
83		-Dtests=false \
84		-Drunning-from-build-tree=false \
85"
86
87# soxr (the SoX Resampler library) doesn't seem to be currently packaged in
88# oe-core nor meta-oe, so let's not add a PACKAGECONFIG entry for it for now.
89EXTRA_OEMESON += "-Dsoxr=disabled"
90
91# The FFTW dependency (for module-equalizer-sink) was removed in commit
92# ddbd713293 without explaining why it was not made a PACKAGECONFIG item
93# instead. Oh well, let's keep it disabled until someone expresses some
94# interest in having it enabled.
95EXTRA_OEMESON += "-Dfftw=disabled"
96
97# The "adrian" echo canceller implementation has a non-standard license
98# (src/modules/echo-cancel/adrian-license.txt). It's a permissive license, so
99# the licensing terms are probably not problematic, but it would be an extra
100# hassle to add the license to OE-Core's set of licenses. The canceller isn't
101# very good anyway, better alternatives exist (such as the webrtc canceller).
102EXTRA_OEMESON += "-Dadrian-aec=false"
103
104PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez5', '', d)} \
105                   ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
106                   ${@bb.utils.contains('DISTRO_FEATURES', '3g', 'ofono', '', d)} \
107                   ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd x11', d)} \
108                   dbus gsettings \
109                   "
110
111PACKAGECONFIG[dbus] = "-Ddbus=enabled,-Ddbus=disabled,dbus"
112PACKAGECONFIG[bluez5] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc"
113PACKAGECONFIG[gsettings] = "-Dgsettings=enabled,-Dgsettings=disabled,glib-2.0-native glib-2.0"
114PACKAGECONFIG[ofono] = "-Dbluez5-ofono-headset=true,-Dbluez5-ofono-headset=false,ofono"
115PACKAGECONFIG[gtk] = "-Dgtk=enabled,-Dgtk=disabled,gtk+3"
116PACKAGECONFIG[systemd] = "-Dsystemd=enabled -Dsystemduserunitdir=${systemd_user_unitdir},-Dsystemd=disabled,systemd"
117PACKAGECONFIG[x11] = "-Dx11=enabled,-Dx11=disabled,virtual/libx11 libxtst libice libsm libxcb"
118PACKAGECONFIG[avahi] = "-Davahi=enabled,-Davahi=disabled,avahi"
119PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack"
120# Since many embedded systems don't have non-root users, it's useful to be
121# able to use pulseaudio autospawn for root as well.
122PACKAGECONFIG[autospawn-for-root] = ",,,"
123PACKAGECONFIG[lirc] = "-Dlirc=enabled,-Dlirc=disabled,lirc"
124PACKAGECONFIG[webrtc] = "-Dwebrtc-aec=enabled,-Dwebrtc-aec=disabled,webrtc-audio-processing"
125PACKAGECONFIG[ipv6] = "-Dipv6=true,-Dipv6=false,"
126PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,"
127
128export TARGET_PFPU = "${TARGET_FPU}"
129
130set_cfg_value () {
131	sed -i -e "s/\(; *\)\?$2 =.*/$2 = $3/" "$1"
132	if ! grep -q "^$2 = $3\$" "$1"; then
133		die "Use of sed to set '$2' to '$3' in '$1' failed"
134	fi
135}
136
137do_compile:append () {
138	if ${@bb.utils.contains('PACKAGECONFIG', 'autospawn-for-root', 'true', 'false', d)}; then
139		set_cfg_value src/pulse/client.conf allow-autospawn-for-root yes
140	fi
141}
142
143do_install:append() {
144	install -d ${D}${sysconfdir}/default/volatiles
145	install -m 0644 ${WORKDIR}/volatiles.04_pulse  ${D}${sysconfdir}/default/volatiles/04_pulse
146}
147
148USERADD_PACKAGES = "pulseaudio-server"
149GROUPADD_PARAM:pulseaudio-server = "--system pulse"
150USERADD_PARAM:pulseaudio-server = "--system --home /var/run/pulse \
151                              --no-create-home --shell /bin/false \
152                              --groups audio,pulse --gid pulse pulse"
153
154PACKAGES =+ "\
155             libpulse \
156             libpulse-mainloop-glib \
157             libpulse-simple \
158             libpulsecommon \
159             libpulsecore \
160             ${PN}-pa-info \
161             ${PN}-server \
162             ${PN}-misc \
163             "
164
165# The console-kit module is included here explicitly so bitbake can map to the
166# RDEPENDS we define for it in this recipe, and thereby ensure that when
167# adding the console-kit module to an image, we also get the necessary
168# consolekit package produced.
169PACKAGES =+ "${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'pulseaudio-module-console-kit', '', d)}"
170
171#upgrade path:
172RREPLACES:pulseaudio-server = "libpulse-bin libpulse-conf"
173
174PACKAGES_DYNAMIC += "^pulseaudio-lib-.* ^pulseaudio-module-.*"
175
176FILES:libpulsecore = "${libdir}/pulseaudio/libpulsecore*.so"
177FILES:libpulsecommon = "${libdir}/pulseaudio/libpulsecommon*.so"
178
179# client.conf configures the behaviour of libpulse, so it belongs in the same
180# package.
181FILES:libpulse = "${libdir}/libpulse.so.* ${sysconfdir}/pulse/client.conf"
182
183FILES:libpulse-simple = "${libdir}/libpulse-simple.so.*"
184FILES:libpulse-mainloop-glib = "${libdir}/libpulse-mainloop-glib.so.*"
185
186FILES:${PN}-dev += "${libdir}/pulse-${PV}/modules/*.la ${datadir}/vala"
187FILES:${PN}-bin += "${sysconfdir}/default/volatiles/04_pulse"
188FILES:${PN}-pa-info = "${bindir}/pa-info"
189FILES:${PN}-server = "${bindir}/pulseaudio ${bindir}/start-* ${sysconfdir} ${bindir}/pactl */udev/rules.d/*.rules */*/udev/rules.d/*.rules ${systemd_user_unitdir}/*"
190
191#SYSTEMD_PACKAGES = "${PN}-server"
192SYSTEMD_SERVICE:${PN}-server = "pulseaudio.service"
193
194FILES:${PN}-misc = "${bindir}/* ${libdir}/pulseaudio/libpulsedsp.so"
195
196# Allow the pulseaudio package to be created empty as a placeholder (-dbg and -dev depend on it)
197FILES:${PN} = ""
198ALLOW_EMPTY:${PN} = "1"
199
200CONFFILES:libpulse = "${sysconfdir}/pulse/client.conf"
201
202CONFFILES:pulseaudio-server = "\
203  ${sysconfdir}/pulse/default.pa \
204  ${sysconfdir}/pulse/daemon.conf \
205  ${sysconfdir}/pulse/system.pa \
206  "
207
208pkg_postinst:${PN}-server() {
209        if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ] ; then
210            ${sysconfdir}/init.d/populate-volatile.sh update
211        fi
212}
213
214python populate_packages:prepend() {
215    plugindir = d.expand('${libdir}/pulseaudio/modules/')
216    do_split_packages(d, plugindir, r'^module-(.*)\.so$', '${PN}-module-%s', 'PulseAudio module for %s', extra_depends='', prepend=True)
217    do_split_packages(d, plugindir, r'^lib(.*)\.so$', '${PN}-lib-%s', 'PulseAudio library for %s', extra_depends='', prepend=True)
218}
219
220# pa-info is a bash script that collects information about the audio setup.
221# It's primarily useful for attaching an information dump when reporting bugs.
222RDEPENDS:${PN}-pa-info = "\
223                          alsa-utils-amixer \
224                          alsa-utils-aplay \
225                          alsa-utils-scripts \
226                          bash \
227                          ${PN}-server \
228                          "
229
230RDEPENDS:pulseaudio-server = " \
231    pulseaudio-module-filter-apply \
232    pulseaudio-module-filter-heuristics \
233    pulseaudio-module-udev-detect \
234    pulseaudio-module-null-sink \
235    pulseaudio-module-device-restore \
236    pulseaudio-module-stream-restore \
237    pulseaudio-module-card-restore \
238    pulseaudio-module-augment-properties \
239    pulseaudio-module-detect \
240    pulseaudio-module-alsa-sink \
241    pulseaudio-module-alsa-source \
242    pulseaudio-module-alsa-card \
243    pulseaudio-module-native-protocol-unix \
244    pulseaudio-module-default-device-restore \
245    pulseaudio-module-intended-roles \
246    pulseaudio-module-rescue-streams \
247    pulseaudio-module-always-sink \
248    pulseaudio-module-suspend-on-idle \
249    pulseaudio-module-position-event-sounds \
250    pulseaudio-module-role-cork \
251    pulseaudio-module-switch-on-port-available"
252
253# If the server is installed, it's usually desirable to make ALSA applications
254# use PulseAudio. alsa-plugins-pulseaudio-conf will install the configuration
255# that makes the PulseAudio plugin the default ALSA device.
256RDEPENDS:pulseaudio-server += "${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio', 'alsa-plugins-pulseaudio-conf', '', d)}"
257
258# pulseaudio-module-console-kit is built whenever dbus is enabled by PACKAGECONFIG
259# but consolekit depends on libx11 and is available only for DISTRO with x11 in DISTRO_FEATURES
260RDEPENDS:pulseaudio-module-console-kit =+ "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'consolekit', '', d)}"
261RDEPENDS:pulseaudio-misc += "pulseaudio-module-cli-protocol-unix"
262
263FILES:${PN}-module-alsa-card += "${datadir}/pulseaudio/alsa-mixer"
264
265GSETTINGS_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'gsettings', '${PN}-module-gsettings', '', d)}"
266FILES:${PN}-module-gsettings += "${libexecdir}/pulse/gsettings-helper ${datadir}/GConf/gsettings ${datadir}/glib-2.0/schemas"
267
268# The console-kit module is good to have on X11 systems (it keeps PulseAudio
269# running for the duration of the user login session). The device-manager and
270# x11-* modules are referenced from the start-pulseaudio-x11 script, so those
271# modules must be installed when X11 is enabled.
272RDEPENDS:pulseaudio-server += "\
273        ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '\
274                pulseaudio-module-device-manager \
275                pulseaudio-module-x11-cork-request \
276                pulseaudio-module-x11-publish \
277                pulseaudio-module-x11-xsmp \
278        ', '', d)}"
279
280RDEPENDS:pulseaudio-server += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', \
281                                  bb.utils.contains('DISTRO_FEATURES', 'systemd', 'pulseaudio-module-systemd-login', 'pulseaudio-module-console-kit', d), \
282                                  '', d)}"
283