blob: feefe7c15132992b4823d9b37701cccfa37ca2b8 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001SUMMARY = "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
16SRCREV = "f274e53d25ee8f483ac6fce9e516bb1830abe88b"
17SRC_URI = " \
18 git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https \
19 file://0001-avb-fix-compilation-on-big-endian.patch \
20"
21
22S = "${WORKDIR}/git"
23
24inherit meson pkgconfig systemd gettext useradd
25
26USERADD_PACKAGES = "${PN}"
27
28GROUPADD_PARAM:${PN} = "--system pipewire"
29
30USERADD_PARAM:${PN} = "--system --home / --no-create-home \
31 --comment 'PipeWire multimedia daemon' \
32 --gid pipewire --groups audio,video \
33 pipewire"
34
35SYSTEMD_PACKAGES = "${PN}"
36
37# For "EVL", look up https://evlproject.org/ . It involves
38# a specially prepared kernel, and is currently unavailable
39# in Yocto.
40#
41# Vulkan support is currently (as of version 0.3.44) not functional.
42#
43# manpage generation requires xmltoman, which is not available.
44#
45# The session-managers list specifies which session managers Meson
46# shall download (via git clone) and build as subprojects. In OE,
47# this is not how a session manager should be built. Instead, they
48# should be integrated as separate OE recipes. To prevent PipeWire
49# from using this Meson feature, set an empty list.
50# This does not disable support or the need for session managers,
51# it just prevents this subproject feature.
52#
53# AptX and LDAC are not available in OE. Currently, neither
54# are lv2 and ROC.
55#
56# The RTKit module is deprecated in favor of the newer RT module.
57# It still exists for legacy setups that still include it in
58# their PipeWire configuration files.
59EXTRA_OEMESON += " \
60 -Devl=disabled \
61 -Dtests=disabled \
62 -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \
63 -Dsystemd-system-unit-dir=${systemd_system_unitdir} \
64 -Dsystemd-user-unit-dir=${systemd_user_unitdir} \
65 -Dman=disabled \
66 -Dsession-managers='[]' \
67 -Dlv2=disabled \
68 -Droc=disabled \
69 -Dbluez5-codec-aptx=disabled \
70 -Dbluez5-codec-ldac=disabled \
71 -Dlegacy-rtkit=false \
72"
73
74# spa alsa plugin code uses typedef redefinition, which is officially a C11 feature.
75# Pipewire builds with 'c_std=gnu99' by default. Recent versions of gcc don't issue this warning in gnu99
76# mode but it looks like clang still does
77CFLAGS:append = " -Wno-typedef-redefinition"
78
79# According to wireplumber documentation only one session manager should be installed at a time
80# Possible options are media-session, which has fewer dependencies but is very simple,
81# or wireplumber, which is more powerful.
82PIPEWIRE_SESSION_MANAGER ??= "media-session"
83
84FFMPEG_AVAILABLE = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'ffmpeg', '', d)}"
85BLUETOOTH_AAC = "${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'bluez-aac', '', d)}"
86
87PACKAGECONFIG:class-target ??= " \
88 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'avahi', '', d)} \
89 ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez ${BLUETOOTH_AAC}', '', d)} \
90 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \
91 ${@bb.utils.filter('DISTRO_FEATURES', 'alsa vulkan pulseaudio', d)} \
92 ${PIPEWIRE_SESSION_MANAGER} \
93 ${FFMPEG_AVAILABLE} gstreamer jack libusb pw-cat raop sndfile v4l2 udev volume \
94"
95
96# "jack" and "pipewire-jack" packageconfigs cannot be both enabled,
97# since "jack" imports libjack, and "pipewire-jack" generates
98# libjack.so* files, thus colliding with the libpack package. This
99# is why these two are marked in their respective packageconfigs
100# as being in conflict.
101PACKAGECONFIG[alsa] = "-Dalsa=enabled,-Dalsa=disabled,alsa-lib udev,,pipewire-alsa pipewire-alsa-card-profile"
102PACKAGECONFIG[avahi] = "-Davahi=enabled,-Davahi=disabled,avahi"
103PACKAGECONFIG[bluez] = "-Dbluez5=enabled,-Dbluez5=disabled,bluez5 sbc"
104PACKAGECONFIG[bluez-aac] = "-Dbluez5-codec-aac=enabled,-Dbluez5-codec-aac=disabled,fdk-aac"
105PACKAGECONFIG[docs] = "-Ddocs=enabled,-Ddocs=disabled,doxygen-native graphviz-native"
106PACKAGECONFIG[ffmpeg] = "-Dffmpeg=enabled,-Dffmpeg=disabled,ffmpeg"
107PACKAGECONFIG[gstreamer] = "-Dgstreamer=enabled,-Dgstreamer=disabled,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base,,gstreamer1.0-pipewire"
108PACKAGECONFIG[jack] = "-Djack=enabled,-Djack=disabled,jack,,,pipewire-jack"
109PACKAGECONFIG[libcamera] = "-Dlibcamera=enabled,-Dlibcamera=disabled,libcamera libdrm"
110PACKAGECONFIG[libcanberra] = "-Dlibcanberra=enabled,-Dlibcanberra=disabled,libcanberra"
111PACKAGECONFIG[libusb] = "-Dlibusb=enabled,-Dlibusb=disabled,libusb"
112PACKAGECONFIG[media-session] = ",,,pipewire-media-session,,wireplumber"
113PACKAGECONFIG[pulseaudio] = "-Dlibpulse=enabled,-Dlibpulse=disabled,pulseaudio,,pipewire-pulse"
114PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=enabled,-Dpipewire-alsa=disabled,alsa-lib"
115PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=enabled -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=disabled,jack,,pipewire-jack,jack"
116PACKAGECONFIG[pw-cat] = "-Dpw-cat=enabled,-Dpw-cat=disabled"
117PACKAGECONFIG[raop] = "-Draop=enabled,-Draop=disabled,openssl"
118PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,libsdl2"
119PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1"
120PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd"
121PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=enabled,-Dsystemd-system-service=disabled,systemd"
122# "systemd-user-service" packageconfig will only install service
123# files to rootfs but not enable them as systemd.bbclass
124# currently lacks the feature of enabling user services.
125PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=enabled,-Dsystemd-user-service=disabled,systemd"
126# pw-cat needs sndfile packageconfig to be enabled
127PACKAGECONFIG[udev] = "-Dudev=enabled,-Dudev=disabled,udev"
128PACKAGECONFIG[v4l2] = "-Dv4l2=enabled,-Dv4l2=disabled,udev"
129PACKAGECONFIG[volume] = "-Dvolume=enabled,-Dvolume=disabled"
130PACKAGECONFIG[vulkan] = "-Dvulkan=enabled,-Dvulkan=disabled,vulkan-headers vulkan-loader"
131PACKAGECONFIG[webrtc-echo-cancelling] = "-Decho-cancel-webrtc=enabled,-Decho-cancel-webrtc=disabled,webrtc-audio-processing"
132PACKAGECONFIG[wireplumber] = ",,,wireplumber,,media-session"
133
134PACKAGESPLITFUNCS:prepend = " split_dynamic_packages "
135PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends "
136
137SPA_SUBDIR = "spa-0.2"
138PW_MODULE_SUBDIR = "pipewire-0.3"
139
140remove_unused_installed_files() {
141 # jack.conf is used by pipewire-jack (not the JACK SPA plugin).
142 # Remove it if pipewire-jack is not built to avoid creating the
143 # pipewire-jack package.
144 if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then
145 rm -f "${D}${datadir}/pipewire/jack.conf"
146 fi
147
148 # minimal.conf is an example of how to minimally configure the
149 # daemon and is not meant to be used for production.
150 rm -f "${D}${datadir}/pipewire/minimal.conf"
151}
152
153do_install[postfuncs] += "remove_unused_installed_files"
154
155python split_dynamic_packages () {
156 # Create packages for each SPA plugin. These plugins are located
157 # in individual subdirectories, so a recursive search is needed.
158 spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}')
159 do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True)
160
161 # Create packages for each PipeWire module.
162 pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}')
163 do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False)
164}
165
166python set_dynamic_metapkg_rdepends () {
167 import os
168 import oe.utils
169
170 # Go through all generated SPA plugin and PipeWire module packages
171 # (excluding the main package and the -meta package itself) and
172 # add them to the -meta package as RDEPENDS.
173
174 base_pn = d.getVar('PN')
175
176 spa_pn = base_pn + '-spa-plugins'
177 spa_metapkg = spa_pn + '-meta'
178
179 pw_module_pn = base_pn + '-modules'
180 pw_module_metapkg = pw_module_pn + '-meta'
181
182 d.setVar('ALLOW_EMPTY:' + spa_metapkg, "1")
183 d.setVar('FILES:' + spa_metapkg, "")
184
185 d.setVar('ALLOW_EMPTY:' + pw_module_metapkg, "1")
186 d.setVar('FILES:' + pw_module_metapkg, "")
187
188 blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ]
189 spa_metapkg_rdepends = []
190 pw_module_metapkg_rdepends = []
191 pkgdest = d.getVar('PKGDEST')
192
193 for pkg in oe.utils.packages_filter_out_system(d):
194 if pkg in blacklist:
195 continue
196
197 is_spa_pkg = pkg.startswith(spa_pn)
198 is_pw_module_pkg = pkg.startswith(pw_module_pn)
199 if not is_spa_pkg and not is_pw_module_pkg:
200 continue
201
202 if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends:
203 continue
204
205 # See if the package is empty by looking at the contents of its
206 # PKGDEST subdirectory. If this subdirectory is empty, then then
207 # package is empty as well. Empty packages do not get added to
208 # the meta package's RDEPENDS.
209 pkgdir = os.path.join(pkgdest, pkg)
210 if os.path.exists(pkgdir):
211 dir_contents = os.listdir(pkgdir) or []
212 else:
213 dir_contents = []
214 is_empty = len(dir_contents) == 0
215 if not is_empty:
216 if is_spa_pkg:
217 spa_metapkg_rdepends.append(pkg)
218 if is_pw_module_pkg:
219 pw_module_metapkg_rdepends.append(pkg)
220
221 d.setVar('RDEPENDS:' + spa_metapkg, ' '.join(spa_metapkg_rdepends))
222 d.setVar('DESCRIPTION:' + spa_metapkg, spa_pn + ' meta package')
223
224 d.setVar('RDEPENDS:' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends))
225 d.setVar('DESCRIPTION:' + pw_module_metapkg, pw_module_pn + ' meta package')
226}
227
228PACKAGES =+ "\
229 libpipewire \
230 ${PN}-tools \
231 ${PN}-pulse \
232 ${PN}-alsa \
233 ${PN}-jack \
234 ${PN}-spa-plugins \
235 ${PN}-spa-plugins-meta \
236 ${PN}-spa-tools \
237 ${PN}-modules \
238 ${PN}-modules-meta \
239 ${PN}-alsa-card-profile \
240 ${PN}-v4l2 \
241 gstreamer1.0-pipewire \
242"
243
244PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*"
245
246SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'systemd-system-service', 'pipewire.service', '', d)}"
247CONFFILES:${PN} += "${datadir}/pipewire/pipewire.conf"
248FILES:${PN} = " \
249 ${datadir}/pipewire \
250 ${systemd_system_unitdir}/pipewire* \
251 ${systemd_user_unitdir}/pipewire* \
252 ${bindir}/pipewire \
253 ${bindir}/pipewire-avb \
254"
255
256RRECOMMENDS:${PN}:class-target += " \
257 pipewire-modules-meta \
258 pipewire-spa-plugins-meta \
259"
260
261FILES:${PN}-dev += " \
262 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \
263"
264
265CONFFILES:libpipewire += "${datadir}/pipewire/client.conf"
266FILES:libpipewire = " \
267 ${datadir}/pipewire/client.conf \
268 ${libdir}/libpipewire-*.so.* \
269"
270# Add the bare minimum modules and plugins required to be able
271# to use libpipewire. Without these, it is essentially unusable.
272RDEPENDS:libpipewire += " \
273 ${PN}-modules-client-node \
274 ${PN}-modules-protocol-native \
275 ${PN}-spa-plugins-support \
276"
277
278FILES:${PN}-tools = " \
279 ${bindir}/pw-cat \
280 ${bindir}/pw-cli \
281 ${bindir}/pw-dot \
282 ${bindir}/pw-dsdplay \
283 ${bindir}/pw-dump \
284 ${bindir}/pw-link \
285 ${bindir}/pw-loopback \
286 ${bindir}/pw-metadata \
287 ${bindir}/pw-mididump \
288 ${bindir}/pw-midiplay \
289 ${bindir}/pw-midirecord \
290 ${bindir}/pw-mon \
291 ${bindir}/pw-play \
292 ${bindir}/pw-profiler \
293 ${bindir}/pw-record \
294 ${bindir}/pw-reserve \
295 ${bindir}/pw-top \
296"
297
298# This is a shim daemon that is intended to be used as a
299# drop-in PulseAudio replacement, providing a pulseaudio-compatible
300# socket that can be used by applications that use libpulse.
301CONFFILES:${PN}-pulse += "${datadir}/pipewire/pipewire-pulse.conf"
302FILES:${PN}-pulse = " \
303 ${datadir}/pipewire/pipewire-pulse.conf \
304 ${systemd_system_unitdir}/pipewire-pulse.* \
305 ${systemd_user_unitdir}/pipewire-pulse.* \
306 ${bindir}/pipewire-pulse \
307"
308RDEPENDS:${PN}-pulse += " \
309 ${PN}-modules-protocol-pulse \
310"
311
312# ALSA plugin to redirect audio to pipewire.
313FILES:${PN}-alsa = "\
314 ${libdir}/alsa-lib/* \
315 ${datadir}/alsa/alsa.conf.d/* \
316"
317
318# JACK drop-in libraries to redirect audio to pipewire.
319CONFFILES:${PN}-jack = "${datadir}/pipewire/jack.conf"
320FILES:${PN}-jack = "\
321 ${bindir}/pw-jack \
322 ${datadir}/pipewire/jack.conf \
323 ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \
324"
325
326# Dynamic SPA plugin packages (see set_dynamic_metapkg_rdepends).
327FILES:${PN}-spa-plugins = ""
328RRECOMMENDS:${PN}-spa-plugins += "${PN}-spa-plugins-meta"
329
330FILES:${PN}-spa-plugins-bluez5 += " \
331 ${datadir}/${SPA_SUBDIR}/bluez5/* \
332"
333
334FILES:${PN}-spa-tools = " \
335 ${bindir}/spa-* \
336"
337
338# Dynamic PipeWire module packages (see set_dynamic_metapkg_rdepends).
339FILES:${PN}-modules = ""
340RRECOMMENDS:${PN}-modules += "${PN}-modules-meta"
341
342CONFFILES:${PN}-modules-rt = "${datadir}/pipewire/client-rt.conf"
343FILES:${PN}-modules-rt += " \
344 ${datadir}/pipewire/client-rt.conf \
345 "
346
347CONFFILES:${PN}-modules-filter-chain = "${datadir}/pipewire/filter-chain/*"
348FILES:${PN}-modules-filter-chain += " \
349 ${datadir}/pipewire/filter-chain/* \
350"
351
352FILES:${PN}-alsa-card-profile = " \
353 ${datadir}/alsa-card-profile/* \
354 ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \
355"
356
357# V4L2 interface emulator for sending/receiving data between PipeWire and V4L2 applications.
358FILES:${PN}-v4l2 += " \
359 ${bindir}/pw-v4l2 \
360 ${libdir}/${PW_MODULE_SUBDIR}/v4l2/libpw-v4l2.so \
361"
362
363FILES:gstreamer1.0-pipewire = " \
364 ${libdir}/gstreamer-1.0/* \
365"
366
367BBCLASSEXTEND = "native nativesdk"