Skip to content

Commit 2408bd6

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 d6de30e commit 2408bd6

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

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
@@ -180,6 +187,13 @@ SELINUX_PROGS := \
180187
chcon \
181188
runcon
182189

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

0 commit comments

Comments
 (0)