Skip to content

Commit a5fc10e

Browse files
committed
add compilation support for Fedora, RHEL, and related distributions, as
well as openSUSE Signed-off-by: Valentin Dela <valdela@netc.fr>
1 parent f9ab640 commit a5fc10e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,17 @@ ifeq ($(GOOS),darwin)
597597
to_uname_m = $(foreach arch,$(1),$(shell echo $(arch) | sed 's/amd64/x86_64/'))
598598
else ifeq ($(GOOS),linux)
599599
# CC is required for cross-compiling on Linux.
600-
CC = $(call to_uname_m,$(GOARCH))-linux-gnu-gcc
600+
# On Debian, Ubuntu, and related distributions, compilers are named like x86_64-linux-gnu-gcc
601+
# On Fedora, RHEL, and related distributions, the equivalent is x86_64-redhat-linux-gcc
602+
# On openSUSE and as a generic fallback, gcc is used
603+
CC := $(shell \
604+
if command -v $(call to_uname_m,$(GOARCH))-redhat-linux-gcc >/dev/null 2>&1; then \
605+
echo $(call to_uname_m,$(GOARCH))-redhat-linux-gcc; \
606+
elif command -v $(call to_uname_m,$(GOARCH))-linux-gnu-gcc >/dev/null 2>&1; then \
607+
echo $(call to_uname_m,$(GOARCH))-linux-gnu-gcc; \
608+
else \
609+
echo gcc; \
610+
fi)
601611
else ifeq ($(GOOS),windows)
602612
# artifact in zip format also provided for Windows.
603613
ARTIFACT_FILE_EXTENSIONS += .zip

0 commit comments

Comments
 (0)