Hi SELinux maintainers,
While cross-compiling libsepol for an embedded target, I noticed an inconsistency in the installation paths defined in the top-level Makefile:
- Static library (
libsepol.a) and .pc file are installed to:
$(DESTDIR)$(LIBDIR) → typically /usr/lib under PREFIX
- Shared library (
libsepol.so.X.Y) is installed to:
$(DESTDIR)$(SHLIBDIR) → hardcoded as /lib, outside of PREFIX
This causes the actual .so file to be installed into my host system’s /lib, rather than under the intended staging directory ($(PREFIX)/lib), which breaks packaging and pollutes the host system during cross-compilation.
Here's the Makefile in the src directory of the libsepol source:
PREFIX ?= /usr
INCLUDEDIR ?= $(PREFIX)/include
LIBDIR ?= $(PREFIX)/lib
SHLIBDIR ?= /lib
RANLIB ?= ranlib
CILDIR ?= ../cil
......
install: all
test -d $(DESTDIR)$(LIBDIR) || install -m 755 -d $(DESTDIR)$(LIBDIR)
install -m 644 $(LIBA) $(DESTDIR)$(LIBDIR)
test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig
install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig
ifneq ($(DISABLE_SHARED),y)
test -d $(DESTDIR)$(SHLIBDIR) || install -m 755 -d $(DESTDIR)$(SHLIBDIR)
install -m 755 $(LIBSO) $(DESTDIR)$(SHLIBDIR)
$(LN) -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
endif
Hi SELinux maintainers,
While cross-compiling libsepol for an embedded target, I noticed an inconsistency in the installation paths defined in the top-level Makefile:
libsepol.a) and.pcfile are installed to:$(DESTDIR)$(LIBDIR)→ typically/usr/libunderPREFIXlibsepol.so.X.Y) is installed to:$(DESTDIR)$(SHLIBDIR)→ hardcoded as/lib, outside ofPREFIXThis causes the actual
.sofile to be installed into my host system’s/lib, rather than under the intended staging directory ($(PREFIX)/lib), which breaks packaging and pollutes the host system during cross-compilation.Here's the Makefile in the src directory of the libsepol source: