commit:     3e68014936059256d40d745a4e60dd46aeca52f9
Author:     Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 27 12:53:56 2023 +0000
Commit:     Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Mon Feb 27 13:15:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e680149

sys-apps/fwupd-efi: restore the old option for setting the linker

Between 1.3 and 1.4, fwupd-efi upstream phased this option out in favour
of using standard Meson toolchain management for both the compiler and
the linker. However, the transition has not been completed yet and
the linking phase still involves a custom target explicitly calling the
linker executable - and the way the name of said executable is
determined at the moment is not entirely robust.

Closes: https://bugs.gentoo.org/892339
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>

 .../files/fwupd-efi-1.4-efi_ld_override.patch      | 26 ++++++++++++++++++++++
 sys-apps/fwupd-efi/fwupd-efi-1.4.ebuild            |  7 +++++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/sys-apps/fwupd-efi/files/fwupd-efi-1.4-efi_ld_override.patch 
b/sys-apps/fwupd-efi/files/fwupd-efi-1.4-efi_ld_override.patch
new file mode 100644
index 000000000000..0b703a41d2e6
--- /dev/null
+++ b/sys-apps/fwupd-efi/files/fwupd-efi-1.4-efi_ld_override.patch
@@ -0,0 +1,26 @@
+--- a/efi/meson.build
++++ b/efi/meson.build
+@@ -1,6 +1,7 @@
+ generate_sbat = find_program('generate_sbat.py', native: true)
+ generate_binary = find_program('generate_binary.py', native: true)
+ 
++efi_ld = get_option('efi-ld')
+ efi_ldsdir = get_option('efi-ldsdir')
+ efi_incdir = get_option('efi-includedir')
+ 
+@@ -226,7 +227,7 @@
+ so = custom_target('fwup.so',
+                    input : [o_file1, o_file2, o_file3, o_file4, o_file5],
+                    output : 'fwup.so',
+-                   command : [ld, '-o', '@OUTPUT@'] +
++                   command : [efi_ld, '-o', '@OUTPUT@'] +
+                              efi_ldflags + ['@INPUT@'] +
+                              ['-lefi', '-lgnuefi', libgcc_file_name],
+                    depends: fwupd_so_deps)
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,3 +1,4 @@
++option('efi-ld', type : 'string', value : 'ld', description : 'the linker to 
use for EFI modules')
+ option('efi-libdir', type : 'string', description : 'path to the EFI lib 
directory')
+ option('efi-ldsdir', type : 'string', description : 'path to the EFI lds 
directory')
+ option('efi-includedir', type : 'string', value : '/usr/include/efi', 
description : 'path to the EFI header directory')

diff --git a/sys-apps/fwupd-efi/fwupd-efi-1.4.ebuild 
b/sys-apps/fwupd-efi/fwupd-efi-1.4.ebuild
index d90dd1db3a4e..a10efcfde644 100644
--- a/sys-apps/fwupd-efi/fwupd-efi-1.4.ebuild
+++ b/sys-apps/fwupd-efi/fwupd-efi-1.4.ebuild
@@ -5,7 +5,7 @@ EAPI=8
 
 PYTHON_COMPAT=( python3_{9..11} )
 
-inherit meson python-any-r1
+inherit meson python-any-r1 toolchain-funcs
 
 DESCRIPTION="EFI executable for fwupd"
 HOMEPAGE="https://fwupd.org";
@@ -31,6 +31,10 @@ DEPEND="sys-boot/gnu-efi"
 
 RDEPEND="!<sys-apps/fwupd-1.6.0"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.4-efi_ld_override.patch   # Bug #892339
+)
+
 python_check_deps() {
        python_has_version "dev-python/pefile[${PYTHON_USEDEP}]"
 }
@@ -43,6 +47,7 @@ src_prepare() {
 
 src_configure() {
        local emesonargs=(
+               -Defi-ld="$(tc-getLD)"
                -Defi-libdir="${EPREFIX}"/usr/$(get_libdir)
                -Defi_sbat_distro_id="gentoo"
                -Defi_sbat_distro_summary="Gentoo GNU/Linux"

Reply via email to