From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1638691-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 BE33915817D
	for <garchives@archives.gentoo.org>; Tue,  4 Jun 2024 03:26:43 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D5CE7E2A5B;
	Tue,  4 Jun 2024 03:26:42 +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 3B205E2A5B
	for <gentoo-commits@lists.gentoo.org>; Tue,  4 Jun 2024 03:26:42 +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) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 1EFAE340C40
	for <gentoo-commits@lists.gentoo.org>; Tue,  4 Jun 2024 03:26:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 4D7471BFC
	for <gentoo-commits@lists.gentoo.org>; Tue,  4 Jun 2024 03:26:39 +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: <1717471505.d9a701f0e4dfecb71ff54d4c8dba1a4494a2f3ea.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/
X-VCS-Repository: repo/gentoo
X-VCS-Files: media-video/ffmpeg/ffmpeg-6.1.1-r6.ebuild media-video/ffmpeg/ffmpeg-9999.ebuild
X-VCS-Directories: media-video/ffmpeg/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: d9a701f0e4dfecb71ff54d4c8dba1a4494a2f3ea
X-VCS-Branch: master
Date: Tue,  4 Jun 2024 03:26:39 +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: a14a843a-1e9f-432f-b175-7667afdebf6a
X-Archives-Hash: 97fe60525d10553d7380fbf0e2674d07

commit:     d9a701f0e4dfecb71ff54d4c8dba1a4494a2f3ea
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  4 03:23:30 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun  4 03:25:05 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9a701f0

media-video/ffmpeg: fix LTO handling with multilib

Checking ABI and filtering based on that doesn't work in multilib_src_configure
because of contamination & the order the phases / ABIs run in.

Closes: https://bugs.gentoo.org/923491
Thanks-to: Michael Cook <mackal.cook <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-video/ffmpeg/ffmpeg-6.1.1-r6.ebuild | 15 ++++++++++-----
 media-video/ffmpeg/ffmpeg-9999.ebuild     | 15 ++++++++++-----
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/media-video/ffmpeg/ffmpeg-6.1.1-r6.ebuild b/media-video/ffmpeg/ffmpeg-6.1.1-r6.ebuild
index 9f5bd8424035..fa3dd7774141 100644
--- a/media-video/ffmpeg/ffmpeg-6.1.1-r6.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.1.1-r6.ebuild
@@ -419,6 +419,14 @@ src_prepare() {
 
 	ln -snf "${FILESDIR}"/chromium.c chromium.c || die
 	echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
+
+	# We need to detect LTO usage before multilib stuff and filter-lto is called (bug #923491)
+	if tc-is-lto ; then
+		# Respect -flto value, e.g -flto=thin
+		local v="$(get-flag flto)"
+		[[ -n ${v} ]] && LTO_FLAG="--enable-lto=${v}" || LTO_FLAG="--enable-lto"
+	fi
+	filter-lto
 }
 
 multilib_src_configure() {
@@ -510,12 +518,9 @@ multilib_src_configure() {
 	done
 
 	# LTO support, bug #566282, bug #754654, bug #772854
-	if [[ ${ABI} != x86 ]] && tc-is-lto; then
-		# Respect -flto value, e.g -flto=thin
-		local v="$(get-flag flto)"
-		[[ -n ${v} ]] && myconf+=( "--enable-lto=${v}" ) || myconf+=( "--enable-lto" )
+	if [[ ${ABI} != x86 && ! -z ${LTO_FLAG} ]]; then
+		myconf+=( ${LTO_FLAG} )
 	fi
-	filter-lto
 
 	# Mandatory configuration
 	myconf=(

diff --git a/media-video/ffmpeg/ffmpeg-9999.ebuild b/media-video/ffmpeg/ffmpeg-9999.ebuild
index 867a4147d174..e4783cb8348f 100644
--- a/media-video/ffmpeg/ffmpeg-9999.ebuild
+++ b/media-video/ffmpeg/ffmpeg-9999.ebuild
@@ -414,6 +414,14 @@ src_prepare() {
 
 	ln -snf "${FILESDIR}"/chromium.c chromium.c || die
 	echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
+
+	# We need to detect LTO usage before multilib stuff and filter-lto is called (bug #923491)
+	if tc-is-lto ; then
+		# Respect -flto value, e.g -flto=thin
+		local v="$(get-flag flto)"
+		[[ -n ${v} ]] && LTO_FLAG="--enable-lto=${v}" || LTO_FLAG="--enable-lto"
+	fi
+	filter-lto
 }
 
 multilib_src_configure() {
@@ -505,12 +513,9 @@ multilib_src_configure() {
 	done
 
 	# LTO support, bug #566282, bug #754654, bug #772854
-	if [[ ${ABI} != x86 ]] && tc-is-lto; then
-		# Respect -flto value, e.g -flto=thin
-		local v="$(get-flag flto)"
-		[[ -n ${v} ]] && myconf+=( "--enable-lto=${v}" ) || myconf+=( "--enable-lto" )
+	if [[ ${ABI} != x86 && ! -z ${LTO_FLAG} ]]; then
+		myconf+=( ${LTO_FLAG} )
 	fi
-	filter-lto
 
 	# Mandatory configuration
 	myconf=(