Skip to contentSkip to conversation

libsepol compilation fixes for macOS.

PATCH Applied Karl MacMillan 2 participants 2 messages Jan 20, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol compilation fixes for macOS.

ln on macOS doesn't support --relative, so use the gnu version by default.

Also document how to build on macOS.

---
 README                | 5 +++++
 libsepol/src/Makefile | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)
README +5 -0
index e6f7276..7fc7b17 100644
@@ -17,3 +17,8 @@ make install install-pywrap relabel
 This may render your system unusable if the upstream SELinux userspace
 lacks library functions or other dependencies relied upon by your
 distribution.  If it breaks, you get to keep both pieces.
+
+To install libsepol on macOS (mainly for policy analysis):
+cd libsepol; make DESTDIR=/usr/local PREFIX=/usr/local install
+
+This requires GNU coreutils (brew install coreutils).
libsepol/src/Makefile +3 -1
index 497cd56..819d261 100644
@@ -32,10 +32,12 @@ endif
 
 LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=$(LIBMAP),-z,defs
 
+LN=ln
 OS := $(shell uname)
 ifeq ($(OS), Darwin)
 LD_SONAME_FLAGS=-install_name,$(LIBSO)
 LDFLAGS += -undefined dynamic_lookup
+LN=gln
 endif
 
 all: $(LIBA) $(LIBSO) $(LIBPC)
@@ -84,7 +86,7 @@ install: all
 	install -m 755 $(LIBSO) $(SHLIBDIR)
 	test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
 	install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
-	ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
+	$(LN) -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
 
 relabel:
 	/sbin/restorecon $(SHLIBDIR)/$(LIBSO)
Signature · 1 line
2.6.2
#1 lore raw
Quoted 4 lines · Karl MacMillan

ln on macOS doesn't support --relative, so use the gnu version by default.

Also document how to build on macOS.

Thanks, applied.

Quoted 49 lines

---
 README                | 5 +++++
 libsepol/src/Makefile | 4 +++-

 2 files changed, 8 insertions(+), 1 deletion(-)
README +0 -0
index e6f7276..7fc7b17 100644
@@ -17,3 +17,8 @@ make install install-pywrap relabel

 This may render your system unusable if the upstream SELinux userspace
 lacks library functions or other dependencies relied upon by your distribution.  If it breaks, you get to keep both pieces.

README +5 -0
+
+To install libsepol on macOS (mainly for policy analysis):
+cd libsepol; make DESTDIR=/usr/local PREFIX=/usr/local install
+
+This requires GNU coreutils (brew install coreutils).
libsepol/src/Makefile +0 -0
index 497cd56..819d261 100644
@@ -32,10 +32,12 @@ endif

LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=$(LIBMAP),-z,defs
+LN=ln
 OS := $(shell uname)
 ifeq ($(OS), Darwin) LD_SONAME_FLAGS=-install_name,$(LIBSO)
 LDFLAGS += -undefined dynamic_lookup
+LN=gln
 endif

 all: $(LIBA) $(LIBSO) $(LIBPC)

libsepol/src/Makefile +0 -0
@@ -84,7 +86,7 @@ install: all
  	install -m 755 $(LIBSO) $(SHLIBDIR)

  test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
  install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig

libsepol/src/Makefile +1 -1
-	ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
+	$(LN) -sf --relative $(SHLIBDIR)/$(LIBSO)

$(LIBDIR)/$(TARGET)

 relabel:
  /sbin/restorecon $(SHLIBDIR)/$(LIBSO)