Andrew Geissler | 97771a3 | 2021-03-05 15:23:11 -0600 | [diff] [blame] | 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 | LICENSE = "MIT" |
| 6 | LIC_FILES_CHKSUM = " \ |
| 7 | file://LICENSE;md5=e2c0b7d86d04e716a3c4c9ab34260e69 \ |
| 8 | file://COPYING;md5=97be96ca4fab23e9657ffa590b931c1a \ |
| 9 | " |
| 10 | SECTION = "multimedia" |
| 11 | |
| 12 | DEPENDS = "dbus" |
| 13 | |
| 14 | SRCREV = "22d563720a7f6ba7bdf59950f8c14488d80dfa95" |
| 15 | SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=master;protocol=https" |
| 16 | |
| 17 | S = "${WORKDIR}/git" |
| 18 | |
| 19 | inherit meson pkgconfig systemd manpages gettext useradd |
| 20 | |
| 21 | USERADD_PACKAGES = "${PN}" |
| 22 | |
| 23 | GROUPADD_PARAM_${PN} = "--system pipewire" |
| 24 | |
| 25 | USERADD_PARAM_${PN} = "--system --home / --no-create-home \ |
| 26 | --comment 'PipeWire multimedia daemon' \ |
| 27 | --gid pipewire --groups audio,video \ |
| 28 | pipewire" |
| 29 | |
| 30 | # For "EVL", look up https://evlproject.org/ . It involves |
| 31 | # a specially prepared kernel, and is currently unavailable |
| 32 | # in Yocto. |
| 33 | # FFmpeg and Vulkan aren't really supported - at the current |
| 34 | # stage (version 0.3.22), these are just experiments, not |
| 35 | # actual features. |
| 36 | # libcamera support currently does not build successfully. |
| 37 | # systemd user service files are disabled because per-user |
| 38 | # PipeWire instances aren't really something that makes |
| 39 | # much sense in an embedded environment. A system-wide |
| 40 | # instance does. |
| 41 | EXTRA_OEMESON += " \ |
| 42 | -Daudiotestsrc=true \ |
| 43 | -Devl=false \ |
| 44 | -Dsystemd-user-service=false \ |
| 45 | -Dtests=false \ |
| 46 | -Dudevrulesdir=${nonarch_base_libdir}/udev/rules.d/ \ |
| 47 | -Dvideotestsrc=true \ |
| 48 | -Dffmpeg=false \ |
| 49 | -Dvulkan=false \ |
| 50 | -Dlibcamera=false \ |
| 51 | " |
| 52 | |
| 53 | PACKAGECONFIG ??= "\ |
| 54 | ${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)} \ |
| 55 | ${@bb.utils.filter('DISTRO_FEATURES', 'alsa systemd', d)} \ |
| 56 | gstreamer jack v4l2 \ |
| 57 | " |
| 58 | |
| 59 | # "jack" and "pipewire-jack" packageconfigs cannot be both enabled, |
| 60 | # since "jack" imports libjack, and "pipewire-jack" generates |
| 61 | # libjack.so* files, thus colliding with the libpack package. This |
| 62 | # is why these two are marked in their respective packageconfigs |
| 63 | # as being in conflict. |
| 64 | |
| 65 | PACKAGECONFIG[alsa] = "-Dalsa=true,-Dalsa=false,alsa-lib udev" |
| 66 | PACKAGECONFIG[bluez] = "-Dbluez5=true,-Dbluez5=false,bluez5 sbc" |
| 67 | PACKAGECONFIG[docs] = "-Ddocs=true,-Ddocs=false,doxygen" |
| 68 | PACKAGECONFIG[gstreamer] = "-Dgstreamer=true,-Dgstreamer=false,glib-2.0 gstreamer1.0 gstreamer1.0-plugins-base" |
| 69 | PACKAGECONFIG[jack] = "-Djack=true,-Djack=false,jack,,,pipewire-jack" |
| 70 | PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxml-parser-perl-native" |
| 71 | PACKAGECONFIG[sdl2] = "-Dsdl2=enabled,-Dsdl2=disabled,virtual/libsdl2" |
| 72 | PACKAGECONFIG[sndfile] = "-Dsndfile=enabled,-Dsndfile=disabled,libsndfile1" |
| 73 | PACKAGECONFIG[systemd] = "-Dsystemd=true -Dsystemd-system-service=true ,-Dsystemd=false -Dsystemd-system-service=false,systemd" |
| 74 | PACKAGECONFIG[v4l2] = "-Dv4l2=true,-Dv4l2=false,udev" |
| 75 | PACKAGECONFIG[pipewire-alsa] = "-Dpipewire-alsa=true,-Dpipewire-alsa=false,alsa-lib" |
| 76 | PACKAGECONFIG[pipewire-jack] = "-Dpipewire-jack=true -Dlibjack-path=${libdir}/${PW_MODULE_SUBDIR}/jack,-Dpipewire-jack=false,jack,,,jack" |
| 77 | |
| 78 | PACKAGESPLITFUNCS_prepend = " split_dynamic_packages " |
| 79 | PACKAGESPLITFUNCS_append = " set_dynamic_metapkg_rdepends " |
| 80 | |
| 81 | SPA_SUBDIR = "spa-0.2" |
| 82 | PW_MODULE_SUBDIR = "pipewire-0.3" |
| 83 | |
| 84 | remove_unused_installed_files() { |
| 85 | # jack.conf is used by pipewire-jack (not the JACK SPA plugin). |
| 86 | # Remove it if pipewire-jack is not built to avoid creating the |
| 87 | # pipewire-jack package. |
| 88 | if ${@bb.utils.contains('PACKAGECONFIG', 'pipewire-jack', 'false', 'true', d)}; then |
| 89 | rm -f "${D}${sysconfdir}/pipewire/jack.conf" |
| 90 | fi |
| 91 | } |
| 92 | |
| 93 | do_install[postfuncs] += "remove_unused_installed_files" |
| 94 | |
| 95 | python split_dynamic_packages () { |
| 96 | # Create packages for each SPA plugin. These plugins are located |
| 97 | # in individual subdirectories, so a recursive search is needed. |
| 98 | spa_libdir = d.expand('${libdir}/${SPA_SUBDIR}') |
| 99 | do_split_packages(d, spa_libdir, r'^libspa-(.*)\.so$', d.expand('${PN}-spa-plugins-%s'), 'PipeWire SPA plugin for %s', extra_depends='', recursive=True) |
| 100 | |
| 101 | # Create packages for each PipeWire module. |
| 102 | pw_module_libdir = d.expand('${libdir}/${PW_MODULE_SUBDIR}') |
| 103 | do_split_packages(d, pw_module_libdir, r'^libpipewire-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'PipeWire %s module', extra_depends='', recursive=False) |
| 104 | } |
| 105 | |
| 106 | python set_dynamic_metapkg_rdepends () { |
| 107 | import os |
| 108 | import oe.utils |
| 109 | |
| 110 | # Go through all generated SPA plugin and PipeWire module packages |
| 111 | # (excluding the main package and the -meta package itself) and |
| 112 | # add them to the -meta package as RDEPENDS. |
| 113 | |
| 114 | base_pn = d.getVar('PN') |
| 115 | |
| 116 | spa_pn = base_pn + '-spa-plugins' |
| 117 | spa_metapkg = spa_pn + '-meta' |
| 118 | |
| 119 | pw_module_pn = base_pn + '-modules' |
| 120 | pw_module_metapkg = pw_module_pn + '-meta' |
| 121 | |
| 122 | d.setVar('ALLOW_EMPTY_' + spa_metapkg, "1") |
| 123 | d.setVar('FILES_' + spa_metapkg, "") |
| 124 | |
| 125 | d.setVar('ALLOW_EMPTY_' + pw_module_metapkg, "1") |
| 126 | d.setVar('FILES_' + pw_module_metapkg, "") |
| 127 | |
| 128 | blacklist = [ spa_pn, spa_metapkg, pw_module_pn, pw_module_metapkg ] |
| 129 | spa_metapkg_rdepends = [] |
| 130 | pw_module_metapkg_rdepends = [] |
| 131 | pkgdest = d.getVar('PKGDEST') |
| 132 | |
| 133 | for pkg in oe.utils.packages_filter_out_system(d): |
| 134 | if pkg in blacklist: |
| 135 | continue |
| 136 | |
| 137 | is_spa_pkg = pkg.startswith(spa_pn) |
| 138 | is_pw_module_pkg = pkg.startswith(pw_module_pn) |
| 139 | if not is_spa_pkg and not is_pw_module_pkg: |
| 140 | continue |
| 141 | |
| 142 | if pkg in spa_metapkg_rdepends or pkg in pw_module_metapkg_rdepends: |
| 143 | continue |
| 144 | |
| 145 | # See if the package is empty by looking at the contents of its |
| 146 | # PKGDEST subdirectory. If this subdirectory is empty, then then |
| 147 | # package is empty as well. Empty packages do not get added to |
| 148 | # the meta package's RDEPENDS. |
| 149 | pkgdir = os.path.join(pkgdest, pkg) |
| 150 | if os.path.exists(pkgdir): |
| 151 | dir_contents = os.listdir(pkgdir) or [] |
| 152 | else: |
| 153 | dir_contents = [] |
| 154 | is_empty = len(dir_contents) == 0 |
| 155 | if not is_empty: |
| 156 | if is_spa_pkg: |
| 157 | spa_metapkg_rdepends.append(pkg) |
| 158 | if is_pw_module_pkg: |
| 159 | pw_module_metapkg_rdepends.append(pkg) |
| 160 | |
| 161 | d.setVar('RDEPENDS_' + spa_metapkg, ' '.join(spa_metapkg_rdepends)) |
| 162 | d.setVar('DESCRIPTION_' + spa_metapkg, spa_pn + ' meta package') |
| 163 | |
| 164 | d.setVar('RDEPENDS_' + pw_module_metapkg, ' '.join(pw_module_metapkg_rdepends)) |
| 165 | d.setVar('DESCRIPTION_' + pw_module_metapkg, pw_module_pn + ' meta package') |
| 166 | } |
| 167 | |
| 168 | PACKAGES =+ "\ |
| 169 | libpipewire \ |
| 170 | ${PN}-tools \ |
| 171 | ${PN}-pulse \ |
| 172 | ${PN}-alsa \ |
| 173 | ${PN}-jack \ |
| 174 | ${PN}-media-session \ |
| 175 | ${PN}-spa-plugins \ |
| 176 | ${PN}-spa-plugins-meta \ |
| 177 | ${PN}-spa-tools \ |
| 178 | ${PN}-modules \ |
| 179 | ${PN}-modules-meta \ |
| 180 | ${PN}-alsa-card-profile \ |
| 181 | gstreamer1.0-pipewire \ |
| 182 | " |
| 183 | |
| 184 | PACKAGES_DYNAMIC = "^${PN}-spa-plugins.* ^${PN}-modules.*" |
| 185 | |
| 186 | SYSTEMD_SERVICE_${PN} = "pipewire.service" |
| 187 | CONFFILES_${PN} += "${sysconfdir}/pipewire/pipewire.conf" |
| 188 | FILES_${PN} = " \ |
| 189 | ${sysconfdir}/pipewire/pipewire.conf \ |
| 190 | ${systemd_user_unitdir}/pipewire.* \ |
| 191 | ${bindir}/pipewire \ |
| 192 | " |
| 193 | |
| 194 | FILES_${PN}-dev += " \ |
| 195 | ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so \ |
| 196 | " |
| 197 | |
| 198 | CONFFILES_libpipewire += "${sysconfdir}/pipewire/client.conf" |
| 199 | FILES_libpipewire = " \ |
| 200 | ${sysconfdir}/pipewire/client.conf \ |
| 201 | ${libdir}/libpipewire-*.so.* \ |
| 202 | " |
| 203 | # Add the bare minimum modules and plugins required to be able |
| 204 | # to use libpipewire. Without these, it is essentially unusable. |
| 205 | RDEPENDS_libpipewire += " \ |
| 206 | ${PN}-modules-client-node \ |
| 207 | ${PN}-modules-protocol-native \ |
| 208 | ${PN}-spa-plugins-support \ |
| 209 | " |
| 210 | |
| 211 | FILES_${PN}-tools = " \ |
| 212 | ${bindir}/pw-* \ |
| 213 | " |
| 214 | |
| 215 | # This is a shim daemon that is intended to be used as a |
| 216 | # drop-in PulseAudio replacement, providing a pulseaudio-compatible |
| 217 | # socket that can be used by applications that use libpulse. |
| 218 | CONFFILES_${PN}-pulse += "${sysconfdir}/pipewire/pipewire-pulse.conf" |
| 219 | FILES_${PN}-pulse = " \ |
| 220 | ${sysconfdir}/pipewire/pipewire-pulse.conf \ |
| 221 | ${systemd_user_unitdir}/pipewire-pulse.* \ |
| 222 | ${bindir}/pipewire-pulse \ |
| 223 | " |
| 224 | RDEPENDS_${PN}-pulse += " \ |
| 225 | ${PN}-modules-protocol-pulse \ |
| 226 | " |
| 227 | |
| 228 | # alsa plugin to redirect audio to pipewire |
| 229 | FILES_${PN}-alsa = "\ |
| 230 | ${libdir}/alsa-lib/* \ |
| 231 | ${datadir}/alsa/alsa.conf.d/* \ |
| 232 | " |
| 233 | |
| 234 | # jack drop-in libraries to redirect audio to pipewire |
| 235 | CONFFILES_${PN}-jack = "${sysconfdir}/pipewire/jack.conf" |
| 236 | FILES_${PN}-jack = "\ |
| 237 | ${sysconfdir}/pipewire/jack.conf \ |
| 238 | ${libdir}/${PW_MODULE_SUBDIR}/jack/libjack*.so.* \ |
| 239 | " |
| 240 | |
| 241 | # Example session manager. Not intended for use in production. |
| 242 | CONFFILES_${PN}-media-session = "${sysconfdir}/pipewire/media-session.d/*" |
| 243 | FILES_${PN}-media-session = " \ |
| 244 | ${bindir}/pipewire-media-session \ |
| 245 | ${sysconfdir}/pipewire/media-session.d/* \ |
| 246 | " |
| 247 | RPROVIDES_${PN}-media-session = "virtual/pipewire-sessionmanager" |
| 248 | |
| 249 | # Dynamic packages (see set_dynamic_metapkg_rdepends). |
| 250 | FILES_${PN}-spa-plugins = "" |
| 251 | RRECOMMENDS_${PN}-spa-plugins += "${PN}-spa-plugins-meta" |
| 252 | |
| 253 | FILES_${PN}-spa-tools = " \ |
| 254 | ${bindir}/spa-* \ |
| 255 | " |
| 256 | |
| 257 | # Dynamic packages (see set_dynamic_metapkg_rdepends). |
| 258 | FILES_${PN}-modules = "" |
| 259 | RRECOMMENDS_${PN}-modules += "${PN}-modules-meta" |
| 260 | |
| 261 | CONFFILES_${PN}-modules-rtkit = "${sysconfdir}/pipewire/client-rt.conf" |
| 262 | FILES_${PN}-modules-rtkit += " \ |
| 263 | ${sysconfdir}/pipewire/client-rt.conf \ |
| 264 | " |
| 265 | |
| 266 | FILES_${PN}-alsa-card-profile = " \ |
| 267 | ${datadir}/alsa-card-profile/* \ |
| 268 | ${nonarch_base_libdir}/udev/rules.d/90-pipewire-alsa.rules \ |
| 269 | " |
| 270 | |
| 271 | FILES_gstreamer1.0-pipewire = " \ |
| 272 | ${libdir}/gstreamer-1.0/* \ |
| 273 | " |