From a5fc10e8898e9e12e48464a15de1d59a30174ccc Mon Sep 17 00:00:00 2001 From: Valentin Dela Date: Sun, 19 Oct 2025 17:29:40 +0200 Subject: [PATCH] add compilation support for Fedora, RHEL, and related distributions, as well as openSUSE Signed-off-by: Valentin Dela --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7c5f7d1eef9..10c3ebb479f 100644 --- a/Makefile +++ b/Makefile @@ -597,7 +597,17 @@ ifeq ($(GOOS),darwin) to_uname_m = $(foreach arch,$(1),$(shell echo $(arch) | sed 's/amd64/x86_64/')) else ifeq ($(GOOS),linux) # CC is required for cross-compiling on Linux. -CC = $(call to_uname_m,$(GOARCH))-linux-gnu-gcc +# On Debian, Ubuntu, and related distributions, compilers are named like x86_64-linux-gnu-gcc +# On Fedora, RHEL, and related distributions, the equivalent is x86_64-redhat-linux-gcc +# On openSUSE and as a generic fallback, gcc is used +CC := $(shell \ + if command -v $(call to_uname_m,$(GOARCH))-redhat-linux-gcc >/dev/null 2>&1; then \ + echo $(call to_uname_m,$(GOARCH))-redhat-linux-gcc; \ + elif command -v $(call to_uname_m,$(GOARCH))-linux-gnu-gcc >/dev/null 2>&1; then \ + echo $(call to_uname_m,$(GOARCH))-linux-gnu-gcc; \ + else \ + echo gcc; \ + fi) else ifeq ($(GOOS),windows) # artifact in zip format also provided for Windows. ARTIFACT_FILE_EXTENSIONS += .zip