summaryrefslogtreecommitdiff
path: root/media-video/wireplumber
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-09-16 22:05:01 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-09-16 22:05:01 +0100
commitcc4618c9ba3d974948ebf340b542d8cb01db2f55 (patch)
tree125ee67bb9e0d548771cf7b61d04bb1f0dc57687 /media-video/wireplumber
parent677b7ba5c317778df2ad7e70df94b9b7eec4adbc (diff)
gentoo resync : 16.09.2021
Diffstat (limited to 'media-video/wireplumber')
-rw-r--r--media-video/wireplumber/Manifest9
-rw-r--r--media-video/wireplumber/files/wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch42
-rw-r--r--media-video/wireplumber/files/wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch28
-rw-r--r--media-video/wireplumber/files/wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch100
-rw-r--r--media-video/wireplumber/files/wireplumber-0.4.2-meson-Build-tests-conditionally.patch41
-rw-r--r--media-video/wireplumber/files/wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch42
-rw-r--r--media-video/wireplumber/metadata.xml17
-rw-r--r--media-video/wireplumber/wireplumber-0.4.2-r1.ebuild89
-rw-r--r--media-video/wireplumber/wireplumber-9999.ebuild81
9 files changed, 449 insertions, 0 deletions
diff --git a/media-video/wireplumber/Manifest b/media-video/wireplumber/Manifest
new file mode 100644
index 000000000000..74193405f87d
--- /dev/null
+++ b/media-video/wireplumber/Manifest
@@ -0,0 +1,9 @@
+AUX wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch 1495 BLAKE2B 2611a44c7602adf962aea0f4ab1871e662034ae86602c827c62d788ab516c392434bd9e5b6e4e180f322ee0e217eed2f7e78376d47a48f5d00e448e965abe201 SHA512 eaee2bd3e3609f896a297d44107bb527009e3898a9a033e5ce61fc69fedab1571403139c4dd2b9a63f6c3ba9db0da8ca7dcb94ec86e634a45ad44ae22018422f
+AUX wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch 1027 BLAKE2B 26af0a13f5cb588587132b839245bdf76c2974d38e28da9e7a3f5e0bce1635e22ee9336d9bffa80950b858d03c5140394a38578b8602fd95ef84172b207fba93 SHA512 fa63fdf61ead8c6efff1d64da80902bdb0994e298021863d1cc7a1425eae233a429a99cfb80a15d583010ab5b9225f8ad3ca9097242d51d4feb3193c1bc03170
+AUX wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch 2567 BLAKE2B adb6cb0d5bdd19bb386838aee18c3f0d2b81194786abcd1e79a27e45492790fbf797e1a92efa11b99405bbac3d339b6e5e4fd761743ff445c21bd92af098dca6 SHA512 90c2adcc4d4e70a3432cb07dd053b37bd925b0807ba49439df41b105c25157a66f5fed5494a072010ff24f2d7b7b065616b99971f17330117b27ea17760cc938
+AUX wireplumber-0.4.2-meson-Build-tests-conditionally.patch 1232 BLAKE2B f828160ff6e86f3a6b693a4e09fcc6f0647d742998777264483906d8974e294fa1fb9522d67c7a12c3893f6182a248cc14c50c785a50115d65a6f0779b615079 SHA512 b89c1519fb10c1b59ea8ed42f24cfff9b03c7024b33fb88ad8d5bfa57042ee6d1baf8f1a17e897b7da97b4fd4b91c04e7a66ee5105762a4ae690998145b20995
+AUX wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch 1466 BLAKE2B bfbec8088c33d38a637cbdc517c1bad3b472b296c6302872cefaa444b1524248ce73b14aef3b9d1d7ef35528b46cadce8dd9a846c2e9b43d8b232f894c58a839 SHA512 4b654808c2e3c9b5b8f401d2874040e32efaa25bfb76cd5080c529c75922685e3466d570bd7278e2b6079f6fa28134e5b493f3d54c26d06993572f7aa08ce142
+DIST wireplumber-0.4.2.tar.gz 332499 BLAKE2B 4747ae405a824b019415188ff1a586d32fc2e97aba6777cd1e403aadf0e44458156d1f8b6dbc706b812a7ea8c873d0f506f2b42817d1bc5312874530edaf7234 SHA512 8ded43fba5de58068516558918d49c86be7d67330e8a14e735561fefadba5e27952d556987b7304dead52b4e2f72a7d9626da0170e768c4702dd164840b08e3c
+EBUILD wireplumber-0.4.2-r1.ebuild 2574 BLAKE2B b6b09c8828e190f7e19f1cc8cfdcf9be23e0d539d797558c33be54b69a956cfbbeb0a7a8c6145e62228152d21acb359c9d144e39ba0cdaab6a1dfa99ac84cc90 SHA512 610e2e83cf5e6acd6a357745c73c88ff0e691da47487004a0e08d9f1d764e1dafae33f990d5980cef6594a2d350cbd57e195667c23a1557e0d7b4c72c0a884ff
+EBUILD wireplumber-9999.ebuild 2187 BLAKE2B 451e20a529c57583f7b39094b46f8c30ec06fd8acc5adc26af4f2cc96ac7c820745d624ebca9e2cf33b5779a25dea4e6c61ed135e4498bc59c9c4ca22d563408 SHA512 3b2462420644bc818095052e29db07dce4fdc71f79635435f34a3951ebdbd3fa606f74161b88aa74795470c6e4f3d101710f6229f267ab64b5ac11f8687e3e98
+MISC metadata.xml 673 BLAKE2B 71a411815b61a970653e39cf33ef56e04268805b98d5d5fbc405f4739b71adee9137e0198bf4ebaad208b4e878ab3087766ee223e1e18aaff90fac14d2c5dc23 SHA512 ba6121c54e9f6208b0b5c471790b005c51105d479a0dd2464563b7320530b3d8c176ff38bdb6c760d3f31a18fb993647244d944a222991110f14508ce63c4a96
diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch b/media-video/wireplumber/files/wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch
new file mode 100644
index 000000000000..a519e4212828
--- /dev/null
+++ b/media-video/wireplumber/files/wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch
@@ -0,0 +1,42 @@
+From 32d96189b807ab53317a33217c661ce4b1ac8e49 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nikl=C4=81vs=20Ko=C4=BCes=C5=86ikovs?=
+ <89q1r14hd@relay.firefox.com>
+Date: Wed, 15 Sep 2021 12:21:40 +0300
+Subject: [PATCH 3/5] bluez: add basic check for nil monitor
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If PipeWire is built without Bluetooth support, then
+
+`monitor = SpaDevice("api.bluez5.enum.dbus", monitor_props)`
+
+will result in a nil monitor. This commit adds a basic sanity check
+to avoid further using the nil variable.
+
+Thanks-to: Pascal Flöschel (initial bug report)
+Thanks-to: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Bug: https://bugs.gentoo.org/813043
+---
+ src/scripts/monitors/bluez.lua | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/scripts/monitors/bluez.lua b/src/scripts/monitors/bluez.lua
+index fc229fa..4066536 100644
+--- a/src/scripts/monitors/bluez.lua
++++ b/src/scripts/monitors/bluez.lua
+@@ -129,5 +129,9 @@ local monitor_props = config.properties or {}
+ monitor_props["api.bluez5.connection-info"] = true
+
+ monitor = SpaDevice("api.bluez5.enum.dbus", monitor_props)
+-monitor:connect("create-object", createDevice)
+-monitor:activate(Feature.SpaDevice.ENABLED)
++if monitor then
++ monitor:connect("create-object", createDevice)
++ monitor:activate(Feature.SpaDevice.ENABLED)
++else
++ Log.message("PipeWire's BlueZ SPA missing or broken. Bluetooth not supported.")
++end
+--
+2.33.0
+
diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch b/media-video/wireplumber/files/wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch
new file mode 100644
index 000000000000..7653de28bbbb
--- /dev/null
+++ b/media-video/wireplumber/files/wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch
@@ -0,0 +1,28 @@
+From 05334c1ec72af68f915ea18e32b230857918f600 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nikl=C4=81vs=20Ko=C4=BCes=C5=86ikovs?=
+ <89q1r14hd@relay.firefox.com>
+Date: Wed, 15 Sep 2021 13:23:45 +0300
+Subject: [PATCH 5/5] lib/wp/device: demote missing SPA warning to message
+
+Warnings can be scary, so best not to scare users with what's likely
+intentional omission of a particular SPA plugin (currently V4L & BlueZ).
+---
+ lib/wp/device.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/wp/device.c b/lib/wp/device.c
+index f0c32af..9a0b995 100644
+--- a/lib/wp/device.c
++++ b/lib/wp/device.c
+@@ -617,7 +617,7 @@ wp_spa_device_new_from_spa_factory (WpCore * core,
+ handle = pw_context_load_spa_handle (pw_context, factory_name,
+ props ? wp_properties_peek_dict (props) : NULL);
+ if (!handle) {
+- wp_warning ("SPA handle '%s' could not be loaded; is it installed?",
++ wp_message ("SPA handle '%s' could not be loaded; is it installed?",
+ factory_name);
+ return NULL;
+ }
+--
+2.33.0
+
diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch b/media-video/wireplumber/files/wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch
new file mode 100644
index 000000000000..2bb3a8d653e8
--- /dev/null
+++ b/media-video/wireplumber/files/wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch
@@ -0,0 +1,100 @@
+From 2a5f9c51f2f8dd29cd19a14f165ca2b425a172fc Mon Sep 17 00:00:00 2001
+From: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Date: Wed, 15 Sep 2021 12:51:47 +0300
+Subject: [PATCH 2/5] lua/api: fix object constructors to fail gracefully
+
+---
+ modules/module-lua-scripting/api.c | 35 ++++++++++++++++++------------
+ 1 file changed, 21 insertions(+), 14 deletions(-)
+
+diff --git a/modules/module-lua-scripting/api.c b/modules/module-lua-scripting/api.c
+index 5691b63..2830477 100644
+--- a/modules/module-lua-scripting/api.c
++++ b/modules/module-lua-scripting/api.c
+@@ -836,8 +836,9 @@ device_new (lua_State *L)
+
+ WpDevice *d = wp_device_new_from_factory (get_wp_export_core (L),
+ factory, properties);
+- wplua_pushobject (L, d);
+- return 1;
++ if (d)
++ wplua_pushobject (L, d);
++ return d ? 1 : 0;
+ }
+
+ /* WpSpaDevice */
+@@ -855,8 +856,9 @@ spa_device_new (lua_State *L)
+
+ WpSpaDevice *d = wp_spa_device_new_from_spa_factory (get_wp_export_core (L),
+ factory, properties);
+- wplua_pushobject (L, d);
+- return 1;
++ if (d)
++ wplua_pushobject (L, d);
++ return d ? 1 : 0;
+ }
+
+ static int
+@@ -903,8 +905,9 @@ node_new (lua_State *L)
+
+ WpNode *d = wp_node_new_from_factory (get_wp_export_core (L),
+ factory, properties);
+- wplua_pushobject (L, d);
+- return 1;
++ if (d)
++ wplua_pushobject (L, d);
++ return d ? 1 : 0;
+ }
+
+ static int
+@@ -1011,8 +1014,9 @@ impl_node_new (lua_State *L)
+
+ WpImplNode *d = wp_impl_node_new_from_pw_factory (get_wp_export_core (L),
+ factory, properties);
+- wplua_pushobject (L, d);
+- return 1;
++ if (d)
++ wplua_pushobject (L, d);
++ return d ? 1 : 0;
+ }
+
+ /* Port */
+@@ -1045,8 +1049,9 @@ link_new (lua_State *L)
+ }
+
+ WpLink *l = wp_link_new_from_factory (get_wp_core (L), factory, properties);
+- wplua_pushobject (L, l);
+- return 1;
++ if (l)
++ wplua_pushobject (L, l);
++ return l ? 1 : 0;
+ }
+
+ /* Client */
+@@ -1124,8 +1129,9 @@ session_item_new (lua_State *L)
+ {
+ const char *type = luaL_checkstring (L, 1);
+ WpSessionItem *si = wp_session_item_make (get_wp_core (L), type);
+- wplua_pushobject (L, si);
+- return 1;
++ if (si)
++ wplua_pushobject (L, si);
++ return si ? 1 : 0;
+ }
+
+ static int
+@@ -1135,8 +1141,9 @@ session_item_get_associated_proxy (lua_State *L)
+ const char *typestr = luaL_checkstring (L, 2);
+ WpProxy *proxy = wp_session_item_get_associated_proxy (si,
+ parse_gtype (typestr));
+- wplua_pushobject (L, proxy);
+- return 1;
++ if (proxy)
++ wplua_pushobject (L, proxy);
++ return proxy ? 1 : 0;
+ }
+
+ static int
+--
+2.33.0
+
diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-meson-Build-tests-conditionally.patch b/media-video/wireplumber/files/wireplumber-0.4.2-meson-Build-tests-conditionally.patch
new file mode 100644
index 000000000000..dab53c71bf4a
--- /dev/null
+++ b/media-video/wireplumber/files/wireplumber-0.4.2-meson-Build-tests-conditionally.patch
@@ -0,0 +1,41 @@
+From 3b24c419b497c283e64df23b3b5eecd4c3d51927 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Tue, 14 Sep 2021 05:07:41 +0100
+Subject: [PATCH 1/5] meson: Build tests conditionally
+
+It's useful downstream to be able to control building
+tests, as there's not much use building them if we're
+not going to run them.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+---
+ meson.build | 5 ++++-
+ meson_options.txt | 2 ++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 3712a82..5f87ade 100644
+--- a/meson.build
++++ b/meson.build
+@@ -109,4 +109,7 @@ subdir('lib')
+ subdir('docs')
+ subdir('modules')
+ subdir('src')
+-subdir('tests')
++
++if get_option('tests')
++ subdir('tests')
++endif
+diff --git a/meson_options.txt b/meson_options.txt
+index a7a0a89..4008864 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -24,3 +24,5 @@ option('systemd-user-unit-dir',
+ description : 'Directory for user systemd units')
+ option('glib-supp', type : 'string', value : '',
+ description: 'The glib.supp valgrind suppressions file to be used when running valgrind')
++option('tests', type : 'boolean', value : 'true',
++ description : 'Build the test suite')
+--
+2.33.0
+
diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch b/media-video/wireplumber/files/wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch
new file mode 100644
index 000000000000..f7fee3d11e4a
--- /dev/null
+++ b/media-video/wireplumber/files/wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch
@@ -0,0 +1,42 @@
+From 3b41df35a885b4db04528d839b87e88bf1345240 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nikl=C4=81vs=20Ko=C4=BCes=C5=86ikovs?=
+ <89q1r14hd@relay.firefox.com>
+Date: Wed, 15 Sep 2021 13:08:04 +0300
+Subject: [PATCH 4/5] v4l: add basic check for nil monitor
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If PipeWire is built without V4L support, then
+
+`monitor = SpaDevice("api.v4l2.enum.udev", config.properties or {})`
+
+will result in a nil monitor. This commit adds a basic sanity check
+to avoid further using the nil variable.
+
+Thanks-to: Pascal Flöschel (initial bug report)
+Thanks-to: George Kiagiadakis <george.kiagiadakis@collabora.com>
+Bug: https://bugs.gentoo.org/813043
+---
+ src/scripts/monitors/v4l2.lua | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/scripts/monitors/v4l2.lua b/src/scripts/monitors/v4l2.lua
+index e698cd7..fd9a20d 100644
+--- a/src/scripts/monitors/v4l2.lua
++++ b/src/scripts/monitors/v4l2.lua
+@@ -131,5 +131,9 @@ function createDevice(parent, id, type, factory, properties)
+ end
+
+ monitor = SpaDevice("api.v4l2.enum.udev", config.properties or {})
+-monitor:connect("create-object", createDevice)
+-monitor:activate(Feature.SpaDevice.ENABLED)
++if monitor then
++ monitor:connect("create-object", createDevice)
++ monitor:activate(Feature.SpaDevice.ENABLED)
++else
++ Log.message("PipeWire's V4L SPA missing or broken. Video4Linux not supported.")
++end
+--
+2.33.0
+
diff --git a/media-video/wireplumber/metadata.xml b/media-video/wireplumber/metadata.xml
new file mode 100644
index 000000000000..b9b45abb671e
--- /dev/null
+++ b/media-video/wireplumber/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>89q1r14hd@relay.firefox.com</email>
+ <name>Niklāvs Koļesņikovs</name>
+ </maintainer>
+ <maintainer type="person" proxied="proxy">
+ <email>sam@gentoo.org</email>
+ <name>Sam James</name>
+ </maintainer>
+ <upstream>
+ <bugs-to>https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues</bugs-to>
+ <changelog>https://gitlab.freedesktop.org/pipewire/wireplumber/-/releases</changelog>
+ <!--doc>https://gitlab.freedesktop.org/pipewire/wireplumber/-/wikis/home</doc-->
+ </upstream>
+</pkgmetadata>
diff --git a/media-video/wireplumber/wireplumber-0.4.2-r1.ebuild b/media-video/wireplumber/wireplumber-0.4.2-r1.ebuild
new file mode 100644
index 000000000000..a52dbd454714
--- /dev/null
+++ b/media-video/wireplumber/wireplumber-0.4.2-r1.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{3,4} )
+
+inherit lua-single meson systemd
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://gitlab.freedesktop.org/pipewire/${PN}.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+else
+ SRC_URI="https://gitlab.freedesktop.org/pipewire/${PN}/-/archive/${PV}/${P}.tar.gz"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Replacement for pipewire-media-session"
+HOMEPAGE="https://gitlab.freedesktop.org/pipewire/wireplumber"
+
+LICENSE="MIT"
+SLOT="0/0.4"
+IUSE="systemd test"
+
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+
+RESTRICT="!test? ( test )"
+
+# introspection? ( dev-libs/gobject-introspection ) is valid but likely only used for doc building
+BDEPEND="
+ dev-libs/glib
+ dev-util/gdbus-codegen
+ dev-util/glib-utils
+"
+
+DEPEND="
+ ${LUA_DEPS}
+ >=dev-libs/glib-2.62
+ >=media-video/pipewire-0.3.32
+ virtual/libc
+ systemd? ( sys-apps/systemd )
+"
+
+# Any dev-lua/* deps get declared like this inside RDEPEND:
+# $(lua_gen_cond_dep '
+# dev-lua/<NAME>[${LUA_USEDEP}]
+# ')
+RDEPEND="${DEPEND}"
+
+DOCS=( {NEWS,README}.rst )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.4.2-meson-Build-tests-conditionally.patch
+ "${FILESDIR}"/${PN}-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch
+ "${FILESDIR}"/${PN}-0.4.2-bluez-add-basic-check-for-nil-monitor.patch
+ "${FILESDIR}"/${PN}-0.4.2-v4l-add-basic-check-for-nil-monitor.patch
+ "${FILESDIR}"/${PN}-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch
+)
+
+src_configure() {
+ local emesonargs=(
+ -Dintrospection=disabled # Only used for Sphinx doc generation
+ -Dsystem-lua=true # We always unbundle everything we can
+ -Dsystem-lua-version=$(ver_cut 1-2 $(lua_get_version))
+ $(meson_feature systemd)
+ -Dsystemd-system-service=false # Matches upstream
+ $(meson_use systemd systemd-user-service)
+ -Dsystemd-system-unit-dir=$(systemd_get_systemunitdir)
+ -Dsystemd-user-unit-dir=$(systemd_get_userunitdir)
+ $(meson_use test tests)
+ )
+
+ meson_src_configure
+}
+
+pkg_postinst() {
+ if systemd_is_booted ; then
+ elog "To replace media-session with WirePlumber immediately:"
+ elog "systemctl --user disable --now pipewire-media-session.service"
+ elog "systemctl --user enable --now wireplumber.service"
+ else
+ elog "OpenRC users need to copy ${EROOT}/usr/share/pipewire/pipewire.conf"
+ elog "to ${EROOT}/etc/pipewire/pipewire.conf and in it replace"
+ elog "${EROOT}/usr/bin/pipewire-media-session with ${EROOT}/usr/bin/wireplumber"
+ elog "The switch to WirePlumber will happen the next time pipewire is started."
+ fi
+ elog
+}
diff --git a/media-video/wireplumber/wireplumber-9999.ebuild b/media-video/wireplumber/wireplumber-9999.ebuild
new file mode 100644
index 000000000000..6477107a785b
--- /dev/null
+++ b/media-video/wireplumber/wireplumber-9999.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{3,4} )
+
+inherit lua-single meson systemd
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://gitlab.freedesktop.org/pipewire/${PN}.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+else
+ SRC_URI="https://gitlab.freedesktop.org/pipewire/${PN}/-/archive/${PV}/${P}.tar.gz"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Replacement for pipewire-media-session"
+HOMEPAGE="https://gitlab.freedesktop.org/pipewire/wireplumber"
+
+LICENSE="MIT"
+SLOT="0/0.4"
+IUSE="systemd test"
+
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+
+RESTRICT="!test? ( test )"
+
+# introspection? ( dev-libs/gobject-introspection ) is valid but likely only used for doc building
+BDEPEND="
+ dev-libs/glib
+ dev-util/gdbus-codegen
+ dev-util/glib-utils
+"
+
+DEPEND="
+ ${LUA_DEPS}
+ >=dev-libs/glib-2.62
+ >=media-video/pipewire-0.3.32
+ virtual/libc
+ systemd? ( sys-apps/systemd )
+"
+
+# Any dev-lua/* deps get declared like this inside RDEPEND:
+# $(lua_gen_cond_dep '
+# dev-lua/<NAME>[${LUA_USEDEP}]
+# ')
+RDEPEND="${DEPEND}"
+
+DOCS=( {NEWS,README}.rst )
+
+src_configure() {
+ local emesonargs=(
+ -Dintrospection=disabled # Only used for Sphinx doc generation
+ -Dsystem-lua=true # We always unbundle everything we can
+ -Dsystem-lua-version=$(ver_cut 1-2 $(lua_get_version))
+ $(meson_feature systemd)
+ -Dsystemd-system-service=false # Matches upstream
+ $(meson_use systemd systemd-user-service)
+ -Dsystemd-system-unit-dir=$(systemd_get_systemunitdir)
+ -Dsystemd-user-unit-dir=$(systemd_get_userunitdir)
+ $(meson_use test tests)
+ )
+
+ meson_src_configure
+}
+
+pkg_postinst() {
+ if systemd_is_booted ; then
+ elog "To replace media-session with WirePlumber immediately:"
+ elog "systemctl --user disable --now pipewire-media-session.service"
+ elog "systemctl --user enable --now wireplumber.service"
+ else
+ elog "OpenRC users need to copy ${EROOT}/usr/share/pipewire/pipewire.conf"
+ elog "to ${EROOT}/etc/pipewire/pipewire.conf and in it replace"
+ elog "${EROOT}/usr/bin/pipewire-media-session with ${EROOT}/usr/bin/wireplumber"
+ elog "The switch to WirePlumber will happen the next time pipewire is started."
+ fi
+ elog
+}