Skip to contentSkip to conversation

libsepol: fix TARGET and LIBSO on Darwin

PATCH In review Caleb Xu 2 participants 3 messages Sep 12, 2025 – Oct 7, 2025 SELinux security module

lore
Share & tools
lore

Caleb Xu

author
#0 lore raw

PATCH 1/1 libsepol: fix TARGET and LIBSO on Darwin

On macOS (Darwin), shared libraries have the extension .dylib and the soversion is between the basename and the extension, e.g. libfoo.1.2.3.dylib, which differs from the usual libfoo.so.1.2.3 scheme in Linux.

This change sets the TARGET and LIBSO variables appropriately in the Makefile for libsepol when building on macOS.

---
 libsepol/src/Makefile | 2 ++
 1 file changed, 2 insertions(+)
libsepol/src/Makefile +2 -0
index a1aed072..90aed394 100644
@@ -40,6 +40,8 @@ LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=$(LIBMAP),-z,defs
 LN=ln
 OS := $(shell uname)
 ifeq ($(OS), Darwin)
+TARGET=libsepol.dylib
+LIBSO=libsepol.$(LIBVERSION).dylib
 LD_SONAME_FLAGS=-install_name,$(LIBSO)
 LDFLAGS += -undefined dynamic_lookup
 LN=gln
Signature · 1 line
2.39.5 (Apple Git-154)
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Caleb Xu

On macOS (Darwin), shared libraries have the extension .dylib and the soversion is between the basename and the extension, e.g. libfoo.1.2.3.dylib, which differs from the usual libfoo.so.1.2.3 scheme in Linux.

This change sets the TARGET and LIBSO variables appropriately in the Makefile for libsepol when building on macOS.

I am not a macOS user so I can't test this myself but it looks fine to me.

Quoted 21 lines
---
 libsepol/src/Makefile | 2 ++
 1 file changed, 2 insertions(+)
libsepol/src/Makefile +2 -1
index a1aed072..90aed394 100644
@@ -40,6 +40,8 @@ LD_SONAME_FLAGS=-soname,$(LIBSO),--version-script=$(LIBMAP),-z,defs
 LN=ln
 OS := $(shell uname)
 ifeq ($(OS), Darwin)
+TARGET=libsepol.dylib
+LIBSO=libsepol.$(LIBVERSION).dylib
 LD_SONAME_FLAGS=-install_name,$(LIBSO)
 LDFLAGS += -undefined dynamic_lookup
 LN=gln
--

2.39.5 (Apple Git-154)

maintainer
#2 lore raw
Quoted 7 lines · Stephen Smalley
Quoted 5 lines · Caleb Xu

On macOS (Darwin), shared libraries have the extension .dylib and the soversion is between the basename and the extension, e.g. libfoo.1.2.3.dylib, which differs from the usual libfoo.so.1.2.3 scheme in Linux.

Quoted 8 lines
Quoted 4 lines

This change sets the TARGET and LIBSO variables appropriately in the Makefile for libsepol when building on macOS.

I am not a macOS user so I can't test this myself but it looks fine to me.

Thanks, merged.