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=(

Reply via email to