Skip to content

Commit 858db60

Browse files
authored
Merge pull request #7964 from kevinburke/no-selinux-mac
GNUMakefile: fix compilation on Macs
2 parents 1787471 + 24ff36e commit 858db60

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/workflows/CICD.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ jobs:
526526
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
527527
- { os: ubuntu-latest , target: wasm32-unknown-unknown , default-features: false, features: uucore/format, skip-tests: true, skip-package: true, skip-publish: true }
528528
- { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_macos, workspace-tests: true } # M1 CPU
529+
# PR #7964: Mac should still build even if the feature is not enabled
530+
- { os: macos-latest , target: aarch64-apple-darwin , workspace-tests: true } # M1 CPU
529531
- { os: macos-13 , target: x86_64-apple-darwin , features: feat_os_macos, workspace-tests: true }
530532
- { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows }
531533
- { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }

GNUmakefile

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

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

6269
ifdef SELINUX_ENABLED
6370
override SELINUX_ENABLED := 0
@@ -181,6 +188,13 @@ SELINUX_PROGS := \
181188
chcon \
182189
runcon
183190

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

0 commit comments

Comments
 (0)