Skip to content

Commit ec95e76

Browse files
committed
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.
1 parent a9e2593 commit ec95e76

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

GNUmakefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ TOYBOX_ROOT := $(BASEDIR)/tmp
5757
TOYBOX_VER := 0.8.12
5858
TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER)
5959

60+
#------------------------------------------------------------------------
61+
# Detect the host system.
62+
# On Windows the environment already sets OS = Windows_NT.
63+
# Otherwise let it default to the kernel name returned by uname -s
64+
# (Linux, Darwin, FreeBSD, …).
65+
#------------------------------------------------------------------------
66+
OS ?= $(shell uname -s)
6067

6168
ifdef SELINUX_ENABLED
6269
override SELINUX_ENABLED := 0
@@ -179,6 +186,13 @@ SELINUX_PROGS := \
179186
chcon \
180187
runcon
181188

189+
$(info Detected OS = $(OS))
190+
191+
# Don't build the SELinux programs on macOS (Darwin)
192+
ifeq ($(OS),Darwin)
193+
SELINUX_PROGS :=
194+
endif
195+
182196
ifneq ($(OS),Windows_NT)
183197
PROGS := $(PROGS) $(UNIX_PROGS)
184198
# Build the selinux command even if not on the system

0 commit comments

Comments
 (0)