1 libsemanage: build: follow standard semantics for DESTDIR and PREFIX
3 This patch solves the following issues:
4 - DESTDIR is needed during compile time to compute library and header paths which it should not.
5 - Installing with both DESTDIR and PREFIX set gives us odd paths
6 - Make usage of DESTDIR and PREFIX more standard
8 Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
10 diff -durN libsemanage.orig/include/Makefile libsemanage/include/Makefile
11 --- libsemanage.orig/include/Makefile 2018-01-12 12:42:30.915376458 +0100
12 +++ libsemanage/include/Makefile 2018-01-12 10:04:18.632144240 +0100
14 # Installation directories.
15 -PREFIX ?= $(DESTDIR)/usr
16 -INCDIR ?= $(PREFIX)/include/semanage
18 +INCDIR ?= $(DESTDIR)$(PREFIX)/include/semanage
22 diff -durN libsemanage.orig/man/Makefile libsemanage/man/Makefile
23 --- libsemanage.orig/man/Makefile 2018-01-12 12:42:30.915376458 +0100
24 +++ libsemanage/man/Makefile 2018-01-12 10:04:18.632144240 +0100
26 # Installation directories.
27 -MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
28 -MAN5DIR ?= $(DESTDIR)/usr/share/man/man5
30 +MAN3DIR ?= $(DESTDIR)$(PREFIX)/share/man/man3
31 +MAN5DIR ?= $(DESTDIR)$(PREFIX)/share/man/man5
35 diff -durN libsemanage.orig/src/libsemanage.pc.in libsemanage/src/libsemanage.pc.in
36 --- libsemanage.orig/src/libsemanage.pc.in 2018-01-12 12:42:30.918709792 +0100
37 +++ libsemanage/src/libsemanage.pc.in 2018-01-12 10:04:18.632144240 +0100
41 -libdir=${exec_prefix}/@libdir@
43 includedir=@includedir@
46 diff -durN libsemanage.orig/src/Makefile libsemanage/src/Makefile
47 --- libsemanage.orig/src/Makefile 2018-01-12 12:42:30.918709792 +0100
48 +++ libsemanage/src/Makefile 2018-01-12 10:04:18.632144240 +0100
50 PKG_CONFIG ?= pkg-config
52 # Installation directories.
53 -PREFIX ?= $(DESTDIR)/usr
55 LIBDIR ?= $(PREFIX)/lib
56 -SHLIBDIR ?= $(DESTDIR)/lib
57 INCLUDEDIR ?= $(PREFIX)/include
58 +LIBINSTALL = $(DESTDIR)$(LIBDIR)
59 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
60 PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
61 PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
63 RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]')
64 RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
66 -LIBBASE=$(shell basename $(LIBDIR))
68 DEFAULT_SEMANAGE_CONF_LOCATION=$(DESTDIR)/etc/selinux/semanage.conf
74 $(LIBPC): $(LIBPC).in ../VERSION
75 - sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
76 + sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBDIR):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
78 semanageswig_python_exception.i: ../include/semanage/semanage.h
79 bash -e exception.sh > $@ || (rm -f $@ ; false)
84 - test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
85 - install -m 644 $(LIBA) $(LIBDIR)
86 - install -m 755 $(LIBSO) $(LIBDIR)
87 - test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
88 - install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
89 + test -d $(LIBINSTALL) || install -m 755 -d $(LIBINSTALL)
90 + install -m 644 $(LIBA) $(LIBINSTALL)
91 + install -m 755 $(LIBSO) $(LIBINSTALL)
92 + test -d $(LIBINSTALL)/pkgconfig || install -m 755 -d $(LIBINSTALL)/pkgconfig
93 + install -m 644 $(LIBPC) $(LIBINSTALL)/pkgconfig
94 test -f $(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION)
95 - cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
96 + cd $(LIBINSTALL) && ln -sf $(LIBSO) $(TARGET)
98 install-pywrap: pywrap
99 test -d $(PYSITEDIR) || install -m 755 -d $(PYSITEDIR)
101 install -m 755 $(SWIGRUBYSO) $(RUBYINSTALL)/semanage.so
104 - /sbin/restorecon $(LIBDIR)/$(LIBSO)
105 + /sbin/restorecon $(LIBINSTALL)/$(LIBSO)
108 -rm -f $(LIBPC) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(SWIGRUBYSO) $(TARGET) conf-parse.c conf-parse.h conf-scan.c *.o *.lo *~
109 diff -durN libsemanage.orig/tests/Makefile libsemanage/tests/Makefile
110 --- libsemanage.orig/tests/Makefile 2018-01-12 12:42:30.922043125 +0100
111 +++ libsemanage/tests/Makefile 2018-01-12 10:04:18.632144240 +0100
113 -PREFIX ?= $(DESTDIR)/usr
114 -LIBDIR ?= $(PREFIX)/lib
116 # Add your test source files here:
117 SOURCES = $(sort $(wildcard *.c))