Rework of makefiles v5
Subsystems (2)
I have updated the patchset.
The biggest change is that $(DESTDIR) is now used in the install stage only.
Also some overidden CFLAGS/LDFLAGS has been removed since we now have explicit build rules.
I have moved the changelog into patches.
Please test to compile with:
make DESTDIR=/tmp/myroot PREFIX=/myusr install
or
make DESTDIR=/tmp/myroot install
Thanks for all feedback.
Best regards
Marcus Folkesson
PATCH v5 1/15 libsepol: build: follow standard semantics for DESTDIR and PREFIX
This patch solves the following issues:
- The pkg-config files generates odd paths when using DESTDIR without PREFIX
- DESTDIR is needed during compile time to compute library and header paths which it should not.
- Installing with both DESTDIR and PREFIX set gives us odd paths
- Make usage of DESTDIR and PREFIX more standard
---
Notes:
v5:
- Only use $(DESTDIR) in install
v4:
- Introduce LDLIBS_LIBSEPOLA if LIBSEPOLA is not defined.
v2:
- Use separate directories for shared libraries as before( Comment from Stephen Smalley)
- Rework all packages (not just selinux/sepol/semanage)
README | 2 +- libsepol/include/Makefile | 16 ++++++++-------- libsepol/man/Makefile | 13 +++++++------ libsepol/src/Makefile | 23 +++++++++++------------ libsepol/src/libsepol.pc.in | 2 +- libsepol/utils/Makefile | 6 +++--- 6 files changed, 31 insertions(+), 31 deletions(-)
README +1 -1
@@ -19,6 +19,6 @@ lacks library functions or other dependencies relied upon by your distribution. If it breaks, you get to keep both pieces. To install libsepol on macOS (mainly for policy analysis): -cd libsepol; make DESTDIR=/usr/local PREFIX=/usr/local install +cd libsepol; make PREFIX=/usr/local install This requires GNU coreutils (brew install coreutils).
libsepol/include/Makefile +8 -8
@@ -1,17 +1,17 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCDIR ?= $(PREFIX)/include/sepol +PREFIX ?= /usr +INCDIR = $(PREFIX)/include/sepol CILDIR ?= ../cil all: install: all - test -d $(INCDIR) || install -m 755 -d $(INCDIR) - test -d $(INCDIR)/policydb || install -m 755 -d $(INCDIR)/policydb - test -d $(INCDIR)/cil || install -m 755 -d $(INCDIR)/cil - install -m 644 $(wildcard sepol/*.h) $(INCDIR) - install -m 644 $(wildcard sepol/policydb/*.h) $(INCDIR)/policydb - install -m 644 $(wildcard $(CILDIR)/include/cil/*.h) $(INCDIR)/cil + test -d $(DESTDIR)$(INCDIR) || install -m 755 -d $(DESTDIR)$(INCDIR) + test -d $(DESTDIR)$(INCDIR)/policydb || install -m 755 -d $(DESTDIR)$(INCDIR)/policydb + test -d $(DESTDIR)$(INCDIR)/cil || install -m 755 -d $(DESTDIR)$(INCDIR)/cil + install -m 644 $(wildcard sepol/*.h) $(DESTDIR)$(INCDIR) + install -m 644 $(wildcard sepol/policydb/*.h) $(DESTDIR)$(INCDIR)/policydb + install -m 644 $(wildcard $(CILDIR)/include/cil/*.h) $(DESTDIR)$(INCDIR)/cil indent: ../../scripts/Lindent $(wildcard sepol/*.h)
libsepol/man/Makefile +7 -6
@@ -1,12 +1,13 @@ # Installation directories. -MAN8DIR ?= $(DESTDIR)/usr/share/man/man8 -MAN3DIR ?= $(DESTDIR)/usr/share/man/man3 +PREFIX ?= /usr +MAN8DIR ?= $(PREFIX)/share/man/man8 +MAN3DIR ?= $(PREFIX)/share/man/man3 all: install: all - mkdir -p $(MAN3DIR) - mkdir -p $(MAN8DIR) - install -m 644 man3/*.3 $(MAN3DIR) - install -m 644 man8/*.8 $(MAN8DIR) + mkdir -p $(DESTDIR)$(MAN3DIR) + mkdir -p $(DESTDIR)$(MAN8DIR) + install -m 644 man3/*.3 $(DESTDIR)$(MAN3DIR) + install -m 644 man8/*.8 $(DESTDIR)$(MAN8DIR)
libsepol/src/Makefile +11 -12
@@ -1,10 +1,9 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr INCLUDEDIR ?= $(PREFIX)/include LIBDIR ?= $(PREFIX)/lib -SHLIBDIR ?= $(DESTDIR)/lib +SHLIBDIR ?= /lib RANLIB ?= ranlib -LIBBASE ?= $(shell basename $(LIBDIR)) CILDIR ?= ../cil VERSION = $(shell cat ../VERSION)
@@ -52,7 +51,7 @@ $(LIBSO): $(LOBJS) $(LIBMAP) ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION - sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@ + sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBDIR):; s:@includedir@:$(INCLUDEDIR):' < $< > $@ $(LIBMAP): $(LIBMAP).in ifneq ($(DISABLE_CIL),y)
@@ -80,16 +79,16 @@ endif $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< 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) - test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig - install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig - $(LN) -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) + test -d $(DESTDIR)$(LIBDIR) || install -m 755 -d $(DESTDIR)$(LIBDIR) + install -m 644 $(LIBA) $(DESTDIR)$(LIBDIR) + test -d $(DESTDIR)$(SHLIBDIR) || install -m 755 -d $(DESTDIR)$(SHLIBDIR) + install -m 755 $(LIBSO) $(DESTDIR)$(SHLIBDIR) + test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig + install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig + $(LN) -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET) relabel: - /sbin/restorecon $(SHLIBDIR)/$(LIBSO) + /sbin/restorecon $(DESTDIR)$(SHLIBDIR)/$(LIBSO) clean: -rm -f $(LIBPC) $(LIBMAP) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(TARGET) $(CIL_GENERATED)
libsepol/src/libsepol.pc.in +1 -1
@@ -1,6 +1,6 @@ prefix=@prefix@ exec_prefix=${prefix} -libdir=${exec_prefix}/@libdir@ +libdir=@libdir@ includedir=@includedir@ Name: libsepol
libsepol/utils/Makefile +3 -3
@@ -1,5 +1,5 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin CFLAGS ?= -Wall -Werror
@@ -12,8 +12,8 @@ TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c))) all: $(TARGETS) install: all - -mkdir -p $(BINDIR) - install -m 755 $(TARGETS) $(BINDIR) + -mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 $(TARGETS) $(DESTDIR)$(BINDIR) clean: -rm -f $(TARGETS) *.o
Signature · 1 line
2.15.1
PATCH v5 2/15 libselinux: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus FolkessonThis patch solves the following issues:
- The pkg-config files generates odd paths when using DESTDIR without PREFIX
- DESTDIR is needed during compile time to compute library and header paths which it should not.
- Installing with both DESTDIR and PREFIX set gives us odd paths
- Make usage of DESTDIR and PREFIX more standard
---
Notes:
v5:
- Only use $(DESTDIR) in install
v4:
- move platform from platform specific to platform shared installation directory
- Introduce LDLIBS_LIBSEPOLA if LIBSEPOLA is not defined.
v3:
- keep the possibility to specify LIBSEPOLA to
make depending component recompile on change. If not specified, fall back to libsepola in LDFLAGS path.
v2:
- Use separate directories for shared libraries as before( Comment from Stephen Smalley)
- Rework all packages (not just selinux/sepol/semanage)
libselinux/include/Makefile | 8 +++---- libselinux/man/Makefile | 19 ++++++++-------- libselinux/src/Makefile | 49 +++++++++++++++++++++++------------------ libselinux/src/libselinux.pc.in | 2 +- libselinux/utils/Makefile | 8 +++---- 5 files changed, 45 insertions(+), 41 deletions(-)
libselinux/include/Makefile +4 -4
@@ -1,12 +1,12 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCDIR ?= $(PREFIX)/include/selinux +PREFIX ?= /usr +INCDIR = $(PREFIX)/include/selinux all: install: all - test -d $(INCDIR) || install -m 755 -d $(INCDIR) - install -m 644 $(wildcard selinux/*.h) $(INCDIR) + test -d $(DESTDIR)$(INCDIR) || install -m 755 -d $(DESTDIR)$(INCDIR) + install -m 644 $(wildcard selinux/*.h) $(DESTDIR)$(INCDIR) relabel:
libselinux/man/Makefile +10 -9
@@ -1,17 +1,18 @@ # Installation directories. -MAN8DIR ?= $(DESTDIR)/usr/share/man/man8 -MAN5DIR ?= $(DESTDIR)/usr/share/man/man5 -MAN3DIR ?= $(DESTDIR)/usr/share/man/man3 +PREFIX ?= /usr +MAN8DIR ?= $(PREFIX)/share/man/man8 +MAN5DIR ?= $(PREFIX)/share/man/man5 +MAN3DIR ?= $(PREFIX)/share/man/man3 all: install: all - mkdir -p $(MAN3DIR) - mkdir -p $(MAN5DIR) - mkdir -p $(MAN8DIR) - install -m 644 man3/*.3 $(MAN3DIR) - install -m 644 man5/*.5 $(MAN5DIR) - install -m 644 man8/*.8 $(MAN8DIR) + mkdir -p $(DESTDIR)$(MAN3DIR) + mkdir -p $(DESTDIR)$(MAN5DIR) + mkdir -p $(DESTDIR)$(MAN8DIR) + install -m 644 man3/*.3 $(DESTDIR)$(MAN3DIR) + install -m 644 man5/*.5 $(DESTDIR)$(MAN5DIR) + install -m 644 man8/*.8 $(DESTDIR)$(MAN8DIR) relabel:
libselinux/src/Makefile +27 -22
92 lines not on this page · raw message
libselinux/src/libselinux.pc.in +1 -1
@@ -1,6 +1,6 @@ prefix=@prefix@ exec_prefix=${prefix} -libdir=${exec_prefix}/@libdir@ +libdir=@libdir@ includedir=@includedir@ Name: libselinux
libselinux/utils/Makefile +3 -5
@@ -1,8 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin -INCLUDEDIR ?= $(PREFIX)/include OS ?= $(shell uname)
@@ -63,8 +61,8 @@ sefcontext_compile: sefcontext_compile.o ../src/regex.o all: $(TARGETS) install: all - -mkdir -p $(SBINDIR) - install -m 755 $(TARGETS) $(SBINDIR) + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 $(TARGETS) $(DESTDIR)$(SBINDIR) clean: rm -f $(TARGETS) *.o *~
Signature · 1 line
2.15.1
PATCH v5 3/15 libsemanage: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus FolkessonThis patch solves the following issues:
- DESTDIR is needed during compile time to compute library and header paths which it should not.
- Installing with both DESTDIR and PREFIX set gives us odd paths
- Make usage of DESTDIR and PREFIX more standard
---
Notes:
v5:
- Only use $(DESTDIR) in install
v4:
- Introduce LDLIBS_LIBSEPOLA if LIBSEPOLA is not defined.
v3:
- keep the possibility to specify LIBSEPOLA to
make depending component recompile on change. If not specified, fall back to libsepola in LDFLAGS path.
v2:
- Use separate directories for shared libraries as before( Comment from Stephen Smalley)
- Rework all packages (not just selinux/sepol/semanage)
v4:
- Introduce LDLIBS_LIBSEPOLA if LIBSEPOLA is not defined.
v2:
- Use separate directories for shared libraries as before( Comment from Stephen Smalley)
- Rework all packages (not just selinux/sepol/semanage)
libsemanage/include/Makefile | 6 +++--- libsemanage/man/Makefile | 13 +++++++------ libsemanage/src/Makefile | 39 ++++++++++++++++++--------------------- libsemanage/src/libsemanage.pc.in | 2 +- libsemanage/tests/Makefile | 3 --- libsemanage/utils/Makefile | 6 +++--- 6 files changed, 32 insertions(+), 37 deletions(-)
libsemanage/include/Makefile +3 -3
@@ -1,12 +1,12 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr INCDIR ?= $(PREFIX)/include/semanage all: install: all - test -d $(INCDIR) || install -m 755 -d $(INCDIR) - install -m 644 $(wildcard semanage/*.h) $(INCDIR) + test -d $(DESTDIR)$(INCDIR) || install -m 755 -d $(DESTDIR)$(INCDIR) + install -m 644 $(wildcard semanage/*.h) $(DESTDIR)$(INCDIR) indent: ../../scripts/Lindent $(wildcard semanage/*.h)
libsemanage/man/Makefile +7 -6
@@ -1,12 +1,13 @@ # Installation directories. -MAN3DIR ?= $(DESTDIR)/usr/share/man/man3 -MAN5DIR ?= $(DESTDIR)/usr/share/man/man5 +PREFIX ?= /usr +MAN3DIR ?= $(PREFIX)/share/man/man3 +MAN5DIR ?= $(PREFIX)/share/man/man5 all: install: all - mkdir -p $(MAN3DIR) - mkdir -p $(MAN5DIR) - install -m 644 man3/*.3 $(MAN3DIR) - install -m 644 man5/*.5 $(MAN5DIR) + mkdir -p $(DESTDIR)$(MAN3DIR) + mkdir -p $(DESTDIR)$(MAN5DIR) + install -m 644 man3/*.3 $(DESTDIR)$(MAN3DIR) + install -m 644 man5/*.5 $(DESTDIR)$(MAN5DIR)
libsemanage/src/Makefile +18 -21
@@ -8,21 +8,18 @@ RUBYPREFIX ?= $(notdir $(RUBY)) PKG_CONFIG ?= pkg-config # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr LIBDIR ?= $(PREFIX)/lib -SHLIBDIR ?= $(DESTDIR)/lib INCLUDEDIR ?= $(PREFIX)/include PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX)) PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX)) -PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])') +PYSITEDIR ?= $(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])') PYCEXT ?= $(shell $(PYTHON) -c 'import imp;print([s for s,m,t in imp.get_suffixes() if t == imp.C_EXTENSION][0])') RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] + " -I" + RbConfig::CONFIG["rubyhdrdir"]') RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]') -RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]') +RUBYINSTALL ?= $(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]') -LIBBASE=$(shell basename $(LIBDIR)) - -DEFAULT_SEMANAGE_CONF_LOCATION=$(DESTDIR)/etc/selinux/semanage.conf +DEFAULT_SEMANAGE_CONF_LOCATION=/etc/selinux/semanage.conf ifeq ($(DEBUG),1) export CFLAGS = -g3 -O0 -gdwarf-2 -fno-strict-aliasing -Wall -Wshadow -Werror
@@ -95,7 +92,7 @@ $(LIBSO): $(LOBJS) ln -sf $@ $(TARGET) $(LIBPC): $(LIBPC).in ../VERSION - sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@ + sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBDIR):; s:@includedir@:$(INCLUDEDIR):' < $< > $@ semanageswig_python_exception.i: ../include/semanage/semanage.h bash -e exception.sh > $@ || (rm -f $@ ; false)
@@ -136,26 +133,26 @@ swigify: $(SWIGIF) $(SWIG) $< install: all - test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) - install -m 644 $(LIBA) $(LIBDIR) - 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) - cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET) + test -d $(DESTDIR)$(LIBDIR) || install -m 755 -d $(DESTDIR)$(LIBDIR) + install -m 644 $(LIBA) $(DESTDIR)$(LIBDIR) + install -m 755 $(LIBSO) $(DESTDIR)$(LIBDIR) + test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig + install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig + test -f $(DESTDIR)$(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D semanage.conf $(DESTDIR)$(DEFAULT_SEMANAGE_CONF_LOCATION) + cd $(DESTDIR)$(LIBDIR) && ln -sf $(LIBSO) $(TARGET) install-pywrap: pywrap - test -d $(PYSITEDIR) || install -m 755 -d $(PYSITEDIR) - install -m 755 $(SWIGSO) $(PYSITEDIR)/_semanage$(PYCEXT) - install -m 644 semanage.py $(PYSITEDIR) + test -d $(DESTDIR)$(PYSITEDIR) || install -m 755 -d $(DESTDIR)$(PYSITEDIR) + install -m 755 $(SWIGSO) $(DESTDIR)$(PYSITEDIR)/_semanage$(PYCEXT) + install -m 644 semanage.py $(DESTDIR)$(PYSITEDIR) install-rubywrap: rubywrap - test -d $(RUBYINSTALL) || install -m 755 -d $(RUBYINSTALL) - install -m 755 $(SWIGRUBYSO) $(RUBYINSTALL)/semanage.so + test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL) + install -m 755 $(SWIGRUBYSO) $(DESTDIR)$(RUBYINSTALL)/semanage.so relabel: - /sbin/restorecon $(LIBDIR)/$(LIBSO) + /sbin/restorecon $(DESTDIR)$(LIBDIR)/$(LIBSO) clean: -rm -f $(LIBPC) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(SWIGRUBYSO) $(TARGET) conf-parse.c conf-parse.h conf-scan.c *.o *.lo *~
libsemanage/src/libsemanage.pc.in +1 -1
@@ -1,6 +1,6 @@ prefix=@prefix@ exec_prefix=${prefix} -libdir=${exec_prefix}/@libdir@ +libdir=@libdir@ includedir=@includedir@ Name: libsemanage
libsemanage/tests/Makefile +0 -3
@@ -1,6 +1,3 @@ -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib - # Add your test source files here: SOURCES = $(sort $(wildcard *.c))
libsemanage/utils/Makefile +3 -3
@@ -1,13 +1,13 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr LIBEXECDIR ?= $(PREFIX)/libexec SELINUXEXECDIR ?= $(LIBEXECDIR)/selinux/ all: install: all - -mkdir -p $(SELINUXEXECDIR) - install -m 755 semanage_migrate_store $(SELINUXEXECDIR) + -mkdir -p $(DESTDIR)$(SELINUXEXECDIR) + install -m 755 semanage_migrate_store $(DESTDIR)$(SELINUXEXECDIR) clean:
Signature · 1 line
2.15.1
PATCH v5 4/15 checkpolicy: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus FolkessonThis patch solves the following issues:
- DESTDIR is needed during compile time to compute library and header paths which it should not.
- Installing with both DESTDIR and PREFIX set gives us odd paths
- Make usage of DESTDIR and PREFIX more standard
---
Notes:
v5:
- Only use $(DESTDIR) in install
- Remove CFLAGS from linking rule
- Do not override CFLAGS
v4:
- Introduce LDLIBS_LIBSEPOLA if LIBSEPOLA is not defined.
v2:
- Rework all packages (not just selinux/sepol/semanage)
checkpolicy/Makefile | 28 ++++++++++++++++------------ checkpolicy/test/Makefile | 15 +++++++++------ 2 files changed, 25 insertions(+), 18 deletions(-)
checkpolicy/Makefile +16 -12
@@ -1,12 +1,9 @@ # # Makefile for building the checkpolicy program # -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib -INCLUDEDIR ?= $(PREFIX)/include -LIBSEPOLA ?= $(LIBDIR)/libsepol.a TARGETS = checkpolicy checkmodule LEX = flex
@@ -14,7 +11,12 @@ YACC = bison -y CFLAGS ?= -g -Wall -Werror -Wshadow -O2 -pipe -fno-strict-aliasing -override CFLAGS += -I. +# If no specific libsepol.a is specified, fall back on LDFLAGS search path +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there +# is no need to define a value for LDLIBS_LIBSEPOLA +ifeq ($(LIBSEPOLA),) + LDLIBS_LIBSEPOLA := -l:libsepol.a +endif CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \ policy_define.o
@@ -27,8 +29,10 @@ all: $(TARGETS) $(MAKE) -C test checkpolicy: $(CHECKPOLOBJS) $(LIBSEPOLA) + $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA) checkmodule: $(CHECKMODOBJS) $(LIBSEPOLA) + $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA) %.o: %.c $(CC) $(CFLAGS) -o $@ -c $<
@@ -46,15 +50,15 @@ lex.yy.c: policy_scan.l y.tab.c $(LEX) policy_scan.l install: all - -mkdir -p $(BINDIR) - -mkdir -p $(MANDIR)/man8 - install -m 755 $(TARGETS) $(BINDIR) - install -m 644 checkpolicy.8 $(MANDIR)/man8 - install -m 644 checkmodule.8 $(MANDIR)/man8 + -mkdir -p $(DESTDIR)$(BINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 755 $(TARGETS) $(DESTDIR)$(BINDIR) + install -m 644 checkpolicy.8 $(DESTDIR)$(MANDIR)/man8 + install -m 644 checkmodule.8 $(DESTDIR)$(MANDIR)/man8 relabel: install - /sbin/restorecon $(BINDIR)/checkpolicy - /sbin/restorecon $(BINDIR)/checkmodule + /sbin/restorecon $(DESTDIR)$(BINDIR)/checkpolicy + /sbin/restorecon $(DESTDIR)$(BINDIR)/checkmodule clean: -rm -f $(TARGETS) $(CHECKPOLOBJS) $(CHECKMODOBJS) y.tab.c y.tab.h lex.yy.c
checkpolicy/test/Makefile +9 -6
@@ -1,19 +1,22 @@ # # Makefile for building the dispol program # -PREFIX ?= $(DESTDIR)/usr -BINDIR ?= $(PREFIX)/bin -LIBDIR ?= $(PREFIX)/lib -INCLUDEDIR ?= $(PREFIX)/include -LIBSEPOLA ?= $(LIBDIR)/libsepol.a - CFLAGS ?= -g -Wall -W -Werror -O2 -pipe +# If no specific libsepol.a is specified, fall back on LDFLAGS search path +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there +# is no need to define a value for LDLIBS_LIBSEPOLA +ifeq ($(LIBSEPOLA),) + LDLIBS_LIBSEPOLA := -l:libsepol.a +endif + all: dispol dismod dispol: dispol.o $(LIBSEPOLA) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) dismod: dismod.o $(LIBSEPOLA) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) clean: -rm -f dispol dismod *.o
Signature · 1 line
2.15.1
PATCH v5 5/15 gui: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
v2:
- Rework all packages (not just selinux/sepol/semanage)
gui/Makefile | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-)
gui/Makefile +22 -22
@@ -1,5 +1,5 @@ # Installation directories. -PREFIX ?= ${DESTDIR}/usr +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share
@@ -23,29 +23,29 @@ usersPage.py all: $(TARGETS) system-config-selinux.py polgengui.py install: all - -mkdir -p $(MANDIR)/man8 - -mkdir -p $(SHAREDIR) - -mkdir -p $(BINDIR) - -mkdir -p $(DATADIR)/pixmaps - -mkdir -p $(DATADIR)/icons/hicolor/24x24/apps - -mkdir -p $(DATADIR)/polkit-1/actions/ - install -m 755 system-config-selinux.py $(SHAREDIR) - install -m 755 system-config-selinux $(BINDIR) - install -m 755 polgengui.py $(SHAREDIR) - install -m 644 $(TARGETS) $(SHAREDIR) - install -m 644 system-config-selinux.8 $(MANDIR)/man8 - install -m 644 selinux-polgengui.8 $(MANDIR)/man8 - install -m 644 system-config-selinux.png $(DATADIR)/pixmaps - install -m 644 system-config-selinux.png $(DATADIR)/icons/hicolor/24x24/apps - install -m 644 system-config-selinux.png $(DATADIR)/system-config-selinux - install -m 644 *.desktop $(DATADIR)/system-config-selinux - -mkdir -p $(DESTDIR) $(DATADIR)/pixmaps - install -m 644 sepolicy_256.png $(DATADIR)/pixmaps/sepolicy.png + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + -mkdir -p $(DESTDIR)$(SHAREDIR) + -mkdir -p $(DESTDIR)$(BINDIR) + -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps + -mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps + -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ + install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) + install -m 755 system-config-selinux $(DESTDIR)$(BINDIR) + install -m 755 polgengui.py $(DESTDIR)$(SHAREDIR) + install -m 644 $(TARGETS) $(DESTDIR)$(SHAREDIR) + install -m 644 system-config-selinux.8 $(DESTDIR)$(MANDIR)/man8 + install -m 644 selinux-polgengui.8 $(DESTDIR)$(MANDIR)/man8 + install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps + install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps + install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux + install -m 644 *.desktop $(DESTDIR)$(DATADIR)/system-config-selinux + -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps + install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \ - mkdir -p $(DESTDIR) $(DATADIR)/icons/hicolor/$${i}x$${i}/apps; \ - install -m 644 sepolicy_$${i}.png $(DATADIR)/icons/hicolor/$${i}x$${i}/apps/sepolicy.png; \ + mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/$${i}x$${i}/apps; \ + install -m 644 sepolicy_$${i}.png $(DESTDIR)$(DATADIR)/icons/hicolor/$${i}x$${i}/apps/sepolicy.png; \ done - install -m 644 org.selinux.config.policy $(DATADIR)/polkit-1/actions/ + install -m 644 org.selinux.config.policy $(DESTDIR)$(DATADIR)/polkit-1/actions/ clean: indent:
Signature · 1 line
2.15.1
PATCH v5 6/15 mcstrans: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
- Remove CFLAGS from linking rule
- Do not override CFLAGS
v3:
- keep the possibility to specify LIBSEPOLA to
make depending component recompile on change. If not specified, fall back to libsepola in LDFLAGS path.
v2:
- Rework all packages (not just selinux/sepol/semanage)
mcstrans/man/Makefile | 7 ++++--- mcstrans/src/Makefile | 36 ++++++++++++++++++++---------------- mcstrans/utils/Makefile | 28 ++++++++++++++++++---------- 3 files changed, 42 insertions(+), 29 deletions(-)
mcstrans/man/Makefile +4 -3
@@ -1,11 +1,12 @@ # Installation directories. -MAN8DIR ?= $(DESTDIR)/usr/share/man/man8 +PREFIX ?= /usr +MAN8DIR ?= $(PREFIX)/share/man/man8 all: install: all - mkdir -p $(MAN8DIR) - install -m 644 man8/*.8 $(MAN8DIR) + mkdir -p $(DESTDIR)$(MAN8DIR) + install -m 644 man8/*.8 $(DESTDIR)$(MAN8DIR) clean: -rm -f *~ \#*
mcstrans/src/Makefile +20 -16
@@ -1,33 +1,37 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib -SBINDIR ?= $(DESTDIR)/sbin -INITDIR ?= $(DESTDIR)/etc/rc.d/init.d -SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd -LIBSEPOLA ?= $(LIBDIR)/libsepol.a +PREFIX ?= /usr +SBINDIR ?= /sbin +INITDIR ?= /etc/rc.d/init.d +SYSTEMDDIR ?= $(PREFIX)/lib/systemd + +# If no specific libsepol.a is specified, fall back on LDFLAGS search path +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there +# is no need to define a value for LDLIBS_LIBSEPOLA +ifeq ($(LIBSEPOLA),) + LDLIBS_LIBSEPOLA := -l:libsepol.a +endif PROG_SRC=mcstrans.c mcscolor.c mcstransd.c mls_level.c PROG_OBJS= $(patsubst %.c,%.o,$(PROG_SRC)) PROG=mcstransd INITSCRIPT=mcstrans CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 all: $(PROG) -$(PROG): $(PROG_OBJS) - $(CC) $(LDFLAGS) -pie -o $@ $^ -lselinux -lcap -lpcre $(LIBSEPOLA) +$(PROG): $(PROG_OBJS) $(LIBSEPOLA) + $(CC) $(LDFLAGS) -pie -o $@ $^ -lselinux -lcap -lpcre $(LDLIBS_LIBSEPOLA) %.o: %.c - $(CC) $(CFLAGS) -fPIE -c -o $@ $< + $(CC) $(CFLAGS) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -fPIE -c -o $@ $< install: all - test -d $(SBINDIR) || install -m 755 -d $(SBINDIR) - install -m 755 $(PROG) $(SBINDIR) - test -d $(INITDIR) || install -m 755 -d $(INITDIR) - install -m 755 $(INITSCRIPT).init $(INITDIR)/$(INITSCRIPT) - test -d $(SYSTEMDDIR)/system || install -m 755 -d $(SYSTEMDDIR)/system - install -m 644 mcstrans.service $(SYSTEMDDIR)/system/ + test -d $(DESTDIR)$(SBINDIR) || install -m 755 -d $(DESTDIR)$(SBINDIR) + install -m 755 $(PROG) $(DESTDIR)$(SBINDIR) + test -d $(DESTDIR)$(INITDIR) || install -m 755 -d $(DESTDIR)$(INITDIR) + install -m 755 $(INITSCRIPT).init $(DESTDIR)$(INITDIR)/$(INITSCRIPT) + test -d $(DESTDIR)$(SYSTEMDDIR)/system || install -m 755 -d $(DESTDIR)$(SYSTEMDDIR)/system + install -m 644 mcstrans.service $(DESTDIR)$(SYSTEMDDIR)/system/ clean: -rm -f $(OBJS) $(LOBJS) $(TARGET) $(PROG) $(PROG_OBJS) *~ \#*
mcstrans/utils/Makefile +18 -10
@@ -1,22 +1,30 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin -LIBSEPOLA ?= $(LIBDIR)/libsepol.a -CFLAGS ?= -Wall -override CFLAGS += -I../src -D_GNU_SOURCE -override LDLIBS += -lselinux -lpcre +TARGETS=transcon untranscon -TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c))) +# If no specific libsepol.a is specified, fall back on LDFLAGS search path +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there +# is no need to define a value for LDLIBS_LIBSEPOLA +ifeq ($(LIBSEPOLA),) + LDLIBS_LIBSEPOLA := -l:libsepol.a +endif all: $(TARGETS) -$(TARGETS): ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) +transcon: transcon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) + $(CC) $(LDFLAGS) -o $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA) + +untranscon: untranscon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) + $(CC) $(LDFLAGS) -o $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA) + +%.o: %.c + $(CC) $(CFLAGS) -D_GNU_SOURCE -I../src -fPIE -c -o $@ $< install: all - -mkdir -p $(SBINDIR) - install -m 755 $(TARGETS) $(SBINDIR) + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 $(TARGETS) $(DESTDIR)$(SBINDIR) test: ./mlstrans-test-runner.py ../test/*.test
Signature · 1 line
2.15.1
PATCH v5 7/15 policycoreutils: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
v2:
- Rework all packages (not just selinux/sepol/semanage)
policycoreutils/hll/pp/Makefile | 9 +++------ policycoreutils/load_policy/Makefile | 16 ++++++++-------- policycoreutils/man/Makefile | 7 ++++--- policycoreutils/newrole/Makefile | 24 ++++++++++++------------ policycoreutils/po/Makefile | 7 ++++--- policycoreutils/run_init/Makefile | 22 +++++++++++----------- policycoreutils/scripts/Makefile | 13 ++++++------- policycoreutils/secon/Makefile | 12 +++++------- policycoreutils/semodule/Makefile | 16 +++++++--------- policycoreutils/sestatus/Makefile | 21 ++++++++++----------- policycoreutils/setfiles/Makefile | 23 +++++++++++------------ policycoreutils/setsebool/Makefile | 18 ++++++++---------- 12 files changed, 89 insertions(+), 99 deletions(-)
policycoreutils/hll/pp/Makefile +3 -6
@@ -1,8 +1,5 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include -MANDIR = $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib +PREFIX ?= /usr LIBEXECDIR ?= $(PREFIX)/libexec HLLDIR ?= $(LIBEXECDIR)/selinux/hll
@@ -21,8 +18,8 @@ pp: $(PP_OBJS) $(CC) $(CFLAGS) -c -o $@ $^ install: all - -mkdir -p $(HLLDIR) - install -m 755 pp $(HLLDIR) + -mkdir -p $(DESTDIR)$(HLLDIR) + install -m 755 pp $(DESTDIR)$(HLLDIR) relabel:
policycoreutils/load_policy/Makefile +8 -8
@@ -1,8 +1,8 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -SBINDIR ?= $(DESTDIR)/sbin +PREFIX ?= /usr +SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man -LOCALEDIR ?= /usr/share/locale +LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale CFLAGS ?= -Werror -Wall -W override CFLAGS += $(LDFLAGS) -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
@@ -13,10 +13,10 @@ TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c))) all: $(TARGETS) install: all - -mkdir -p $(SBINDIR) - install -m 755 $(TARGETS) $(SBINDIR) - test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 - install -m 644 load_policy.8 $(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 $(TARGETS) $(DESTDIR)$(SBINDIR) + test -d $(DESTDIR)$(MANDIR)/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/man8 + install -m 644 load_policy.8 $(DESTDIR)$(MANDIR)/man8/ clean: -rm -f $(TARGETS) *.o
@@ -25,4 +25,4 @@ indent: ../../scripts/Lindent $(wildcard *.[ch]) relabel: - /sbin/restorecon $(SBINDIR)/load_policy + /sbin/restorecon $(DESTDIR)$(SBINDIR)/load_policy
policycoreutils/man/Makefile +4 -3
@@ -1,12 +1,13 @@ # Installation directories. -MAN5DIR ?= $(DESTDIR)/usr/share/man/man5 +PREFIX ?= /usr +MAN5DIR ?= $(PREFIX)/share/man/man5 all: clean: install: all - mkdir -p $(MAN5DIR) - install -m 644 man5/*.5 $(MAN5DIR) + mkdir -p $(DESTDIR)$(MAN5DIR) + install -m 644 man5/*.5 $(DESTDIR)$(MAN5DIR) relabel:
policycoreutils/newrole/Makefile +12 -12
@@ -1,9 +1,9 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man -ETCDIR ?= $(DESTDIR)/etc -LOCALEDIR = /usr/share/locale +ETCDIR ?= /etc +LOCALEDIR = $(DESTDIR)$(PREFIX)/share/locale PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y) AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) # Enable capabilities to permit newrole to generate audit records.
@@ -61,17 +61,17 @@ newrole: newrole.o $(EXTRA_OBJS) $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) install: all - test -d $(BINDIR) || install -m 755 -d $(BINDIR) - test -d $(ETCDIR)/pam.d || install -m 755 -d $(ETCDIR)/pam.d - test -d $(MANDIR)/man1 || install -m 755 -d $(MANDIR)/man1 - install -m $(MODE) newrole $(BINDIR) - install -m 644 newrole.1 $(MANDIR)/man1/ + test -d $(DESTDIR)$(BINDIR) || install -m 755 -d $(DESTDIR)$(BINDIR) + test -d $(DESTDIR)$(ETCDIR)/pam.d || install -m 755 -d $(DESTDIR)$(ETCDIR)/pam.d + test -d $(DESTDIR)$(MANDIR)/man1 || install -m 755 -d $(DESTDIR)$(MANDIR)/man1 + install -m $(MODE) newrole $(DESTDIR)$(BINDIR) + install -m 644 newrole.1 $(DESTDIR)$(MANDIR)/man1/ ifeq ($(PAMH), y) - test -d $(ETCDIR)/pam.d || install -m 755 -d $(ETCDIR)/pam.d + test -d $(DESTDIR)$(ETCDIR)/pam.d || install -m 755 -d $(DESTDIR)$(ETCDIR)/pam.d ifeq ($(LSPP_PRIV),y) - install -m 644 newrole-lspp.pamd $(ETCDIR)/pam.d/newrole + install -m 644 newrole-lspp.pamd $(DESTDIR)$(ETCDIR)/pam.d/newrole else - install -m 644 newrole.pamd $(ETCDIR)/pam.d/newrole + install -m 644 newrole.pamd $(DESTDIR)$(ETCDIR)/pam.d/newrole endif endif
@@ -82,4 +82,4 @@ indent: ../../scripts/Lindent $(wildcard *.[ch]) relabel: install - /sbin/restorecon $(BINDIR)/newrole + /sbin/restorecon $(DESTDIR)$(BINDIR)/newrole
policycoreutils/po/Makefile +4 -3
@@ -2,6 +2,7 @@ # Makefile for the PO files (translation) catalog # +PREFIX ?= /usr TOP = ../.. # What is this package?
@@ -12,7 +13,7 @@ INSTALL_DATA = $(INSTALL) -m 644 INSTALL_DIR = /usr/bin/install -d # destination directory -INSTALL_NLS_DIR = $(DESTDIR)/usr/share/locale +INSTALL_NLS_DIR = $(PREFIX)/share/locale # PO catalog handling MSGMERGE = msgmerge
@@ -128,8 +129,8 @@ clean: install: $(MOFILES) @for n in $(MOFILES); do \ l=`basename $$n .mo`; \ - $(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \ - $(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \ + $(INSTALL_DIR) $(DESTDIR)$(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \ + $(INSTALL_DATA) --verbose $$n $(DESTDIR)$(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \ done %.mo: %.po
policycoreutils/run_init/Makefile +11 -11
@@ -1,10 +1,10 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man -ETCDIR ?= $(DESTDIR)/etc -LOCALEDIR ?= /usr/share/locale +ETCDIR ?= /etc +LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y) AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
@@ -32,14 +32,14 @@ open_init_pty: open_init_pty.c install: all - test -d $(SBINDIR) || install -m 755 -d $(SBINDIR) - test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 - install -m 755 run_init $(SBINDIR) - install -m 755 open_init_pty $(SBINDIR) - install -m 644 run_init.8 $(MANDIR)/man8/ - install -m 644 open_init_pty.8 $(MANDIR)/man8/ + test -d $(DESTDIR)$(SBINDIR) || install -m 755 -d $(DESTDIR)$(SBINDIR) + test -d $(DESTDIR)$(MANDIR)/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/man8 + install -m 755 run_init $(DESTDIR)$(SBINDIR) + install -m 755 open_init_pty $(DESTDIR)$(SBINDIR) + install -m 644 run_init.8 $(DESTDIR)$(MANDIR)/man8/ + install -m 644 open_init_pty.8 $(DESTDIR)$(MANDIR)/man8/ ifeq ($(PAMH), y) - install -m 644 run_init.pamd $(ETCDIR)/pam.d/run_init + install -m 644 run_init.pamd $(DESTDIR)$(ETCDIR)/pam.d/run_init endif clean:
@@ -49,4 +49,4 @@ indent: ../../scripts/Lindent $(wildcard *.[ch]) relabel: install - /sbin/restorecon $(SBINDIR)/run_init $(SBINDIR)/open_init_pty + /sbin/restorecon $(DESTDIR)$(SBINDIR)/run_init $(DESTDIR)$(SBINDIR)/open_init_pty
policycoreutils/scripts/Makefile +6 -7
@@ -1,17 +1,16 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -SBINDIR ?= $(DESTDIR)/sbin +PREFIX ?= /usr +SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man -LOCALEDIR ?= $(PREFIX)/share/locale .PHONY: all all: fixfiles install: all - -mkdir -p $(SBINDIR) - install -m 755 fixfiles $(SBINDIR) - -mkdir -p $(MANDIR)/man8 - install -m 644 fixfiles.8 $(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 fixfiles $(DESTDIR)$(SBINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 644 fixfiles.8 $(DESTDIR)$(MANDIR)/man8/ clean:
policycoreutils/secon/Makefile +5 -7
@@ -1,9 +1,7 @@ # secon tool - command-line context -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib WARNS=-Werror -W -Wall -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -Wfloat-equal VERSION = $(shell cat ../VERSION)
@@ -18,13 +16,13 @@ secon: secon.o install-nogui: install install: all - install -m 755 secon $(BINDIR); + install -m 755 secon $(DESTDIR)$(BINDIR); - test -d $(MANDIR)/man1 || install -m 755 -d $(MANDIR)/man1 - install -m 644 secon.1 $(MANDIR)/man1 + test -d $(DESTDIR)$(MANDIR)/man1 || install -m 755 -d $(DESTDIR)$(MANDIR)/man1 + install -m 644 secon.1 $(DESTDIR)$(MANDIR)/man1 relabel: - /sbin/restorecon $(BINDIR)/secon + /sbin/restorecon $(DESTDIR)$(BINDIR)/secon clean: rm -f *.o core* secon *~ *.bak
policycoreutils/semodule/Makefile +7 -9
@@ -1,9 +1,7 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib CFLAGS ?= -Werror -Wall -W override LDLIBS += -lsepol -lselinux -lsemanage
@@ -17,12 +15,12 @@ genhomedircon: ln -sf semodule genhomedircon install: all - -mkdir -p $(SBINDIR) - install -m 755 semodule $(SBINDIR) - (cd $(SBINDIR); ln -sf semodule genhomedircon) - test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 - install -m 644 semodule.8 $(MANDIR)/man8/ - install -m 644 genhomedircon.8 $(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 semodule $(DESTDIR)$(SBINDIR) + (cd $(DESTDIR)$(SBINDIR); ln -sf semodule genhomedircon) + test -d $(DESTDIR)$(MANDIR)/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/man8 + install -m 644 semodule.8 $(DESTDIR)$(MANDIR)/man8/ + install -m 644 genhomedircon.8 $(DESTDIR)$(MANDIR)/man8/ relabel:
policycoreutils/sestatus/Makefile +10 -11
@@ -1,9 +1,8 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man -ETCDIR ?= $(DESTDIR)/etc -LIBDIR ?= $(PREFIX)/lib +ETCDIR ?= /etc CFLAGS ?= -Werror -Wall -W override CFLAGS += -D_FILE_OFFSET_BITS=64
@@ -14,14 +13,14 @@ all: sestatus sestatus: sestatus.o install: all - [ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8 - [ -d $(MANDIR)/man5 ] || mkdir -p $(MANDIR)/man5 - -mkdir -p $(SBINDIR) - install -m 755 sestatus $(SBINDIR) - install -m 644 sestatus.8 $(MANDIR)/man8 - install -m 644 sestatus.conf.5 $(MANDIR)/man5 - -mkdir -p $(ETCDIR) - install -m 644 sestatus.conf $(ETCDIR) + [ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8 + [ -d $(DESTDIR)$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)$(MANDIR)/man5 + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 sestatus $(DESTDIR)$(SBINDIR) + install -m 644 sestatus.8 $(DESTDIR)$(MANDIR)/man8 + install -m 644 sestatus.conf.5 $(DESTDIR)$(MANDIR)/man5 + -mkdir -p $(DESTDIR)$(ETCDIR) + install -m 644 sestatus.conf $(DESTDIR)$(ETCDIR) clean: rm -f sestatus *.o
policycoreutils/setfiles/Makefile +11 -12
@@ -1,8 +1,7 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -SBINDIR ?= $(DESTDIR)/sbin +PREFIX ?= /usr +SBINDIR ?= /sbin MANDIR = $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y) ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }')
@@ -29,14 +28,14 @@ man: @sed -i "s/ABORT_ON_ERRORS/$(ABORT_ON_ERRORS)/g" setfiles.8.man install: all - [ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8 - -mkdir -p $(SBINDIR) - install -m 755 setfiles $(SBINDIR) - (cd $(SBINDIR) && ln -sf setfiles restorecon) - install -m 755 restorecon_xattr $(SBINDIR) - install -m 644 setfiles.8.man $(MANDIR)/man8/setfiles.8 - install -m 644 restorecon.8 $(MANDIR)/man8/restorecon.8 - install -m 644 restorecon_xattr.8 $(MANDIR)/man8/restorecon_xattr.8 + [ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8 + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 setfiles $(DESTDIR)$(SBINDIR) + (cd $(DESTDIR)$(SBINDIR) && ln -sf setfiles restorecon) + install -m 755 restorecon_xattr $(DESTDIR)$(SBINDIR) + install -m 644 setfiles.8.man $(DESTDIR)$(MANDIR)/man8/setfiles.8 + install -m 644 restorecon.8 $(DESTDIR)$(MANDIR)/man8/restorecon.8 + install -m 644 restorecon_xattr.8 $(DESTDIR)$(MANDIR)/man8/restorecon_xattr.8 clean: rm -f setfiles restorecon restorecon_xattr *.o setfiles.8.man
@@ -45,4 +44,4 @@ indent: ../../scripts/Lindent $(wildcard *.[ch]) relabel: install - $(SBINDIR)/restorecon $(SBINDIR)/setfiles $(SBINDIR)/restorecon_xattr + $(DESTDIR)$(SBINDIR)/restorecon $(DESTDIR)$(SBINDIR)/setfiles $(DESTDIR)$(SBINDIR)/restorecon_xattr
policycoreutils/setsebool/Makefile +8 -10
@@ -1,10 +1,8 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib -BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions +BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions CFLAGS ?= -Werror -Wall -W override LDLIBS += -lsepol -lselinux -lsemanage
@@ -17,12 +15,12 @@ all: setsebool setsebool: $(SETSEBOOL_OBJS) install: all - -mkdir -p $(SBINDIR) - install -m 755 setsebool $(SBINDIR) - -mkdir -p $(MANDIR)/man8 - install -m 644 setsebool.8 $(MANDIR)/man8/ - -mkdir -p $(BASHCOMPLETIONDIR) - install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR)/setsebool + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 setsebool $(DESTDIR)$(SBINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 644 setsebool.8 $(DESTDIR)$(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR) + install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/setsebool relabel:
Signature · 1 line
2.15.1
Re: [PATCH v5 07/15] policycoreutils: build: follow standard semantics for DESTDIR and PREFIX
Quoted 23 lines · Marcus Folkesson
Signed-off-by Marcus Folkesson <[email protected]>---
Notes:
v5:
- Only use $(DESTDIR) in install
v2:
- Rework all packages (not just selinux/sepol/semanage)policycoreutils/hll/pp/Makefile | 9 +++------ policycoreutils/load_policy/Makefile | 16 ++++++++-------- policycoreutils/man/Makefile | 7 ++++--- policycoreutils/newrole/Makefile | 24 ++++++++++++------------ policycoreutils/po/Makefile | 7 ++++--- policycoreutils/run_init/Makefile | 22 +++++++++++----------- policycoreutils/scripts/Makefile | 13 ++++++------- policycoreutils/secon/Makefile | 12 +++++------- policycoreutils/semodule/Makefile | 16 +++++++--------- policycoreutils/sestatus/Makefile | 21 ++++++++++----------- policycoreutils/setfiles/Makefile | 23 +++++++++++------------ policycoreutils/setsebool/Makefile | 18 ++++++++---------- 12 files changed, 89 insertions(+), 99 deletions(-)
[...]
Quoted 5 lines
policycoreutils/setsebool/Makefile +0
-0
policycoreutils/setsebool/Makefile line 5
Quoted 9 lines
policycoreutils/setsebool/Makefile +2
-4@@ -1,10 +1,8 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib -BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions +BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
You forgot to remove $(DESTDIR) here, so setsebool's bash completion file gets installed in $DESTDIR/$DESTDIR/usr/... All the other modifications on variables look good to me.
Thanks!
Nicolas
Quoted 25 lines
policycoreutils/setsebool/Makefile +6
-7CFLAGS ?= -Werror -Wall -W override LDLIBS += -lsepol -lselinux -lsemanage@@ -17,12 +15,12 @@ all: setsebool setsebool: $(SETSEBOOL_OBJS) install: all - -mkdir -p $(SBINDIR) - install -m 755 setsebool $(SBINDIR) - -mkdir -p $(MANDIR)/man8 - install -m 644 setsebool.8 $(MANDIR)/man8/ - -mkdir -p $(BASHCOMPLETIONDIR) - install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR)/setsebool + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 setsebool $(DESTDIR)$(SBINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 644 setsebool.8 $(DESTDIR)$(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR) + install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/setsebool relabel: --2.15.1
PATCH v5 8/15 python: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
- Remove CFLAGS from linking rule
v4:
- move platform from platform specific to platform shared installation directory
v3:
- Add missing slash
- keep the possibility to specify LIBSEPOLA to
make depending component recompile on change. If not specified, fall back to libsepola in LDFLAGS path.
v2:
- Rework all packages (not just selinux/sepol/semanage)
python/audit2allow/Makefile | 30 +++++++++++++++++------------- python/chcat/Makefile | 11 +++++------ python/semanage/Makefile | 25 ++++++++++++------------- python/sepolgen/src/sepolgen/Makefile | 9 +++++---- python/sepolgen/src/share/Makefile | 8 ++++---- python/sepolicy/Makefile | 24 ++++++++++-------------- 6 files changed, 53 insertions(+), 54 deletions(-)
python/audit2allow/Makefile +17 -13
@@ -1,19 +1,23 @@ PYTHON ?= python # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin -LIBDIR ?= $(PREFIX)/lib MANDIR ?= $(PREFIX)/share/man -LOCALEDIR ?= /usr/share/locale -INCLUDEDIR ?= $(PREFIX)/include -LIBSEPOLA ?= $(LIBDIR)/libsepol.a CFLAGS ?= -Werror -Wall -W +# If no specific libsepol.a is specified, fall back on LDFLAGS search path +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there +# is no need to define a value for LDLIBS_LIBSEPOLA +ifeq ($(LIBSEPOLA),) + LDLIBS_LIBSEPOLA := -l:libsepol.a +endif + all: audit2why sepolgen-ifgen-attr-helper sepolgen-ifgen-attr-helper: sepolgen-ifgen-attr-helper.o $(LIBSEPOLA) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) audit2why: ln -sf audit2allow audit2why
@@ -22,14 +26,14 @@ test: all @$(PYTHON) test_audit2allow.py -v install: all - -mkdir -p $(BINDIR) - install -m 755 audit2allow $(BINDIR) - (cd $(BINDIR); ln -sf audit2allow audit2why) - install -m 755 sepolgen-ifgen-attr-helper $(BINDIR) - install -m 755 sepolgen-ifgen $(BINDIR) - -mkdir -p $(MANDIR)/man1 - install -m 644 audit2allow.1 $(MANDIR)/man1/ - install -m 644 audit2why.1 $(MANDIR)/man1/ + -mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 audit2allow $(DESTDIR)$(BINDIR) + (cd $(DESTDIR)$(BINDIR); ln -sf audit2allow audit2why) + install -m 755 sepolgen-ifgen-attr-helper $(DESTDIR)$(BINDIR) + install -m 755 sepolgen-ifgen $(DESTDIR)$(BINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man1 + install -m 644 audit2allow.1 $(DESTDIR)$(MANDIR)/man1/ + install -m 644 audit2why.1 $(DESTDIR)$(MANDIR)/man1/ clean: rm -f *~ *.o sepolgen-ifgen-attr-helper
python/chcat/Makefile +5 -6
@@ -1,17 +1,16 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man -LOCALEDIR ?= $(PREFIX)/share/locale .PHONY: all all: chcat install: all - -mkdir -p $(BINDIR) - install -m 755 chcat $(BINDIR) - -mkdir -p $(MANDIR)/man8 - install -m 644 chcat.8 $(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 chcat $(DESTDIR)$(BINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 644 chcat.8 $(DESTDIR)$(MANDIR)/man8/ clean:
python/semanage/Makefile +12 -13
@@ -1,13 +1,12 @@ PYTHON ?= python # Installation directories. -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))") -PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR) -BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))") +PACKAGEDIR ?= $(PYTHONLIBDIR) +BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions TARGETS=semanage
@@ -16,14 +15,14 @@ BASHCOMPLETIONS=semanage-bash-completion.sh all: $(TARGETS) install: all - [ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8 - -mkdir -p $(SBINDIR) - install -m 755 semanage $(SBINDIR) - install -m 644 *.8 $(MANDIR)/man8 - test -d $(PACKAGEDIR) || install -m 755 -d $(PACKAGEDIR) - install -m 755 seobject.py $(PACKAGEDIR) - -mkdir -p $(BASHCOMPLETIONDIR) - install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR)/semanage + [ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8 + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 semanage $(DESTDIR)$(SBINDIR) + install -m 644 *.8 $(DESTDIR)$(MANDIR)/man8 + test -d $(DESTDIR)/$(PACKAGEDIR) || install -m 755 -d $(DESTDIR)/$(PACKAGEDIR) + install -m 755 seobject.py $(DESTDIR)/$(PACKAGEDIR) + -mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR) + install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/semanage test: @$(PYTHON) test-semanage.py -a
python/sepolgen/src/sepolgen/Makefile +5 -4
@@ -1,12 +1,13 @@ +PREFIX ?= /usr PYTHON ?= python -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))") -PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/sepolgen +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))") +PACKAGEDIR ?= /$(PYTHONLIBDIR)/sepolgen all: install: all - -mkdir -p $(PACKAGEDIR) - install -m 644 *.py $(PACKAGEDIR) + -mkdir -p $(DESTDIR)$(PACKAGEDIR) + install -m 644 *.py $(DESTDIR)$(PACKAGEDIR) clean: rm -f parser.out parsetab.py
python/sepolgen/src/share/Makefile +4 -4
@@ -1,10 +1,10 @@ -SHAREDIR ?= $(DESTDIR)/var/lib/sepolgen +SHAREDIR ?= /var/lib/sepolgen all: install: all - -mkdir -p $(SHAREDIR) - install -m 644 perm_map $(SHAREDIR) + -mkdir -p $(DESTDIR)$(SHAREDIR) + install -m 644 perm_map $(DESTDIR)$(SHAREDIR) clean: - rm -f *~ + rm -f *~
python/sepolicy/Makefile +10 -14
@@ -1,14 +1,10 @@ PYTHON ?= python # Installation directories. -PREFIX ?= $(DESTDIR)/usr -LIBDIR ?= $(PREFIX)/lib +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin -DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man -LOCALEDIR ?= /usr/share/locale -BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions -SHAREDIR ?= $(PREFIX)/share/sandbox +BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions CFLAGS ?= -Wall -Werror -Wextra -W override CFLAGS += -DPACKAGE="policycoreutils" -DSHARED -shared
@@ -30,13 +26,13 @@ test: @$(PYTHON) test_sepolicy.py -v install: - $(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` - [ -d $(BINDIR) ] || mkdir -p $(BINDIR) - install -m 755 sepolicy.py $(BINDIR)/sepolicy - (cd $(BINDIR); ln -sf sepolicy sepolgen) - -mkdir -p $(MANDIR)/man8 - install -m 644 *.8 $(MANDIR)/man8 - -mkdir -p $(BASHCOMPLETIONDIR) - install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR)/sepolicy + $(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` + [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy + (cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 644 *.8 $(DESTDIR)$(MANDIR)/man8 + -mkdir -p $(DESTDIR)$(BASHCOMPLETIONDIR) + install -m 644 $(BASHCOMPLETIONS) $(DESTDIR)$(BASHCOMPLETIONDIR)/sepolicy relabel:
Signature · 1 line
2.15.1
PATCH v5 9/15 python: build: move modules from platform-specific to platform-shared
In reply to Marcus Folkesson--- python/semanage/Makefile | 2 +- python/sepolgen/src/sepolgen/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
python/semanage/Makefile +1 -1
@@ -4,7 +4,7 @@ PYTHON ?= python PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin MANDIR = $(PREFIX)/share/man -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))") +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))") PACKAGEDIR ?= $(PYTHONLIBDIR) BASHCOMPLETIONDIR ?= $(PREFIX)/share/bash-completion/completions
python/sepolgen/src/sepolgen/Makefile +1 -1
@@ -1,6 +1,6 @@ PREFIX ?= /usr PYTHON ?= python -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(plat_specific=1, prefix='$(PREFIX)'))") +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))") PACKAGEDIR ?= /$(PYTHONLIBDIR)/sepolgen all:
Signature · 1 line
2.15.1
PATCH v5 10/15 restorecond: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
v2:
- Rework all packages (not just selinux/sepol/semanage)
restorecond/Makefile | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
restorecond/Makefile +15 -16
@@ -1,13 +1,12 @@ PKG_CONFIG ?= pkg-config # Installation directories. -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr SBINDIR ?= $(PREFIX)/sbin -LIBDIR ?= $(PREFIX)/lib MANDIR = $(PREFIX)/share/man -AUTOSTARTDIR = $(DESTDIR)/etc/xdg/autostart -DBUSSERVICEDIR = $(DESTDIR)/usr/share/dbus-1/services -SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd +AUTOSTARTDIR = /etc/xdg/autostart +DBUSSERVICEDIR = $(PREFIX)/share/dbus-1/services +SYSTEMDDIR ?= $(PREFIX)/lib/systemd autostart_DATA = sealertauto.desktop INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
@@ -39,23 +38,23 @@ restorecond: restore.o restorecond.o utmpwatcher.o stringslist.o user.o watch.o $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) install: all - [ -d $(MANDIR)/man8 ] || mkdir -p $(MANDIR)/man8 - -mkdir -p $(SBINDIR) - install -m 755 restorecond $(SBINDIR) - install -m 644 restorecond.8 $(MANDIR)/man8 + [ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8 + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 restorecond $(DESTDIR)$(SBINDIR) + install -m 644 restorecond.8 $(DESTDIR)$(MANDIR)/man8 -mkdir -p $(INITDIR) install -m 755 restorecond.init $(INITDIR)/restorecond -mkdir -p $(SELINUXDIR) install -m 644 restorecond.conf $(SELINUXDIR)/restorecond.conf install -m 644 restorecond_user.conf $(SELINUXDIR)/restorecond_user.conf - -mkdir -p $(AUTOSTARTDIR) - install -m 644 restorecond.desktop $(AUTOSTARTDIR)/restorecond.desktop - -mkdir -p $(DBUSSERVICEDIR) - install -m 600 org.selinux.Restorecond.service $(DBUSSERVICEDIR)/org.selinux.Restorecond.service - -mkdir -p $(SYSTEMDDIR)/system - install -m 644 restorecond.service $(SYSTEMDDIR)/system/ + -mkdir -p $(DESTDIR)$(AUTOSTARTDIR) + install -m 644 restorecond.desktop $(DESTDIR)$(AUTOSTARTDIR)/restorecond.desktop + -mkdir -p $(DESTDIR)$(DBUSSERVICEDIR) + install -m 600 org.selinux.Restorecond.service $(DESTDIR)$(DBUSSERVICEDIR)/org.selinux.Restorecond.service + -mkdir -p $(DESTDIR)$(SYSTEMDDIR)/system + install -m 644 restorecond.service $(DESTDIR)$(SYSTEMDDIR)/system/ relabel: install - /sbin/restorecon $(SBINDIR)/restorecond + /sbin/restorecon $(DESTDIR)$(SBINDIR)/restorecond clean: -rm -f restorecond *.o *~
Signature · 1 line
2.15.1
PATCH v5 11/15 sandbox: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
v2:
- Rework all packages (not just selinux/sepol/semanage)
sandbox/Makefile | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
sandbox/Makefile +16 -18
@@ -1,13 +1,11 @@ PYTHON ?= python # Installation directories. -PREFIX ?= $(DESTDIR)/usr -SYSCONFDIR ?= $(DESTDIR)/etc/sysconfig -LIBDIR ?= $(PREFIX)/lib +PREFIX ?= /usr +SYSCONFDIR ?= /etc/sysconfig BINDIR ?= $(PREFIX)/bin SBINDIR ?= $(PREFIX)/sbin MANDIR ?= $(PREFIX)/share/man -LOCALEDIR ?= /usr/share/locale SHAREDIR ?= $(PREFIX)/share/sandbox override CFLAGS += -DPACKAGE="\"policycoreutils\"" -Wall -Werror -Wextra -W override LDLIBS += -lselinux -lcap-ng
@@ -18,20 +16,20 @@ all: sandbox seunshare sandboxX.sh start seunshare: $(SEUNSHARE_OBJS) install: all - -mkdir -p $(BINDIR) - install -m 755 sandbox $(BINDIR) - -mkdir -p $(MANDIR)/man8 - install -m 644 sandbox.8 $(MANDIR)/man8/ - install -m 644 seunshare.8 $(MANDIR)/man8/ - -mkdir -p $(MANDIR)/man5 - install -m 644 sandbox.5 $(MANDIR)/man5/ - -mkdir -p $(SBINDIR) - install -m 4755 seunshare $(SBINDIR)/ - -mkdir -p $(SHAREDIR) - install -m 755 sandboxX.sh $(SHAREDIR) - install -m 755 start $(SHAREDIR) - -mkdir -p $(SYSCONFDIR) - install -m 644 sandbox.conf $(SYSCONFDIR)/sandbox + -mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 sandbox $(DESTDIR)$(BINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 644 sandbox.8 $(DESTDIR)$(MANDIR)/man8/ + install -m 644 seunshare.8 $(DESTDIR)$(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(MANDIR)/man5 + install -m 644 sandbox.5 $(DESTDIR)$(MANDIR)/man5/ + -mkdir -p $(DESTDIR)$(SBINDIR) + install -m 4755 seunshare $(DESTDIR)$(SBINDIR)/ + -mkdir -p $(DESTDIR)$(SHAREDIR) + install -m 755 sandboxX.sh $(DESTDIR)$(SHAREDIR) + install -m 755 start $(DESTDIR)$(SHAREDIR) + -mkdir -p $(DESTDIR)$(SYSCONFDIR) + install -m 644 sandbox.conf $(DESTDIR)$(SYSCONFDIR)/sandbox test: @$(PYTHON) test_sandbox.py -v
Signature · 1 line
2.15.1
PATCH v5 12/15 secilc: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
v2:
- Rework all packages (not just selinux/sepol/semanage)
secilc/Makefile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
secilc/Makefile +7 -9
@@ -1,8 +1,6 @@ -PREFIX ?= $(DESTDIR)/usr +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib -INCLUDEDIR ?= $(PREFIX)/include SECILC = secilc SECILC_SRCS := secilc.c
@@ -41,12 +39,12 @@ $(SECIL2CONF_MANPAGE): $(SECIL2CONF_MANPAGE).xml $(XMLTO) man $(SECIL2CONF_MANPAGE).xml install: all man - -mkdir -p $(BINDIR) - -mkdir -p $(MANDIR)/man8 - install -m 755 $(SECILC) $(BINDIR) - install -m 755 $(SECIL2CONF) $(BINDIR) - install -m 644 $(SECILC_MANPAGE) $(MANDIR)/man8 - install -m 644 $(SECIL2CONF_MANPAGE) $(MANDIR)/man8 + -mkdir -p $(DESTDIR)$(BINDIR) + -mkdir -p $(DESTDIR)$(MANDIR)/man8 + install -m 755 $(SECILC) $(DESTDIR)$(BINDIR) + install -m 755 $(SECIL2CONF) $(DESTDIR)$(BINDIR) + install -m 644 $(SECILC_MANPAGE) $(DESTDIR)$(MANDIR)/man8 + install -m 644 $(SECIL2CONF_MANPAGE) $(DESTDIR)$(MANDIR)/man8 doc: $(MAKE) -C docs
Signature · 1 line
2.15.1
PATCH v5 13/15 semodule-utils: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson---
Notes:
v5:
- Only use $(DESTDIR) in install
v2:
- Rework all packages (not just selinux/sepol/semanage)
semodule-utils/semodule_expand/Makefile | 12 +++++------- semodule-utils/semodule_link/Makefile | 12 +++++------- semodule-utils/semodule_package/Makefile | 16 +++++++--------- 3 files changed, 17 insertions(+), 23 deletions(-)
semodule-utils/semodule_expand/Makefile +5 -7
@@ -1,8 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin -LIBDIR ?= $(PREFIX)/lib MANDIR ?= $(PREFIX)/share/man CFLAGS ?= -Werror -Wall -W
@@ -13,10 +11,10 @@ all: semodule_expand semodule_expand: semodule_expand.o install: all - -mkdir -p $(BINDIR) - install -m 755 semodule_expand $(BINDIR) - test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 - install -m 644 semodule_expand.8 $(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 semodule_expand $(DESTDIR)$(BINDIR) + test -d $(DESTDIR)$(MANDIR)/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/man8 + install -m 644 semodule_expand.8 $(DESTDIR)$(MANDIR)/man8/ relabel:
semodule-utils/semodule_link/Makefile +5 -7
@@ -1,9 +1,7 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin MANDIR ?= $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib CFLAGS ?= -Werror -Wall -W override LDLIBS += -lsepol
@@ -13,10 +11,10 @@ all: semodule_link semodule_link: semodule_link.o install: all - -mkdir -p $(BINDIR) - install -m 755 semodule_link $(BINDIR) - test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 - install -m 644 semodule_link.8 $(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 semodule_link $(DESTDIR)$(BINDIR) + test -d $(DESTDIR)$(MANDIR)/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/man8 + install -m 644 semodule_link.8 $(DESTDIR)$(MANDIR)/man8/ relabel:
semodule-utils/semodule_package/Makefile +7 -9
@@ -1,8 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCLUDEDIR ?= $(PREFIX)/include +PREFIX ?= /usr BINDIR ?= $(PREFIX)/bin -LIBDIR ?= $(PREFIX)/lib MANDIR ?= $(PREFIX)/share/man CFLAGS ?= -Werror -Wall -W
@@ -13,12 +11,12 @@ all: semodule_package semodule_unpackage semodule_package: semodule_package.o install: all - -mkdir -p $(BINDIR) - install -m 755 semodule_package $(BINDIR) - install -m 755 semodule_unpackage $(BINDIR) - test -d $(MANDIR)/man8 || install -m 755 -d $(MANDIR)/man8 - install -m 644 semodule_package.8 $(MANDIR)/man8/ - install -m 644 semodule_unpackage.8 $(MANDIR)/man8/ + -mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 semodule_package $(DESTDIR)$(BINDIR) + install -m 755 semodule_unpackage $(DESTDIR)$(BINDIR) + test -d $(DESTDIR)$(MANDIR)/man8 || install -m 755 -d $(DESTDIR)$(MANDIR)/man8 + install -m 644 semodule_package.8 $(DESTDIR)$(MANDIR)/man8/ + install -m 644 semodule_unpackage.8 $(DESTDIR)$(MANDIR)/man8/ relabel:
Signature · 1 line
2.15.1
PATCH v5 14/15 dbus: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- dbus/Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
dbus/Makefile +8 -6
@@ -1,3 +1,5 @@ +PREFIX ?= /usr + all: clean:
@@ -5,12 +7,12 @@ clean: install: -mkdir -p $(DESTDIR)/etc/dbus-1/system.d/ install -m 644 org.selinux.conf $(DESTDIR)/etc/dbus-1/system.d/ - -mkdir -p $(DESTDIR)/usr/share/dbus-1/system-services - install -m 644 org.selinux.service $(DESTDIR)/usr/share/dbus-1/system-services - -mkdir -p $(DESTDIR)/usr/share/polkit-1/actions/ - install -m 644 org.selinux.policy $(DESTDIR)/usr/share/polkit-1/actions/ - -mkdir -p $(DESTDIR)/usr/share/system-config-selinux - install -m 755 selinux_server.py $(DESTDIR)/usr/share/system-config-selinux + -mkdir -p $(DESTDIR)$(PREFIX)/share/dbus-1/system-services + install -m 644 org.selinux.service $(DESTDIR)$(PREFIX)/share/dbus-1/system-services + -mkdir -p $(DESTDIR)$(PREFIX)/share/polkit-1/actions/ + install -m 644 org.selinux.policy $(DESTDIR)$(PREFIX)/share/polkit-1/actions/ + -mkdir -p $(DESTDIR)$(PREFIX)/share/system-config-selinux + install -m 755 selinux_server.py $(DESTDIR)$(PREFIX)/share/system-config-selinux relabel:
Signature · 1 line
2.15.1
PATCH v5 15/15 build: setup buildpaths if DESTDIR is specified
In reply to Marcus Folkesson---
Notes:
v4:
- add LIBDIR to LDFLAGS if DESTDIR is specified
- export LIBSEPOLA if DESTDIR is specified
v3:
- Add default prefix
Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Makefile +7 -2
@@ -1,3 +1,4 @@ +PREFIX ?= /usr OPT_SUBDIRS ?= dbus gui mcstrans python restorecond sandbox semodule-utils SUBDIRS=libsepol libselinux libsemanage checkpolicy secilc policycoreutils $(OPT_SUBDIRS) PYSUBDIRS=libselinux libsemanage
@@ -19,10 +20,14 @@ else endif ifneq ($(DESTDIR),) - CFLAGS += -I$(DESTDIR)/usr/include - LDFLAGS += -L$(DESTDIR)/usr/lib + LIBDIR ?= $(DESTDIR)$(PREFIX)/lib + LIBSEPOLA ?= $(LIBDIR)/libsepol.a + + CFLAGS += -I$(DESTDIR)$(PREFIX)/include + LDFLAGS += -L$(DESTDIR)$(PREFIX)/lib -L$(LIBDIR) export CFLAGS export LDFLAGS + export LIBSEPOLA endif all install relabel clean test indent:
Signature · 1 line
2.15.1
Quoted 15 lines · Marcus Folkesson
I have updated the patchset.
The biggest change is that $(DESTDIR) is now used in the install stage only.
Also some overidden CFLAGS/LDFLAGS has been removed since we now have explicit build rules.
I have moved the changelog into patches.
Please test to compile with:
make DESTDIR=/tmp/myroot PREFIX=/myusr install
or
make DESTDIR=/tmp/myroot install
Quoted 5 lines
Thanks for all feedback.
Best regards
Marcus Folkesson
Hi,
Thanks for this update! Here are three comments on this patchset:
* you forgot a $(DESTDIR) occurrence in patch 7.
* .travis.yml needs a simple patch to fix the value of PYSITEDIR. I will send it later.
* While reading the Makefile after patch 15, I have been surprised by "LIBDIR ?= $(DESTDIR)$(PREFIX)/lib", with DESTDIR. As this variable is not exported, it works fine as it is, but it might be cleaner to define it as "LIBDIR ?= $(PREFIX)/lib" and to use $(DESTDIR) in the following lines. This point may be addressed in a follow-up commit after the patchset has been merged.
As the patchset looks almost ready to be merged, I have created
https://github.com/SELinuxProject/selinux/pull/79 with a modified patch 7 and my patch for .travis.yml. This pull request holds the commits I plan to apply in a few days if no other maintainer disagrees with this.
Best,
Nicolas
Hi Nicolas,
First of all, thank you for your review.
Quoted 19 lines · Nicolas Iooss
Quoted 17 lines · Marcus Folkesson
I have updated the patchset.
The biggest change is that $(DESTDIR) is now used in the install stage only.
Also some overidden CFLAGS/LDFLAGS has been removed since we now have explicit build rules.
I have moved the changelog into patches.
Please test to compile with:
make DESTDIR=/tmp/myroot PREFIX=/myusr install
or
make DESTDIR=/tmp/myroot installThanks for all feedback.
Quoted 8 lines
Quoted 3 lines
Best regards
Marcus FolkessonHi,
Thanks for this update! Here are three comments on this patchset:* you forgot a $(DESTDIR) occurrence in patch 7.
Good catch!
Quoted 2 lines
* .travis.yml needs a simple patch to fix the value of PYSITEDIR. I will send it later.
Please do.
Quoted 6 lines
* While reading the
Makefileafter patch 15, I have been surprised by "LIBDIR ?= $(DESTDIR)$(PREFIX)/lib", with DESTDIR. As this variable is not exported, it works fine as it is, but it might be cleaner to define it as "LIBDIR ?= $(PREFIX)/lib" and to use $(DESTDIR) in the following lines. This point may be addressed in a follow-up commit after the patchset has been merged.
I agree.
I also think it could be part of a follow-up commit. I will take a note.
Quoted 6 lines
As the patchset looks almost ready to be merged, I have created
https://github.com/SELinuxProject/selinux/pull/79 with a modified patch 7 and my patch for .travis.yml. This pull request holds the commits I plan to apply in a few days if no other maintainer disagrees with this.
Ok, then I will not come up with a v6 that fixes your feedback for patch #7.
Quoted 4 lines
Best,
Nicolas
Best regards
Marcus Folkesson
Quoted 51 lines · Marcus Folkesson
Hi Nicolas,
First of all, thank you for your review.
Quoted 19 lines · Nicolas Iooss
Quoted 17 lines · Marcus Folkesson
I have updated the patchset.
The biggest change is that $(DESTDIR) is now used in the install stage only.
Also some overidden CFLAGS/LDFLAGS has been removed since we now have explicit build rules.
I have moved the changelog into patches.
Please test to compile with:
make DESTDIR=/tmp/myroot PREFIX=/myusr install
or
make DESTDIR=/tmp/myroot installThanks for all feedback.
Quoted 8 lines
Quoted 3 lines
Best regards
Marcus FolkessonHi,
Thanks for this update! Here are three comments on this patchset:* you forgot a $(DESTDIR) occurrence in patch 7.
Good catch!
Quoted 2 lines
* .travis.yml needs a simple patch to fix the value of PYSITEDIR. I will send it later.
Please do.
Quoted 6 lines
* While reading the
Makefileafter patch 15, I have been surprised by "LIBDIR ?= $(DESTDIR)$(PREFIX)/lib", with DESTDIR. As this variable is not exported, it works fine as it is, but it might be cleaner to define it as "LIBDIR ?= $(PREFIX)/lib" and to use $(DESTDIR) in the following lines. This point may be addressed in a follow-up commit after the patchset has been merged.I agree.
I also think it could be part of a follow-up commit. I will take a note.Quoted 1 line
Quoted 8 lines
Quoted 5 lines
As the patchset looks almost ready to be merged, I have created
https://github.com/SELinuxProject/selinux/pull/79 with a modified patch 7 and my patch for .travis.yml. This pull request holds the commits I plan to apply in a few days if no other maintainer disagrees with this.Ok, then I will not come up with a v6 that fixes your feedback for patch #7.
I have merged this patchset. Thanks!
Nicolas
Quoted 59 lines · Nicolas Iooss
Quoted 57 lines · Marcus Folkesson
Hi Nicolas,
First of all, thank you for your review.
Quoted 19 lines · Nicolas Iooss
Quoted 17 lines · Marcus Folkesson
I have updated the patchset.
The biggest change is that $(DESTDIR) is now used in the install stage only.
Also some overidden CFLAGS/LDFLAGS has been removed since we now have explicit build rules.
I have moved the changelog into patches.
Please test to compile with:
make DESTDIR=/tmp/myroot PREFIX=/myusr install
or
make DESTDIR=/tmp/myroot installThanks for all feedback.
Quoted 8 lines
Quoted 3 lines
Best regards
Marcus FolkessonHi,
Thanks for this update! Here are three comments on this patchset:* you forgot a $(DESTDIR) occurrence in patch 7.
Good catch!
Quoted 2 lines
* .travis.yml needs a simple patch to fix the value of PYSITEDIR. I will send it later.
Please do.
Quoted 6 lines
* While reading the
Makefileafter patch 15, I have been surprised by "LIBDIR ?= $(DESTDIR)$(PREFIX)/lib", with DESTDIR. As this variable is not exported, it works fine as it is, but it might be cleaner to define it as "LIBDIR ?= $(PREFIX)/lib" and to use $(DESTDIR) in the following lines. This point may be addressed in a follow-up commit after the patchset has been merged.I agree.
I also think it could be part of a follow-up commit. I will take a note.Quoted 6 lines
As the patchset looks almost ready to be merged, I have created
https://github.com/SELinuxProject/selinux/pull/79 with a modified patch 7 and my patch for .travis.yml. This pull request holds the commits I plan to apply in a few days if no other maintainer disagrees with this.
Quoted 4 lines
Quoted 2 lines
Ok, then I will not come up with a v6 that fixes your feedback for patch #7.
I have merged this patchset. Thanks!
Thank you.
Do you know when the next release is planned?
Quoted 3 lines
Nicolas
Best regards
Marcus Folkesson