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