commit:     a7ff87b07c894cdfce5c6b041d4aff5dd353b889
Author:     Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Sun Jun 30 15:30:06 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul  1 08:19:12 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7ff87b0

media-video/pipewire: backport patch to fix automagic webrtc dependency

 * VDB: detected possibly incorrect RDEPEND (media-video/pipewire-1.0.7)
 *                  > media-libs/libpulse
 *                  > media-libs/webrtc-audio-processing

The build system was simply ignoring the option which controlled this.

Closes: https://bugs.gentoo.org/933218
Signed-off-by: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...e-1.0.7-automagic-webrtc-audio-processing.patch | 95 ++++++++++++++++++++++
 media-video/pipewire/pipewire-1.0.7.ebuild         |  3 +
 2 files changed, 98 insertions(+)

diff --git 
a/media-video/pipewire/files/pipewire-1.0.7-automagic-webrtc-audio-processing.patch
 
b/media-video/pipewire/files/pipewire-1.0.7-automagic-webrtc-audio-processing.patch
new file mode 100644
index 000000000000..ac245dd7cc15
--- /dev/null
+++ 
b/media-video/pipewire/files/pipewire-1.0.7-automagic-webrtc-audio-processing.patch
@@ -0,0 +1,95 @@
+From acd5bf60b9d4a35d00c90bfdca7f89e4ff4a4ff7 Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <[email protected]>
+Date: Thu, 30 May 2024 19:44:38 -0400
+Subject: [PATCH] meson: fix webrtc-audio-processing dependency ignoring
+ configure args
+
+Most dependencies use meson "feature" options for optional
+functionality. This allows people to disable them, if they don't want
+them, through the power of tristate decision-making.
+
+This particular dependency does something a bit more complicated than
+can be described by simply passing feature options to the required
+kwarg. It:
+
+- tries to look for two different names of the dependency
+- selects different version ranges, depending on the dependency name
+- has a hole in the middle of the versions
+
+Unfortunately, `required: false` for the first dependency isn't
+equivalent to a tristate decision-making process. We have to manually
+code the logic ourselves.
+
+The problem is that when we look up the first name, we cannot pass the
+feature option in because if the option is force enabled, then the
+dependency lookup fails and configuration never tries to find the older
+version instead.
+
+But also, we can't just say it *isn't* required, because if the option
+is force *disabled* but it is installed on the system, we still find it
+and build against it.
+
+One solution would be using meson 0.60's support for multiple dependency
+names:
+
+```
+dependency('webrtc-audio-processing-1', 'webrtc-audio-processing',
+    version : ['>= 0.2'],
+    required: get_option('echo-cancel-webrtc'),
+)
+```
+
+Unfortunately, this too doesn't work since we could end up detecting 1.1
+(the hole in the middle) which is invalid.
+
+Instead, we do a bit of checking for tristate values before deciding to
+invoke `dependency()`. This lets us guarantee that disabled dependencies
+are well and truly disabled.
+
+Bug: https://bugs.gentoo.org/933218
+Fixes: #3678
+---
+ meson.build | 25 +++++++++++++++----------
+ 1 file changed, 15 insertions(+), 10 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index cda60112f..72d275086 100644
+--- a/meson.build
++++ b/meson.build
+@@ -393,18 +393,23 @@ cdata.set('HAVE_GSTREAMER_DEVICE_PROVIDER', 
get_option('gstreamer-device-provide
+ summary({'gstreamer DMA_DRM support': gst_dma_drm_found}, bool_yn: true, 
section: 'Backend')
+ cdata.set('HAVE_GSTREAMER_DMA_DRM', gst_dma_drm_found)
+ 
+-webrtc_dep = dependency('webrtc-audio-processing-1',
+-  version : ['>= 1.2' ],
+-  required : false)
+-cdata.set('HAVE_WEBRTC1', webrtc_dep.found())
+-if webrtc_dep.found()
++if get_option('echo-cancel-webrtc').disabled()
++  webrtc_dep = dependency('', required: false)
+   summary({'WebRTC Echo Canceling >= 1.2': webrtc_dep.found()}, bool_yn: 
true, section: 'Misc dependencies')
+ else
+-  webrtc_dep = dependency('webrtc-audio-processing',
+-    version : ['>= 0.2', '< 1.0'],
+-    required : get_option('echo-cancel-webrtc'))
+-  cdata.set('HAVE_WEBRTC', webrtc_dep.found())
+-  summary({'WebRTC Echo Canceling < 1.0': webrtc_dep.found()}, bool_yn: true, 
section: 'Misc dependencies')
++  webrtc_dep = dependency('webrtc-audio-processing-1',
++    version : ['>= 1.2' ],
++    required : false)
++  cdata.set('HAVE_WEBRTC1', webrtc_dep.found())
++  if webrtc_dep.found()
++    summary({'WebRTC Echo Canceling >= 1.2': webrtc_dep.found()}, bool_yn: 
true, section: 'Misc dependencies')
++  else
++    webrtc_dep = dependency('webrtc-audio-processing',
++      version : ['>= 0.2', '< 1.0'],
++      required : get_option('echo-cancel-webrtc'))
++    cdata.set('HAVE_WEBRTC', webrtc_dep.found())
++    summary({'WebRTC Echo Canceling < 1.0': webrtc_dep.found()}, bool_yn: 
true, section: 'Misc dependencies')
++  endif
+ endif
+ 
+ # On FreeBSD and MidnightBSD, epoll-shim library is required for eventfd() 
and timerfd()
+-- 
+GitLab
+

diff --git a/media-video/pipewire/pipewire-1.0.7.ebuild 
b/media-video/pipewire/pipewire-1.0.7.ebuild
index 69bb29b9e1af..e2e457730428 100644
--- a/media-video/pipewire/pipewire-1.0.7.ebuild
+++ b/media-video/pipewire/pipewire-1.0.7.ebuild
@@ -175,6 +175,9 @@ PDEPEND=">=media-video/wireplumber-0.5.2"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-0.3.25-enable-failed-mlock-warning.patch
+       # https://bugs.gentoo.org/933218
+       # https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/2028
+       "${FILESDIR}"/${P}-automagic-webrtc-audio-processing.patch
 )
 
 pkg_setup() {

Reply via email to