public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Viorel Munteanu" <ceamac@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-boot/gnu-efi/
Date: Mon, 26 Aug 2024 04:34:44 +0000 (UTC)	[thread overview]
Message-ID: <1724646517.c4a94ba86475049c1806eb81fe28200ee3020a59.ceamac@gentoo> (raw)

commit:     c4a94ba86475049c1806eb81fe28200ee3020a59
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 23 14:39:13 2024 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Mon Aug 26 04:28:37 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4a94ba8

sys-boot/gnu-efi: Fix compilation on musl amd64

On amd64, musl typedefs wchar_t to int, conflicting with -fshort-wchar.
Also, /usr/include is searched before the compiler provided include
directory.
As a workaround, use -nostdinc and switch them around.

Closes: https://bugs.gentoo.org/933080
Bug: https://bugs.gentoo.org/938012
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 sys-boot/gnu-efi/gnu-efi-3.0.18-r4.ebuild | 128 ++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)

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
new file mode 100644
index 000000000000..b34d3a74c7db
--- /dev/null
+++ b/sys-boot/gnu-efi/gnu-efi-3.0.18-r4.ebuild
@@ -0,0 +1,128 @@
+# 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-/}"
+		LANG=C LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' || die "${OBJCOPY} (objcopy) does not support EFI target"
+	fi
+}
+
+check_comppiler() {
+	if [[ ${MERGE_TYPE} != "binary" ]]; then
+		tc-is-gcc || tc-is-clang || die "Unsupported compiler"
+	fi
+}
+
+pkg_pretend() {
+	check_comppiler
+	check_and_set_objcopy
+}
+
+pkg_setup() {
+	check_and_set_objcopy
+}
+
+src_prepare() {
+	default
+	sed -i -e "s/-Werror//" Make.defaults || die
+}
+
+efimake() {
+	local arch=
+	case ${CHOST} in
+		arm*) arch=arm ;;
+		aarch64*) arch=aarch64 ;;
+		ia64*) arch=ia64 ;;
+		i?86*) arch=ia32 ;;
+		riscv64*) arch=riscv64;;
+		x86_64*) arch=x86_64 ;;
+		*) die "Unknown CHOST" ;;
+	esac
+
+	local args=(
+		ARCH="${arch}"
+		HOSTCC="${BUILD_CC}"
+		CC="${CC}"
+		AS="${AS}"
+		LD="${LD}"
+		AR="${AR}"
+		OBJCOPY="${OBJCOPY}"
+		PREFIX="${EPREFIX}/usr"
+		LIBDIR='$(PREFIX)'/$(get_libdir)
+	)
+	emake -j1 "${args[@]}" "$@"
+}
+
+src_compile() {
+	tc-export BUILD_CC AR AS CC LD OBJCOPY
+
+	if ! use custom-cflags; then
+		unset CFLAGS CPPFLAGS LDFLAGS
+	fi
+
+	# work around musl: include first the compiler include dir, then the system one
+	# bug #933080, #938012
+	local CPPINCLUDEDIR
+	if tc-is-gcc; then
+		CPPINCLUDEDIR=$(LANG=C ${CC} -print-search-dirs 2> /dev/null | grep ^install: | cut -f2 -d' ')/include
+	elif tc-is-clang; then
+		CPPINCLUDEDIR=$(LANG=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
+}


             reply	other threads:[~2024-08-26  4:34 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26  4:34 Viorel Munteanu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-09 19:55 [gentoo-commits] repo/gentoo:master commit in: sys-boot/gnu-efi/ Viorel Munteanu
2024-11-09 19:55 Viorel Munteanu
2024-11-01 20:42 Sam James
2024-11-01 17:38 Arthur Zamarin
2024-11-01 17:38 Arthur Zamarin
2024-11-01 17:30 Sam James
2024-10-15  4:54 Viorel Munteanu
2024-09-27 17:08 Viorel Munteanu
2024-09-09 18:08 Viorel Munteanu
2024-09-05 12:11 Sam James
2024-09-05 12:11 Sam James
2024-09-05 12:11 Sam James
2024-08-28 15:14 Viorel Munteanu
2024-08-02  4:53 Viorel Munteanu
2024-07-29  6:04 Viorel Munteanu
2024-07-25 11:47 Sam James
2024-07-25 11:47 Sam James
2024-07-25 11:41 Sam James
2024-07-25 11:41 Sam James
2024-06-17 19:01 Viorel Munteanu
2024-06-17  5:52 Viorel Munteanu
2024-05-29 12:15 Sam James
2024-05-29  5:37 Joonas Niilola
2024-05-28 22:01 Sam James
2024-04-23 20:30 Mike Gilbert
2024-04-23 19:42 Sam James
2024-04-23 19:42 Sam James
2023-11-27 20:22 Arthur Zamarin
2023-11-27 20:22 Arthur Zamarin
2023-11-27 19:22 Sam James
2023-11-27 19:22 Sam James
2023-09-06  8:02 David Seifert
2023-09-05 20:49 David Seifert
2023-09-05 20:49 David Seifert
2023-06-01 20:12 Sam James
2023-06-01 20:12 Sam James
2023-06-01 20:05 Sam James
2023-06-01 20:04 Sam James
2022-08-14 13:30 Sam James
2022-08-13  7:08 Agostino Sarubbo
2022-08-13  6:58 Agostino Sarubbo
2022-08-13  5:05 Arthur Zamarin
2022-08-12 18:16 Mike Gilbert
2022-05-30 20:52 Mike Gilbert
2022-05-30 20:52 Mike Gilbert
2022-02-09  5:52 Yixun Lan
2021-08-28 13:47 Mike Gilbert
2021-08-28 13:47 Mike Gilbert
2020-09-26  9:05 Sergei Trofimovich
2020-06-24  0:10 Mike Gilbert
2020-06-24  0:10 Mike Gilbert
2020-04-07 10:21 Mart Raudsepp
2020-04-01 21:14 Sergei Trofimovich
2020-02-07 13:16 Agostino Sarubbo
2020-02-07 12:12 Agostino Sarubbo
2020-02-06  8:26 Sergei Trofimovich
2020-02-05 14:18 Agostino Sarubbo
2019-11-25  0:57 Mike Gilbert
2019-11-25  0:57 Mike Gilbert
2019-07-06 19:22 Mike Gilbert
2018-07-19 15:22 Mike Gilbert
2018-05-02  6:59 Sergei Trofimovich
2018-01-27 17:46 Sergei Trofimovich
2017-07-09 15:14 Mike Gilbert
2017-07-09 15:14 Mike Gilbert
2017-07-02 11:08 Sergei Trofimovich
2017-07-02 11:08 Sergei Trofimovich
2017-04-25 23:30 Mike Gilbert
2017-02-05  4:39 Mike Gilbert
2017-02-05  4:25 Mike Gilbert
2017-02-05  4:23 Mike Gilbert
2017-02-05  4:23 Mike Gilbert
2016-11-18 19:17 Mike Gilbert
2016-06-03 16:15 Mike Gilbert
2016-01-16  8:17 Mike Frysinger
2016-01-16  8:17 Mike Frysinger
2015-11-08 19:43 Mike Gilbert
2015-11-08 19:29 Mikle Kolyada
2015-10-23  9:05 Agostino Sarubbo
2015-09-06  2:29 Mike Gilbert
2015-09-05 19:32 Mike Gilbert
2015-08-19  4:24 Doug Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1724646517.c4a94ba86475049c1806eb81fe28200ee3020a59.ceamac@gentoo \
    --to=ceamac@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox