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