Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [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 | AUTHOR = "George Kiagiadakis <george.kiagiadakis@collabora.com>" |
| 5 | SECTION = "multimedia" |
| 6 | |
| 7 | LICENSE = "MIT" |
| 8 | LIC_FILES_CHKSUM = "file://LICENSE;md5=17d1fe479cdec331eecbc65d26bc7e77" |
| 9 | |
| 10 | DEPENDS = "glib-2.0 glib-2.0-native lua pipewire \ |
| 11 | ${@bb.utils.contains("DISTRO_FEATURES", "gobject-introspection-data", "python3-native python3-lxml-native doxygen-native", "", d)} \ |
| 12 | " |
| 13 | |
| 14 | SRCREV = "80b3559963f0ad40a7bfa6c23b0098275c0b5ebe" |
| 15 | SRC_URI = "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 ??= "\ |
| 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 | |
| 49 | PACKAGESPLITFUNCS:prepend = " split_dynamic_packages " |
| 50 | PACKAGESPLITFUNCS:append = " set_dynamic_metapkg_rdepends " |
| 51 | |
| 52 | WP_MODULE_SUBDIR = "wireplumber-0.4" |
| 53 | |
| 54 | add_custom_lua_config_scripts() { |
| 55 | install -m 0644 ${WORKDIR}/90-OE-disable-session-dbus-dependent-features.lua ${D}${datadir}/wireplumber/main.lua.d |
| 56 | } |
| 57 | |
| 58 | do_install[postfuncs] += "add_custom_lua_config_scripts" |
| 59 | |
| 60 | python split_dynamic_packages () { |
| 61 | # Create packages for each WirePlumber module. |
| 62 | wp_module_libdir = d.expand('${libdir}/${WP_MODULE_SUBDIR}') |
| 63 | do_split_packages(d, wp_module_libdir, r'^libwireplumber-module-(.*)\.so$', d.expand('${PN}-modules-%s'), 'WirePlumber %s module', extra_depends='', recursive=False) |
| 64 | } |
| 65 | |
| 66 | python set_dynamic_metapkg_rdepends () { |
| 67 | import os |
| 68 | import oe.utils |
| 69 | |
| 70 | # Go through all generated WirePlumber module packages |
| 71 | # (excluding the main package and the -meta package itself) |
| 72 | # and add them to the -meta package as RDEPENDS. |
| 73 | |
| 74 | base_pn = d.getVar('PN') |
| 75 | |
| 76 | wp_module_pn = base_pn + '-modules' |
| 77 | wp_module_metapkg = wp_module_pn + '-meta' |
| 78 | |
| 79 | d.setVar('ALLOW_EMPTY:' + wp_module_metapkg, "1") |
| 80 | d.setVar('FILES:' + wp_module_metapkg, "") |
| 81 | |
| 82 | blacklist = [ wp_module_pn, wp_module_metapkg ] |
| 83 | wp_module_metapkg_rdepends = [] |
| 84 | pkgdest = d.getVar('PKGDEST') |
| 85 | |
| 86 | for pkg in oe.utils.packages_filter_out_system(d): |
| 87 | if pkg in blacklist: |
| 88 | continue |
| 89 | |
| 90 | is_wp_module_pkg = pkg.startswith(wp_module_pn) |
| 91 | if not is_wp_module_pkg: |
| 92 | continue |
| 93 | |
| 94 | if pkg in wp_module_metapkg_rdepends: |
| 95 | continue |
| 96 | |
| 97 | # See if the package is empty by looking at the contents of its |
| 98 | # PKGDEST subdirectory. If this subdirectory is empty, then then |
| 99 | # package is empty as well. Empty packages do not get added to |
| 100 | # the meta package's RDEPENDS. |
| 101 | pkgdir = os.path.join(pkgdest, pkg) |
| 102 | if os.path.exists(pkgdir): |
| 103 | dir_contents = os.listdir(pkgdir) or [] |
| 104 | else: |
| 105 | dir_contents = [] |
| 106 | is_empty = len(dir_contents) == 0 |
| 107 | if not is_empty: |
| 108 | if is_wp_module_pkg: |
| 109 | wp_module_metapkg_rdepends.append(pkg) |
| 110 | |
| 111 | d.setVar('RDEPENDS:' + wp_module_metapkg, ' '.join(wp_module_metapkg_rdepends)) |
| 112 | d.setVar('DESCRIPTION:' + wp_module_metapkg, wp_module_pn + ' meta package') |
| 113 | } |
| 114 | |
| 115 | PACKAGES =+ "\ |
| 116 | libwireplumber \ |
| 117 | ${PN}-default-config \ |
| 118 | ${PN}-scripts \ |
| 119 | ${PN}-modules \ |
| 120 | ${PN}-modules-meta \ |
| 121 | " |
| 122 | |
| 123 | PACKAGES_DYNAMIC = "^${PN}-modules.*" |
| 124 | |
| 125 | SYSTEMD_SERVICE:${PN} = "wireplumber.service" |
| 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}" |
| 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" |