commit:     edc702aee9685668ec277444e123613fbb1eb232
Author:     Gwendal Grignou <gwendal <AT> chromium <DOT> org>
AuthorDate: Wed May 15 21:49:16 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb 13 11:31:08 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=edc702ae

sys-fs/mdadm: Do not call gcc directly

When gcc is not used (clang is used on Chromeos), emerge will fails.

Closes: https://bugs.gentoo.org/931972
Signed-off-by: Gwendal Grignou <gwendal <AT> chromium.org>
Closes: https://github.com/gentoo/gentoo/pull/36691
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/mdadm-4.3-do-not-call-gcc-directly.patch | 50 ++++++++++++++++++++++
 sys-fs/mdadm/mdadm-4.3-r1.ebuild                   |  1 +
 2 files changed, 51 insertions(+)

diff --git a/sys-fs/mdadm/files/mdadm-4.3-do-not-call-gcc-directly.patch 
b/sys-fs/mdadm/files/mdadm-4.3-do-not-call-gcc-directly.patch
new file mode 100644
index 000000000000..e7cccda166e7
--- /dev/null
+++ b/sys-fs/mdadm/files/mdadm-4.3-do-not-call-gcc-directly.patch
@@ -0,0 +1,50 @@
+From b7028334f2dfbb0b11cf1fa34ecb89d5287c367b Mon Sep 17 00:00:00 2001
+From: Gwendal Grignou <[email protected]>
+Date: Wed, 15 May 2024 14:30:59 -0700
+Subject: [PATCH] Makefile: Do not call gcc directly
+
+When mdadm is compiled with clang, direct gcc will fail.
+Make sure to use $(CC) variable instead.
+
+Note that Clang does not support --help=warnings --
+-print-diagnostic-options should be used instead.
+So with Clang, the compilation will go through, but the
+extra warning flags will never be added.
+
+Signed-off-by: Gwendal Grignou <[email protected]>
+---
+ Makefile | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index adac7905..ec8c4226 100644
+--- a/Makefile
++++ b/Makefile
+@@ -56,21 +56,21 @@ CWFLAGS += -Wp -O3
+ endif
+ 
+ ifeq ($(origin FALLTHROUGH), undefined)
+-      FALLTHROUGH := $(shell gcc -Q --help=warnings 2>&1 | grep 
"implicit-fallthrough" | wc -l)
++      FALLTHROUGH := $(shell $(CC) $(CFLAGS) -Q --help=warnings 2>&1 | grep 
"implicit-fallthrough" | wc -l)
+       ifneq "$(FALLTHROUGH)"  "0"
+       CWFLAGS += -Wimplicit-fallthrough=0
+       endif
+ endif
+ 
+ ifeq ($(origin FORMATOVERFLOW), undefined)
+-      FORMATOVERFLOW := $(shell gcc -Q --help=warnings 2>&1 | grep 
"format-overflow" | wc -l)
++      FORMATOVERFLOW := $(shell $(CC) $(CFLAGS) -Q --help=warnings 2>&1 | 
grep "format-overflow" | wc -l)
+       ifneq "$(FORMATOVERFLOW)"  "0"
+       CWFLAGS += -Wformat-overflow
+       endif
+ endif
+ 
+ ifeq ($(origin STRINGOPOVERFLOW), undefined)
+-      STRINGOPOVERFLOW := $(shell gcc -Q --help=warnings 2>&1 | grep 
"stringop-overflow" | wc -l)
++      STRINGOPOVERFLOW := $(shell $(CC) $(CFLAGS) -Q --help=warnings 2>&1 | 
grep "stringop-overflow" | wc -l)
+       ifneq "$(STRINGOPOVERFLOW)"  "0"
+       CWFLAGS += -Wstringop-overflow
+       endif
+-- 
+2.45.0.215.g3402c0e53f-goog
+

diff --git a/sys-fs/mdadm/mdadm-4.3-r1.ebuild b/sys-fs/mdadm/mdadm-4.3-r1.ebuild
index 65917537ec28..d6498733b2e0 100644
--- a/sys-fs/mdadm/mdadm-4.3-r1.ebuild
+++ b/sys-fs/mdadm/mdadm-4.3-r1.ebuild
@@ -36,6 +36,7 @@ PATCHES=(
        "${FILESDIR}/${PN}"-4.3-ldflags.patch
        "${FILESDIR}/${PN}"-4.3-no-udev.patch
        "${FILESDIR}/${PN}"-4.3-musl125-1.patch
+       "${FILESDIR}/${PN}"-4.3-do-not-call-gcc-directly.patch # 931972
        "${WORKDIR}/debian/patches/debian/0001-fix-manpages.patch"
        
"${WORKDIR}/debian/patches/debian/0003-host-name-in-default-mailfrom.patch"
        
"${WORKDIR}/debian/patches/debian/0004-exit-gracefully-when-md-device-not-found.patch"

Reply via email to