pipewire_1.4.9.bb 16 KB

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