Skip to content

Commit d050292

Browse files
authored
Allow to enable SELinux if libselinux is installed
1 parent 20d6347 commit d050292

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

GNUmakefile

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,9 @@ ifeq ($(OS),Windows_NT)
7676
endif
7777
LN ?= ln -sf
7878

79-
ifdef SELINUX_ENABLED
80-
override SELINUX_ENABLED := 0
81-
# Now check if we should enable it (only on non-Windows)
82-
ifneq ($(OS),Windows_NT)
83-
ifeq ($(shell if [ -x /sbin/selinuxenabled ] && /sbin/selinuxenabled 2>/dev/null; then echo 0; else echo 1; fi),0)
84-
override SELINUX_ENABLED := 1
85-
$(info /sbin/selinuxenabled successful)
86-
else
87-
$(info SELINUX_ENABLED=1 but /sbin/selinuxenabled failed)
88-
endif
89-
endif
79+
ifeq ($(SELINUX_ENABLED),1)
80+
# Allow to enable SELinux if libselinux is installed even /sbin/selinuxenabled fails
81+
SELINUX_ENABLED := $(shell pkg-config --exists libselinux && echo 1)
9082
endif
9183

9284
# Possible programs
@@ -217,14 +209,10 @@ HASHSUM_PROGS := \
217209

218210
$(info Detected OS = $(OS))
219211

220-
# Don't build the SELinux programs on macOS (Darwin) and FreeBSD
221-
ifeq ($(filter $(OS),Darwin FreeBSD),$(OS))
222-
SELINUX_PROGS :=
223-
endif
224-
225212
ifneq ($(OS),Windows_NT)
226213
PROGS := $(PROGS) $(UNIX_PROGS)
227-
# Build the selinux command even if not on the system
214+
endif
215+
ifeq ($(SELINUX_ENABLED),1)
228216
PROGS := $(PROGS) $(SELINUX_PROGS)
229217
endif
230218

0 commit comments

Comments
 (0)