From 2408bd6b3647ec13b2b1f5d373efc7d0cc354b46 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Tue, 20 May 2025 10:25:28 -0700 Subject: [PATCH] GNUMakefile: fix compilation on Macs Previously, attempting to compile on Macs would bring in the SELinux dependencies (runcon) which led to compilation errors on Macs. Fixes #7695. --- GNUmakefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/GNUmakefile b/GNUmakefile index a80b10ec8..43d8bba82 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -57,6 +57,13 @@ TOYBOX_ROOT := $(BASEDIR)/tmp TOYBOX_VER := 0.8.12 TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER) +#------------------------------------------------------------------------ +# Detect the host system. +# On Windows the environment already sets OS = Windows_NT. +# Otherwise let it default to the kernel name returned by uname -s +# (Linux, Darwin, FreeBSD, …). +#------------------------------------------------------------------------ +OS ?= $(shell uname -s) ifdef SELINUX_ENABLED override SELINUX_ENABLED := 0 @@ -180,6 +187,13 @@ SELINUX_PROGS := \ chcon \ runcon +$(info Detected OS = $(OS)) + +# Don't build the SELinux programs on macOS (Darwin) +ifeq ($(OS),Darwin) + SELINUX_PROGS := +endif + ifneq ($(OS),Windows_NT) PROGS := $(PROGS) $(UNIX_PROGS) # Build the selinux command even if not on the system