Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 1 | SUMMARY = "Session / policy manager implementation for PipeWire" |
| 2 | HOMEPAGE = "https://gitlab.freedesktop.org/pipewire/wireplumber" |
| 3 | BUGTRACKER = "https://gitlab.freedesktop.org/pipewire/wireplumber/issues" |
| 4 | SECTION = "multimedia" |
| 5 | |
| 6 | LICENSE = "MIT" |
| 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=17d1fe479cdec331eecbc65d26bc7e77" |
| 8 | |
| 9 | DEPENDS = "glib-2.0 glib-2.0-native lua pipewire \ |
| 10 | ${@bb.utils.contains("DISTRO_FEATURES", "gobject-introspection-data", "python3-native python3-lxml-native doxygen-native", "", d)} \ |
| 11 | " |
| 12 | |
Patrick Williams | 169d7bc | 2024-01-05 11:33:25 -0600 | [diff] [blame] | 13 | SRCREV = "d3eb77b292655cef333a8f4cab4e861415bc37c2" |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 14 | SRC_URI = " \ |
| 15 | git://gitlab.freedesktop.org/pipewire/wireplumber.git;branch=master;protocol=https \ |
| 16 | file://90-OE-disable-session-dbus-dependent-features.lua \ |
| 17 | " |
| 18 | |
| 19 | S = "${WORKDIR}/git" |
| 20 | |
| 21 | inherit meson pkgconfig gobject-introspection systemd |
| 22 | |
| 23 | GIR_MESON_ENABLE_FLAG = 'enabled' |
| 24 | GIR_MESON_DISABLE_FLAG = 'disabled' |
| 25 | |
| 26 | # Enable system-lua to let wireplumber use OE's lua. |
| 27 | # Documentation needs python-sphinx, which is not in oe-core or meta-python2 for now. |
| 28 | # elogind is not (yet) available in OE, so disable support. |
| 29 | EXTRA_OEMESON += " \ |
| 30 | -Ddoc=disabled \ |
| 31 | -Dsystem-lua=true \ |
| 32 | -Delogind=disabled \ |
| 33 | -Dsystemd-system-unit-dir=${systemd_system_unitdir} \ |
| 34 | -Dsystemd-user-unit-dir=${systemd_user_unitdir} \ |
| 35 | -Dtests=false \ |
| 36 | " |
| 37 | |
| 38 | PACKAGECONFIG ??= " dbus \ |
| 39 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-system-service systemd-user-service', '', d)} \ |
| 40 | " |
| 41 | |
| 42 | PACKAGECONFIG[systemd] = "-Dsystemd=enabled,-Dsystemd=disabled,systemd" |
| 43 | PACKAGECONFIG[systemd-system-service] = "-Dsystemd-system-service=true,-Dsystemd-system-service=false,systemd" |
| 44 | # "systemd-user-service" packageconfig will only install service |
| 45 | # files to rootfs but not enable them as systemd.bbclass |
| 46 | # currently lacks the feature of enabling user services. |
| 47 | PACKAGECONFIG[systemd-user-service] = "-Dsystemd-user-service=true,-Dsystemd-user-service=false,systemd" |
| 48 | PACKAGECONFIG[dbus] = "" |
| 49 | |
| 50 | PACKAGESPLITFUNCS:prepend = " split_dynamic_packages " |
| 51 | PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends " |
| 52 | |
| 53 | WP_MODULE_SUBDIR = "wireplumber-0.4" |
| 54 | |
| 55 | do_install:append() { |
| 56 | if ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'false', 'true', d)}; then |
| 57 | install -m 0644 ${WORKDIR}/90-OE-disable-session-dbus-dependent-features.lua ${D}${datadir}/wireplumber/main.lua.d |
| 58 | fi |
| 59 | } |
| 60 | |
| 61 | python split_dynamic_packages () { |
| 62 | # Create packages for each WirePlumber module. |
| 63 | wp_module_libdir = d.expand('${libdir}/${WP_MODULE_SUBDIR}') |
| 64 | do_split_packages(d, wp_module_libdir, r'^libwireplumber-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'WirePlumber %s module', extra_depends='', recursive=False) |
| 65 | } |
| 66 | |
| 67 | python set_dynamic_metapkg_rdepends () { |
| 68 | import os |
| 69 | import oe.utils |
| 70 | |
| 71 | # Go through all generated WirePlumber module packages |
| 72 | # (excluding the main package and the -meta package itself) |
| 73 | # and add them to the -meta package as RDEPENDS. |
| 74 | |
| 75 | base_pn = d.getVar('PN') |
| 76 | |
| 77 | wp_module_pn = base_pn + '-modules' |
| 78 | wp_module_metapkg = wp_module_pn + '-meta' |
| 79 | |
| 80 | d.setVar('ALLOW_EMPTY:' + wp_module_metapkg, "1") |
| 81 | d.setVar('FILES:' + wp_module_metapkg, "") |
| 82 | |
| 83 | blacklist = [ wp_module_pn, wp_module_metapkg ] |
| 84 | wp_module_metapkg_rdepends = [] |
| 85 | pkgdest = d.getVar('PKGDEST') |
| 86 | |
| 87 | for pkg in oe.utils.packages_filter_out_system(d): |
| 88 | if pkg in blacklist: |
| 89 | continue |
| 90 | |
| 91 | is_wp_module_pkg = pkg.startswith(wp_module_pn) |
| 92 | if not is_wp_module_pkg: |
| 93 | continue |
| 94 | |
| 95 | if pkg in wp_module_metapkg_rdepends: |
| 96 | continue |
| 97 | |
| 98 | # See if the package is empty by looking at the contents of its |
| 99 | # PKGDEST subdirectory. If this subdirectory is empty, then then |
| 100 | # package is empty as well. Empty packages do not get added to |
| 101 | # the meta package's RDEPENDS. |
| 102 | pkgdir = os.path.join(pkgdest, pkg) |
| 103 | if os.path.exists(pkgdir): |
| 104 | dir_contents = os.listdir(pkgdir) or [] |
| 105 | else: |
| 106 | dir_contents = [] |
| 107 | is_empty = len(dir_contents) == 0 |
| 108 | if not is_empty: |
| 109 | if is_wp_module_pkg: |
| 110 | wp_module_metapkg_rdepends.append(pkg) |
| 111 | |
| 112 | d.setVar('RDEPENDS:' + wp_module_metapkg, ' '.join(wp_module_metapkg_rdepends)) |
| 113 | d.setVar('DESCRIPTION:' + wp_module_metapkg, wp_module_pn + ' meta package') |
| 114 | } |
| 115 | |
| 116 | PACKAGES =+ "\ |
| 117 | libwireplumber \ |
| 118 | ${PN}-default-config \ |
| 119 | ${PN}-scripts \ |
| 120 | ${PN}-modules \ |
| 121 | ${PN}-modules-meta \ |
| 122 | " |
| 123 | |
| 124 | PACKAGES_DYNAMIC = "^${PN}-modules.*" |
| 125 | |
| 126 | CONFFILES:${PN} += " \ |
| 127 | ${datadir}/wireplumber/wireplumber.conf \ |
| 128 | ${datadir}/wireplumber/*.lua.d/* \ |
| 129 | " |
| 130 | # Add pipewire to RRECOMMENDS, since WirePlumber expects a PipeWire daemon to |
| 131 | # be present. While in theory any application that uses libpipewire can configure |
| 132 | # itself to become a daemon, in practice, the PipeWire daemon is used. |
| 133 | RRECOMMENDS:${PN} += "pipewire ${PN}-scripts ${PN}-modules-meta" |
| 134 | |
| 135 | FILES:${PN} += "${systemd_user_unitdir} ${systemd_system_unitdir} ${datadir}/zsh" |
| 136 | |
| 137 | FILES:libwireplumber = " \ |
| 138 | ${libdir}/libwireplumber-*.so.* \ |
| 139 | " |
| 140 | |
| 141 | FILES:${PN}-scripts += "${datadir}/wireplumber/scripts/*" |
| 142 | |
| 143 | # Dynamic packages (see set_dynamic_metapkg_rdepends). |
| 144 | FILES:${PN}-modules = "" |
| 145 | RRECOMMENDS:${PN}-modules += "${PN}-modules-meta" |