blob: 2a3699f93e73d5c297d09690fff0fd26cb166501 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "Multimedia processing server for Linux"
2DESCRIPTION = "Linux server for handling and routing audio and video streams between applications and multimedia I/O devices"
3HOMEPAGE = "https://pipewire.org/"
4BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/pipewire/issues"
5AUTHOR = "Wim Taymans <wtaymans@redhat.com>"
6SECTION = "multimedia"
7
8LICENSE = "MIT & LGPL-2.1-or-later & GPL-2.0-only"
9LIC_FILES_CHKSUM = " \
10 file://LICENSE;md5=2158739e172e58dc9ab1bdd2d6ec9c72 \
11 file://COPYING;md5=97be96ca4fab23e9657ffa590b931c1a \
12"
13
14DEPENDS = "dbus ncurses"
15
Andrew Geissler20137392023-10-12 04:59:14 -060016SRCREV = "181fbfee6d3fcc3afd3c93613f126a8346dad586"
Andrew Geissler517393d2023-01-13 08:55:19 -060017SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https"
18
19S = "${WORKDIR}/git"
20
Patrick Williams8e7b46e2023-05-01 14:19:06 -050021inherit meson pkgconfig systemd gettext useradd
Andrew Geissler517393d2023-01-13 08:55:19 -060022
23USERADD_PACKAGES = "${PN}"
24
25GROUPADD_PARAM:${PN} = "--system pipewire"
26
27USERADD_PARAM:${PN} = "--system --home / --no-create-home \
28 --comment 'PipeWire multimedia daemon' \
29 --gid pipewire --groups audio,video \
30 pipewire"
31
32SYSTEMD_PACKAGES = "${PN}"
33
34# For "EVL", look up https://evlproject.org/ . It involves
35# a specially prepared kernel, and is currently unavailable
36# in Yocto.
37#
Andrew Geissler517393d2023-01-13 08:55:19 -060038#
39# manpage generation requires xmltoman, which is not available.
40#
41# The session-managers list specifies which session managers Meson
42# shall download (via git clone) and build as subprojects. In OE,
43# this is not how a session manager should be built. Instead, they
44# should be integrated as separate OE recipes. To prevent PipeWire
45# from using this Meson feature, set an empty list.
46# This does not disable support or the need for session managers,
47# it just prevents this subproject feature.
48#
49# AptX and LDAC are not available in OE. Currently, neither
Andrew Geissler8f840682023-07-21 09:09:43 -050050# are lv2, ROC, and libmysofa.
Andrew Geissler517393d2023-01-13 08:55:19 -060051#
52# The RTKit module is deprecated in favor of the newer RT module.
53# It still exists for legacy setups that still include it in
54# their PipeWire configuration files.
55EXTRA_OEMESON += " \
56 -Devl=disabled \
57 -Dtests=disabled \
58 -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \
59 -Dsystemd-system-unit-dir=${systemd_system_unitdir} \
60 -Dsystemd-user-unit-dir=${systemd_user_unitdir} \
61 -Dman=disabled \
62 -Dsession-managers='[]' \
63 -Dlv2=disabled \
64 -Droc=disabled \
65 -Dbluez5-codec-aptx=disabled \
66 -Dbluez5-codec-ldac=disabled \
67 -Dlegacy-rtkit=false \
Andrew Geissler8f840682023-07-21 09:09:43 -050068 -Dlibmysofa=disabled \
Andrew Geissler517393d2023-01-13 08:55:19 -060069"
70
71# spa alsa plugin code uses typedef redefinition, which is officially a C11 feature.
72# Pipewire builds with 'c_std=gnu99' by default. Recent versions of gcc don't issue this warning in gnu99
73# mode but it looks like clang still does
74CFLAGS:append = " -Wno-typedef-redefinition"
75
76# According to wireplumber documentation only one session manager should be installed at a time
77# Possible options are media-session, which has fewer dependencies but is very simple,
78# or wireplumber, which is more powerful.
79PIPEWIRE_SESSION_MANAGER ??= "wireplumber"
80
81FFMPEG_AVAILABLE = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'ffmpeg', '', d)}"
82BLUETOOTH_AAC = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'bluez-aac', '', d)}"
83
84PACKAGECONFIG:class-target ??= " \
85 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
86 ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez bluez-opus ${BLUETOOTH_AAC}', '', d)} \
87 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \
Andrew Geissler517393d2023-01-13 08:55:19 -060088 ${@bb.utils.filter('DISTRO_FEATURES', 'alsa vulkan pulseaudio', d)} \
89 ${PIPEWIRE_SESSION_MANAGER} \
Andrew Geissler8f840682023-07-21 09:09:43 -050090 ${FFMPEG_AVAILABLE} avahi flatpak gstreamer gsettings jack libusb pw-cat raop sndfile v4l2 udev volume webrtc-echo-cancelling libcamera readline \
Andrew Geissler517393d2023-01-13 08:55:19 -060091"
92
93# "jack" and "pipewire-jack" packageconfigs cannot be both enabled,
94# since "jack" imports libjack, and "pipewire-jack" generates
95# libjack.so* files, thus colliding with the libpack package. This
96# is why these two are marked in their respective packageconfigs
97# as being in conflict.
98PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib udev,,pipewire-alsa pipewire-alsa-card-profile"
99PACKAGECONFIG[avahi] = "-Davahi=enabled,-Davahi=disabled,avahi"
100PACKAGECONFIG[bluez] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc"
101PACKAGECONFIG[bluez-aac] = "-Dbluez5-codec-aac=enabled,-Dbluez5-codec-aac=disabled,fdk-aac"
102PACKAGECONFIG[bluez-opus] = "-Dbluez5-codec-opus=enabled,-Dbluez5-codec-opus=disabled,libopus"
Patrick Williams2a254922023-08-11 09:48:11 -0500103PACKAGECONFIG[bluez-lc3] = "-Dbluez5-codec-lc3=enabled,-Dbluez5-codec-lc3=disabled,liblc3"
Andrew Geissler8f840682023-07-21 09:09:43 -0500104# From the pipewire git log:
105# "Some Linux phones doesn't use oFono but ModemManager to control the modem."
106# This packageconfig enables modemmanager specific code in the BlueZ backend.
107PACKAGECONFIG[bluez-backend-native-mm] = "-Dbluez5-backend-native-mm=enabled,-Dbluez5-backend-native-mm=disabled,modemmanager"
Andrew Geissler517393d2023-01-13 08:55:19 -0600108PACKAGECONFIG[docs] = "-Ddocs=enabled,-Ddocs=disabled,doxygen-native graphviz-native"
109PACKAGECONFIG[ffmpeg] = "-Dffmpeg=enabled,-Dffmpeg=disabled,ffmpeg"
110PACKAGECONFIG[flatpak] = "-Dflatpak=enabled,-Dflatpak=disabled,glib-2.0"
111PACKAGECONFIG[gsettings] = "-Dgsettings=enabled,-Dgsettings=disabled,glib-2.0"
112PACKAGECONFIG[gstreamer] = "-Dgstreamer=enabled,-Dgstreamer=disabled,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base,,gstreamer1.0-pipewire"
113PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack,,,pipewire-jack"
114PACKAGECONFIG[libcamera] = "-Dlibcamera=enabled,-Dlibcamera=disabled,libcamera libdrm"
115PACKAGECONFIG[libcanberra] = "-Dlibcanberra=enabled,-Dlibcanberra=disabled,libcanberra"
116PACKAGECONFIG[libusb] = "-Dlibusb=enabled,-Dlibusb=disabled,libusb"
117PACKAGECONFIG[media-session] = ",,,pipewire-media-session,,wireplumber"
118PACKAGECONFIG[pulseaudio] = "-Dlibpulse=enabled,-Dlibpulse=disabled,pulseaudio,,pipewire-pulse"
119PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib"
120PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,pipewire-jack,jack"
121PACKAGECONFIG[pw-cat] = "-Dpw-cat=enabled,-Dpw-cat=disabled"
122PACKAGECONFIG[raop] = "-Draop=enabled,-Draop=disabled,openssl"
Andrew Geissler8f840682023-07-21 09:09:43 -0500123# Starting with version 0.3.60, readline usage can be turned off in pw-cli.
124# If it is disabled, getline() is used as a fallback.
125PACKAGECONFIG[readline] = "-Dreadline=enabled,-Dreadline=disabled,readline"
Andrew Geissler517393d2023-01-13 08:55:19 -0600126PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,libsdl2"
127PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1"
128PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd"
129PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=enabled,-Dsystemd-system-service=disabled,systemd"
130# "systemd-user-service" packageconfig will only install service
131# files to rootfs but not enable them as systemd.bbclass
132# currently lacks the feature of enabling user services.
133PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=enabled,-Dsystemd-user-service=disabled,systemd"
134# pw-cat needs sndfile packageconfig to be enabled
135PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev"
136PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev"
137PACKAGECONFIG[volume] = "-Dvolume=enabled,-Dvolume=disabled"
138PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled,vulkan-headers vulkan-loader"
Andrew Geissler220dafd2023-10-04 10:18:08 -0500139PACKAGECONFIG[webrtc-echo-cancelling] = "-Decho-cancel-webrtc=enabled,-Decho-cancel-webrtc=disabled,webrtc-audio-processing-1"
Andrew Geissler517393d2023-01-13 08:55:19 -0600140PACKAGECONFIG[wireplumber] = ",,,wireplumber,,media-session"
141
142PACKAGESPLITFUNCS:prepend = " split_dynamic_packages "
143PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends "
144
145SPA_SUBDIR = "spa-0.2"
146PW_MODULE_SUBDIR = "pipewire-0.3"
147
148remove_unused_installed_files() {
149 # jack.conf is used by pipewire-jack (not the JACK SPA plugin).
150 # Remove it if pipewire-jack is not built to avoid creating the
151 # pipewire-jack package.
152 if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then
153 rm -f "${D}${datadir}/pipewire/jack.conf"
154 fi
155
156 # minimal.conf is an example of how to minimally configure the
157 # daemon and is not meant to be used for production.
158 rm -f "${D}${datadir}/pipewire/minimal.conf"
159}
160
161do_install[postfuncs] += "remove_unused_installed_files"
162
163python split_dynamic_packages () {
164 # Create packages for each SPA plugin. These plugins are located
165 # in individual subdirectories, so a recursive search is needed.
166 spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}')
167 do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True)
168
169 # Create packages for each PipeWire module.
170 pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}')
171 do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False)
172}
173
174python set_dynamic_metapkg_rdepends () {
175 import os
176 import oe.utils
177
Patrick Williams864cc432023-02-09 14:54:44 -0600178 if bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('native', d):
179 return
180
Andrew Geissler517393d2023-01-13 08:55:19 -0600181 # Go through all generated SPA plugin and PipeWire module packages
182 # (excluding the main package and the -meta package itself) and
183 # add them to the -meta package as RDEPENDS.
184
185 base_pn = d.getVar('PN')
186
187 spa_pn = base_pn + '-spa-plugins'
188 spa_metapkg = spa_pn + '-meta'
189
190 pw_module_pn = base_pn + '-modules'
191 pw_module_metapkg = pw_module_pn + '-meta'
192
193 d.setVar('ALLOW_EMPTY:' + spa_metapkg, "1")
194 d.setVar('FILES:' + spa_metapkg, "")
195
196 d.setVar('ALLOW_EMPTY:' + pw_module_metapkg, "1")
197 d.setVar('FILES:' + pw_module_metapkg, "")
198
199 blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ]
200 spa_metapkg_rdepends = []
201 pw_module_metapkg_rdepends = []
202 pkgdest = d.getVar('PKGDEST')
203
204 for pkg in oe.utils.packages_filter_out_system(d):
205 if pkg in blacklist:
206 continue
207
208 is_spa_pkg = pkg.startswith(spa_pn)
209 is_pw_module_pkg = pkg.startswith(pw_module_pn)
210 if not is_spa_pkg and not is_pw_module_pkg:
211 continue
212
213 if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends:
214 continue
215
216 # See if the package is empty by looking at the contents of its
217 # PKGDEST subdirectory. If this subdirectory is empty, then then
218 # package is empty as well. Empty packages do not get added to
219 # the meta package's RDEPENDS.
220 pkgdir = os.path.join(pkgdest, pkg)
221 if os.path.exists(pkgdir):
222 dir_contents = os.listdir(pkgdir) or []
223 else:
224 dir_contents = []
225 is_empty = len(dir_contents) == 0
226 if not is_empty:
227 if is_spa_pkg:
228 spa_metapkg_rdepends.append(pkg)
229 if is_pw_module_pkg:
230 pw_module_metapkg_rdepends.append(pkg)
231
232 d.setVar('RDEPENDS:' + spa_metapkg, ' '.join(spa_metapkg_rdepends))
233 d.setVar('DESCRIPTION:' + spa_metapkg, spa_pn + ' meta package')
234
235 d.setVar('RDEPENDS:' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends))
236 d.setVar('DESCRIPTION:' + pw_module_metapkg, pw_module_pn + ' meta package')
237}
238
239PACKAGES =+ "\
240 libpipewire \
241 ${PN}-tools \
242 ${PN}-pulse \
243 ${PN}-alsa \
244 ${PN}-jack \
245 ${PN}-spa-plugins \
246 ${PN}-spa-plugins-meta \
247 ${PN}-spa-tools \
248 ${PN}-modules \
249 ${PN}-modules-meta \
250 ${PN}-alsa-card-profile \
251 ${PN}-v4l2 \
Andrew Geissler8f840682023-07-21 09:09:43 -0500252 ${PN}-aes67 \
Andrew Geissler517393d2023-01-13 08:55:19 -0600253 gstreamer1.0-pipewire \
254"
255
256PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*"
Patrick Williams864cc432023-02-09 14:54:44 -0600257PACKAGES_DYNAMIC:class-native = ""
Andrew Geissler517393d2023-01-13 08:55:19 -0600258
259SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd-system-service', 'pipewire.service', '', d)}"
260CONFFILES:${PN} += "${datadir}/pipewire/pipewire.conf"
261FILES:${PN} = " \
262 ${datadir}/pipewire \
263 ${systemd_system_unitdir}/pipewire* \
264 ${systemd_user_unitdir} \
265 ${bindir}/pipewire \
266 ${bindir}/pipewire-avb \
Andrew Geissler220dafd2023-10-04 10:18:08 -0500267 ${bindir}/pipewire-vulkan \
Andrew Geissler517393d2023-01-13 08:55:19 -0600268"
269
270RRECOMMENDS:${PN}:class-target += " \
271 pipewire-modules-meta \
272 pipewire-spa-plugins-meta \
273"
274
275FILES:${PN}-dev += " \
276 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \
277"
278
279CONFFILES:libpipewire += "${datadir}/pipewire/client.conf"
280FILES:libpipewire = " \
281 ${datadir}/pipewire/client.conf \
282 ${libdir}/libpipewire-*.so.* \
283"
284# Add the bare minimum modules and plugins required to be able
285# to use libpipewire. Without these, it is essentially unusable.
286RDEPENDS:libpipewire += " \
287 ${PN}-modules-client-node \
288 ${PN}-modules-protocol-native \
289 ${PN}-spa-plugins-support \
290"
291
292FILES:${PN}-tools = " \
293 ${bindir}/pw-cat \
294 ${bindir}/pw-cli \
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500295 ${bindir}/pw-config \
Andrew Geissler517393d2023-01-13 08:55:19 -0600296 ${bindir}/pw-dot \
297 ${bindir}/pw-dsdplay \
298 ${bindir}/pw-dump \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500299 ${bindir}/pw-encplay \
Andrew Geissler517393d2023-01-13 08:55:19 -0600300 ${bindir}/pw-link \
301 ${bindir}/pw-loopback \
302 ${bindir}/pw-metadata \
303 ${bindir}/pw-mididump \
304 ${bindir}/pw-midiplay \
305 ${bindir}/pw-midirecord \
306 ${bindir}/pw-mon \
307 ${bindir}/pw-play \
308 ${bindir}/pw-profiler \
309 ${bindir}/pw-record \
310 ${bindir}/pw-reserve \
311 ${bindir}/pw-top \
312"
313
314# This is a shim daemon that is intended to be used as a
315# drop-in PulseAudio replacement, providing a pulseaudio-compatible
316# socket that can be used by applications that use libpulse.
317CONFFILES:${PN}-pulse += "${datadir}/pipewire/pipewire-pulse.conf"
318FILES:${PN}-pulse = " \
319 ${datadir}/pipewire/pipewire-pulse.conf \
320 ${systemd_system_unitdir}/pipewire-pulse.* \
321 ${systemd_user_unitdir}/pipewire-pulse.* \
322 ${bindir}/pipewire-pulse \
323"
324RDEPENDS:${PN}-pulse += " \
325 ${PN}-modules-protocol-pulse \
326"
327
328# ALSA plugin to redirect audio to pipewire.
329FILES:${PN}-alsa = "\
330 ${libdir}/alsa-lib/* \
331 ${datadir}/alsa/alsa.conf.d/* \
332"
333
334# JACK drop-in libraries to redirect audio to pipewire.
335CONFFILES:${PN}-jack = "${datadir}/pipewire/jack.conf"
336FILES:${PN}-jack = "\
337 ${bindir}/pw-jack \
338 ${datadir}/pipewire/jack.conf \
339 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \
340"
341
342# Dynamic SPA plugin packages (see set_dynamic_metapkg_rdepends).
343FILES:${PN}-spa-plugins = ""
344RRECOMMENDS:${PN}-spa-plugins += "${PN}-spa-plugins-meta"
345
346FILES:${PN}-spa-plugins-bluez5 += " \
347 ${datadir}/${SPA_SUBDIR}/bluez5/* \
348"
349
350FILES:${PN}-spa-tools = " \
351 ${bindir}/spa-* \
352"
353
354# Dynamic PipeWire module packages (see set_dynamic_metapkg_rdepends).
355FILES:${PN}-modules = ""
356RRECOMMENDS:${PN}-modules += "${PN}-modules-meta"
357
358CONFFILES:${PN}-modules-rt = "${datadir}/pipewire/client-rt.conf"
359FILES:${PN}-modules-rt += " \
360 ${datadir}/pipewire/client-rt.conf \
Andrew Geissler8f840682023-07-21 09:09:43 -0500361 ${sysconfdir}/security/limits.d/* \
Andrew Geissler517393d2023-01-13 08:55:19 -0600362 "
363
364CONFFILES:${PN}-modules-filter-chain = "${datadir}/pipewire/filter-chain/*"
365FILES:${PN}-modules-filter-chain += " \
366 ${datadir}/pipewire/filter-chain/* \
367"
368
369FILES:${PN}-alsa-card-profile = " \
370 ${datadir}/alsa-card-profile/* \
371 ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \
372"
373
374# V4L2 interface emulator for sending/receiving data between PipeWire and V4L2 applications.
375FILES:${PN}-v4l2 += " \
376 ${bindir}/pw-v4l2 \
377 ${libdir}/${PW_MODULE_SUBDIR}/v4l2/libpw-v4l2.so \
378"
379
Andrew Geissler8f840682023-07-21 09:09:43 -0500380# AES67 is a standard for audio over IP, from the Audio Engineering Society (AES).
381FILES:${PN}-aes67 += " \
382 ${bindir}/pipewire-aes67 \
383"
384
Andrew Geissler517393d2023-01-13 08:55:19 -0600385FILES:gstreamer1.0-pipewire = " \
386 ${libdir}/gstreamer-1.0/* \
387"
388
389BBCLASSEXTEND = "native nativesdk"