From f18c709e191b6725d43f4f386b5cb19e7d4f7c21 Mon Sep 17 00:00:00 2001 From: Viorel Munteanu Date: Mon, 9 Sep 2024 20:50:09 +0300 Subject: sys-boot/gnu-efi: fix building on arm Broken when trying to implement a workaround for bug #931792. Checking if objcopy supports PE fails on arm. Closes: https://bugs.gentoo.org/939338 Signed-off-by: Viorel Munteanu --- sys-boot/gnu-efi/gnu-efi-3.0.18-r4.ebuild | 128 ---------------------------- sys-boot/gnu-efi/gnu-efi-3.0.18-r5.ebuild | 133 ++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 128 deletions(-) delete mode 100644 sys-boot/gnu-efi/gnu-efi-3.0.18-r4.ebuild create mode 100644 sys-boot/gnu-efi/gnu-efi-3.0.18-r5.ebuild (limited to 'sys-boot') diff --git a/sys-boot/gnu-efi/gnu-efi-3.0.18-r4.ebuild b/sys-boot/gnu-efi/gnu-efi-3.0.18-r4.ebuild deleted file mode 100644 index 7185e2dbb78c..000000000000 --- a/sys-boot/gnu-efi/gnu-efi-3.0.18-r4.ebuild +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright 2004-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit flag-o-matic toolchain-funcs - -DESCRIPTION="Library for build EFI Applications" -HOMEPAGE="https://sourceforge.net/projects/gnu-efi/" -SRC_URI="https://downloads.sourceforge.net/gnu-efi/${P}.tar.bz2" - -# inc/, lib/ dirs (README.efilib) -# - BSD-2 -# gnuefi dir: -# - BSD (3-cluase): crt0-efi-ia32.S -# - GPL-2+ : setjmp_ia32.S -LICENSE="GPL-2+ BSD BSD-2" -SLOT="0" -KEYWORDS="-* ~amd64 ~arm ~arm64 ~ia64 ~riscv ~x86" -IUSE="abi_x86_32 abi_x86_64 custom-cflags" -REQUIRED_USE=" - amd64? ( || ( abi_x86_32 abi_x86_64 ) ) - x86? ( || ( abi_x86_32 abi_x86_64 ) ) -" - -# for ld.bfd and objcopy -BDEPEND="sys-devel/binutils" - -# These objects get run early boot (i.e. not inside of Linux), -# so doing these QA checks on them doesn't make sense. -QA_EXECSTACK="usr/*/lib*efi.a:* usr/*/crt*.o" -RESTRICT="strip" - -PATCHES=( - "${FILESDIR}"/${P}-clang.patch - "${FILESDIR}"/${PN}-3.0.18-remove-linux-headers.patch -) - -check_and_set_objcopy() { - if [[ ${MERGE_TYPE} != "binary" ]]; then - # bug #931792 - # llvm-objcopy does not support EFI target, try to use binutils objcopy or fail - tc-export OBJCOPY - OBJCOPY="${OBJCOPY/llvm-/}" - LC_ALL=C "${OBJCOPY}" --help | grep -q '\ /dev/null | grep ^install: | cut -f2 -d' ')/include - elif tc-is-clang; then - CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-resource-dir 2> /dev/null)/include - fi - append-cflags "-nostdinc -isystem ${CPPINCLUDEDIR} -isystem ${ESYSROOT}/usr/include" - - if use amd64 || use x86; then - use abi_x86_32 && CHOST=i686 ABI=x86 efimake - use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake - else - efimake - fi -} - -src_install() { - if use amd64 || use x86; then - use abi_x86_32 && CHOST=i686 ABI=x86 efimake INSTALLROOT="${D}" install - use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake INSTALLROOT="${D}" install - else - efimake INSTALLROOT="${D}" install - fi - einstalldocs -} diff --git a/sys-boot/gnu-efi/gnu-efi-3.0.18-r5.ebuild b/sys-boot/gnu-efi/gnu-efi-3.0.18-r5.ebuild new file mode 100644 index 000000000000..d492de252a80 --- /dev/null +++ b/sys-boot/gnu-efi/gnu-efi-3.0.18-r5.ebuild @@ -0,0 +1,133 @@ +# Copyright 2004-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic toolchain-funcs + +DESCRIPTION="Library for build EFI Applications" +HOMEPAGE="https://sourceforge.net/projects/gnu-efi/" +SRC_URI="https://downloads.sourceforge.net/gnu-efi/${P}.tar.bz2" + +# inc/, lib/ dirs (README.efilib) +# - BSD-2 +# gnuefi dir: +# - BSD (3-cluase): crt0-efi-ia32.S +# - GPL-2+ : setjmp_ia32.S +LICENSE="GPL-2+ BSD BSD-2" +SLOT="0" +KEYWORDS="-* ~amd64 ~arm ~arm64 ~ia64 ~riscv ~x86" +IUSE="abi_x86_32 abi_x86_64 custom-cflags" +REQUIRED_USE=" + amd64? ( || ( abi_x86_32 abi_x86_64 ) ) + x86? ( || ( abi_x86_32 abi_x86_64 ) ) +" + +# for ld.bfd and objcopy +BDEPEND="sys-devel/binutils" + +# These objects get run early boot (i.e. not inside of Linux), +# so doing these QA checks on them doesn't make sense. +QA_EXECSTACK="usr/*/lib*efi.a:* usr/*/crt*.o" +RESTRICT="strip" + +PATCHES=( + "${FILESDIR}"/${P}-clang.patch + "${FILESDIR}"/${PN}-3.0.18-remove-linux-headers.patch +) + +check_and_set_objcopy() { + if [[ ${MERGE_TYPE} != "binary" ]]; then + # bug #931792 + # llvm-objcopy does not support EFI target, try to use binutils objcopy or fail + tc-export OBJCOPY + OBJCOPY="${OBJCOPY/llvm-/}" + if ! use arm && ! use riscv; then + # bug #939338 + # objcopy does not understand PE/COFF on these arches: arm32, riscv64 and mips64le + # gnu-efi containes a workaround + LC_ALL=C "${OBJCOPY}" --help | grep -q '\ /dev/null | grep ^install: | cut -f2 -d' ')/include + elif tc-is-clang; then + CPPINCLUDEDIR=$(LC_ALL=C ${CC} -print-resource-dir 2> /dev/null)/include + fi + append-cflags "-nostdinc -isystem ${CPPINCLUDEDIR} -isystem ${ESYSROOT}/usr/include" + + if use amd64 || use x86; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake + use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake + else + efimake + fi +} + +src_install() { + if use amd64 || use x86; then + use abi_x86_32 && CHOST=i686 ABI=x86 efimake INSTALLROOT="${D}" install + use abi_x86_64 && CHOST=x86_64 ABI=amd64 efimake INSTALLROOT="${D}" install + else + efimake INSTALLROOT="${D}" install + fi + einstalldocs +} -- cgit v1.2.3-65-gdbad