Updates to Makefiles to fix bugs with LIBDIR/SHLIBDIR
cover Updates to Makefiles to fix bugs with LIBDIR/SHLIBDIR
These patches fix two installation issues. The first in libsemanage where LIBDIR and SHLIBDIR do not resolve to the same location. The second in libsepol and libselinux where SHLIBDIR is not ../../ relative to LIBDIR.
Steve Lawrence (2):
libsemanage: install to LIBDIR instead of SHLIBDIR
libselinux: libsepol: use ln --relative to create .so symlinks
libselinux/src/Makefile | 2 +- libsemanage/src/Makefile | 7 +++---- libsepol/src/Makefile | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/2 libsemanage: install to LIBDIR instead of SHLIBDIR
The libsemanage Makefile currently installs libsemanage.so.1 into SHLIBDIR, but links libsemanage.so to libsemanage.so.1 in LIBDIR. This means things will only work if SHLIBDIR and LIBDIR are the same. Fortunately, by default, they are the same because the default of SHLIBDIR is set to PREFIX/lib (same as LIBDIR default) instead of the standard DESTDIR/lib. Unfortunately, if a user overrides SHLIBDIR, by doing something like the following:
make DESTDIR=~/tmp/ LIBDIR=~/tmp/usr/lib SHLIBDIR=~/tmp/lib install
then a broken symlink is created. Note that in some cases this may still work even when SHLIBDIR and LIBDIR are not the same, e.g.:
make LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install
But this only works because, in systems like Fedora, /lib is a symlink to /usr/lib, so SHLIBDIR and LIBDIR are the same even though it doesn't immediately look like it.
This patch changes the libsemanage Makefile to set the default value of SHLIBDIR to the standard DESTDIR/lib to prevent confusion, and installs libsemanage to LIBDIR and completely ignores SHLIBDIR.
--- libsemanage/src/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
libsemanage/src/Makefile +3 -4
@@ -9,7 +9,7 @@ RUBYPREFIX ?= $(notdir $(RUBY)) # Installation directories. PREFIX ?= $(DESTDIR)/usr LIBDIR ?= $(PREFIX)/lib -SHLIBDIR ?= $(PREFIX)/lib +SHLIBDIR ?= $(DESTDIR)/lib INCLUDEDIR ?= $(PREFIX)/include PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])') PYINC ?= $(shell pkg-config --cflags $(PYPREFIX))
@@ -139,8 +139,7 @@ swigify: $(SWIGIF) install: all test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) install -m 644 $(LIBA) $(LIBDIR) - test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) - install -m 755 $(LIBSO) $(SHLIBDIR) + install -m 755 $(LIBSO) $(LIBDIR) test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig test -f $(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION)
@@ -157,7 +156,7 @@ install-rubywrap: rubywrap install -m 755 $(SWIGRUBYSO) $(RUBYINSTALL)/semanage.so relabel: - /sbin/restorecon $(SHLIBDIR)/$(LIBSO) + /sbin/restorecon $(LIBDIR)/$(LIBSO) clean: -rm -f $(LIBPC) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(TARGET) conf-parse.c conf-parse.h conf-scan.c *.o *.lo *~
Signature · 1 line
1.9.3
PATCH 2/2 libselinux: libsepol: use ln --relative to create .so symlinks
In reply to Steve LawrenceThe current build system assumes SHLIBDIR is ../../ relative to LIBDIR. However, this isn't always the case. For example, Arch Linux sets both LIBDIR and SHLIBDIR to /usr/lib, which results in broken symlinks.
Instead of making that assumption, create .so symlinks using ln --relative so that the correct relative paths are used. Note that this adds a dependency for the build system to use coretuils-8.16 or later.
Fixes #2
--- libselinux/src/Makefile | 2 +- libsepol/src/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libselinux/src/Makefile +1 -1
@@ -148,7 +148,7 @@ install: all install -m 755 $(LIBSO) $(SHLIBDIR) test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig - cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET) + ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) install-pywrap: pywrap test -d $(PYLIBDIR)/site-packages/selinux || install -m 755 -d $(PYLIBDIR)/site-packages/selinux
libsepol/src/Makefile +1 -1
@@ -70,7 +70,7 @@ install: all install -m 755 $(LIBSO) $(SHLIBDIR) test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig - cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET) + ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) relabel: /sbin/restorecon $(SHLIBDIR)/$(LIBSO)
Signature · 1 line
1.9.3