Skip to contentSkip to conversation

build: Make sure SHLIBDIR respects PREFIX

PATCH In review Rahul Sandhu 2 participants 2 messages Sep 25, 2025 – Oct 6, 2025 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: Make sure SHLIBDIR respects PREFIX

Not respecting PREFIX can pollute the environment in various build configurations. LIBDIR already respects it, so we may as well make SHLIBDIR respect PREFIX too. Fixes #494 on Github[1].

[1] https://github.com/SELinuxProject/selinux/issues/494

---
 libselinux/src/Makefile | 2 +-
 libsepol/src/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
libselinux/src/Makefile +1 -1
index 261c22d4..c855e759 100644
@@ -10,7 +10,7 @@ PKG_CONFIG ?= pkg-config
 # Installation directories.
 PREFIX ?= /usr
 LIBDIR ?= $(PREFIX)/lib
-SHLIBDIR ?= /lib
+SHLIBDIR ?= $(PREFIX)/lib
 INCLUDEDIR ?= $(PREFIX)/include
 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
 PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
libsepol/src/Makefile +1 -1
index a1aed072..f8574d70 100644
@@ -2,7 +2,7 @@
 PREFIX ?= /usr
 INCLUDEDIR ?= $(PREFIX)/include
 LIBDIR ?= $(PREFIX)/lib
-SHLIBDIR ?= /lib
+SHLIBDIR ?= $(PREFIX)/lib
 RANLIB ?= ranlib
 CILDIR ?= ../cil
 
Signature · 1 line
2.50.1
maintainer
#1 lore raw
Quoted 6 lines · Rahul Sandhu

Not respecting PREFIX can pollute the environment in various build configurations. LIBDIR already respects it, so we may as well make SHLIBDIR respect PREFIX too. Fixes #494 on Github[1].

[1] https://github.com/SELinuxProject/selinux/issues/494

If you don't have usrmerge, this can produce the wrong result by default, i.e. installing shared libraries to /usr/lib instead of /lib.

Quoted 37 lines
---
 libselinux/src/Makefile | 2 +-
 libsepol/src/Makefile   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
libselinux/src/Makefile +1 -1
index 261c22d4..c855e759 100644
@@ -10,7 +10,7 @@ PKG_CONFIG ?= pkg-config
 # Installation directories.
 PREFIX ?= /usr
 LIBDIR ?= $(PREFIX)/lib
-SHLIBDIR ?= /lib
+SHLIBDIR ?= $(PREFIX)/lib
 INCLUDEDIR ?= $(PREFIX)/include
 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
 PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
libsepol/src/Makefile +1 -2
index a1aed072..f8574d70 100644
@@ -2,7 +2,7 @@
 PREFIX ?= /usr
 INCLUDEDIR ?= $(PREFIX)/include
 LIBDIR ?= $(PREFIX)/lib
-SHLIBDIR ?= /lib
+SHLIBDIR ?= $(PREFIX)/lib
 RANLIB ?= ranlib
 CILDIR ?= ../cil
 
--

2.50.1