From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1648641-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id B241B15802E
	for <garchives@archives.gentoo.org>; Mon,  1 Jul 2024 08:20:03 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 335E32BC01C;
	Mon,  1 Jul 2024 08:20:02 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C8311E2A76
	for <gentoo-commits@lists.gentoo.org>; Mon,  1 Jul 2024 08:20:01 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id AD6C2335DC3
	for <gentoo-commits@lists.gentoo.org>; Mon,  1 Jul 2024 08:20:00 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 1A23415F7
	for <gentoo-commits@lists.gentoo.org>; Mon,  1 Jul 2024 08:19:59 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1719821952.a7ff87b07c894cdfce5c6b041d4aff5dd353b889.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/pipewire/, media-video/pipewire/files/
X-VCS-Repository: repo/gentoo
X-VCS-Files: media-video/pipewire/files/pipewire-1.0.7-automagic-webrtc-audio-processing.patch media-video/pipewire/pipewire-1.0.7.ebuild
X-VCS-Directories: media-video/pipewire/files/ media-video/pipewire/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: a7ff87b07c894cdfce5c6b041d4aff5dd353b889
X-VCS-Branch: master
Date: Mon,  1 Jul 2024 08:19:59 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: b74da726-3a24-4b67-bf52-10a243dc110b
X-Archives-Hash: cf9fe57bf1d89d966c67ad90ef0840ae

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 <eschwartz93@gmail.com>
+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() {