commit:     610d14c7620422c7dc21e13808db1c3a8faf15e9
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Wed Sep 25 07:26:23 2019 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Oct  3 21:02:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=610d14c7

sys-boot/gnu-efi: Fix building with clang-9

Fix the build to emit valid CFLAGS for clang.

Closes: https://bugs.gentoo.org/695612
Closes: https://github.com/gentoo/gentoo/pull/13033
Package-Manager: Portage-2.3.76, Repoman-2.3.17
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../gnu-efi/files/gnu-efi-3.0.9-fix-clang-build.patch | 19 +++++++++++++++++++
 sys-boot/gnu-efi/gnu-efi-3.0.9.ebuild                 |  4 +++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/sys-boot/gnu-efi/files/gnu-efi-3.0.9-fix-clang-build.patch 
b/sys-boot/gnu-efi/files/gnu-efi-3.0.9-fix-clang-build.patch
new file mode 100644
index 00000000000..0e4ec7d77b0
--- /dev/null
+++ b/sys-boot/gnu-efi/files/gnu-efi-3.0.9-fix-clang-build.patch
@@ -0,0 +1,19 @@
+Bug: https://bugs.gentoo.org/695612
+Upstream: https://sourceforge.net/p/gnu-efi/patches/70/
+
+--- a/Make.defaults
++++ b/Make.defaults
+@@ -110,10 +110,10 @@
+                             || ( [ $(GCCVERSION) -eq "4" ]      \
+                                  && [ $(GCCMINOR) -ge "7" ] ) ) \
+                           && echo 1)
+-  ifeq ($(GCCNEWENOUGH),1)
+-    CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
+-  else ifeq ($(USING_CLANG),clang)
++  ifeq ($(USING_CLANG),clang)
+     CPPFLAGS += -DGNU_EFI_USE_MS_ABI --std=c11
++  else ifeq ($(GCCNEWENOUGH),1)
++    CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11
+   endif
+ 
+   CFLAGS += -mno-red-zone

diff --git a/sys-boot/gnu-efi/gnu-efi-3.0.9.ebuild 
b/sys-boot/gnu-efi/gnu-efi-3.0.9.ebuild
index fa23e18d91d..57a9ed662e5 100644
--- a/sys-boot/gnu-efi/gnu-efi-3.0.9.ebuild
+++ b/sys-boot/gnu-efi/gnu-efi-3.0.9.ebuild
@@ -24,9 +24,11 @@ IUSE="abi_x86_32 abi_x86_64 custom-cflags"
 QA_EXECSTACK="usr/*/lib*efi.a:* usr/*/crt*.o"
 RESTRICT="strip"
 
+PATCHES=( "${FILESDIR}"/${PN}-3.0.9-fix-clang-build.patch )
+
 src_prepare() {
-       sed -i -e "s/-Werror//" Make.defaults || die
        default
+       sed -i -e "s/-Werror//" Make.defaults || die
 }
 
 efimake() {

Reply via email to