All of lore.kernel.org
 help / color / mirror / Atom feed
* Rework of Makefiles v3
@ 2018-01-21 21:46 Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 01/14] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds

Hi all,

I have updated the patchset.

Please test to compile with:
make DESTDIR=/tmp/myroot PREFIX=/myusr install
or
make DESTDIR=/tmp/myroot install

As said before, the goal with this patchset is to clean up the
Makefiles on unused symbols, use standard semantics and keep all
the old functionality.

Changes:
v3:
	- python: Add missing slash 
	- Top makefile: Add default prefix
	- python, mcstrans, selinux: 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)

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3 01/14] libsepol: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 02/14] libselinux: " Marcus Folkesson
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

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

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 README                      | 2 +-
 libsepol/include/Makefile   | 4 ++--
 libsepol/man/Makefile       | 5 +++--
 libsepol/src/Makefile       | 7 +++----
 libsepol/src/libsepol.pc.in | 2 +-
 libsepol/utils/Makefile     | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/README b/README
index 7fc7b17b..174551a1 100644
--- a/README
+++ b/README
@@ -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).
diff --git a/libsepol/include/Makefile b/libsepol/include/Makefile
index 56b7a114..ad5c34a4 100644
--- a/libsepol/include/Makefile
+++ b/libsepol/include/Makefile
@@ -1,6 +1,6 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCDIR ?= $(PREFIX)/include/sepol
+PREFIX ?= /usr
+INCDIR = $(DESTDIR)$(PREFIX)/include/sepol
 CILDIR ?= ../cil
 
 all:
diff --git a/libsepol/man/Makefile b/libsepol/man/Makefile
index 11924334..4f3d9fa2 100644
--- a/libsepol/man/Makefile
+++ b/libsepol/man/Makefile
@@ -1,6 +1,7 @@
 # Installation directories.
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX ?= /usr
+MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8
+MAN3DIR ?= $(DESTDIR)$(PREFIX)/share/man/man3
 
 all:
 
diff --git a/libsepol/src/Makefile b/libsepol/src/Makefile
index 819d261b..d158398f 100644
--- a/libsepol/src/Makefile
+++ b/libsepol/src/Makefile
@@ -1,10 +1,9 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
+PREFIX ?= /usr
 INCLUDEDIR ?= $(PREFIX)/include
-LIBDIR ?= $(PREFIX)/lib
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 SHLIBDIR ?= $(DESTDIR)/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)
diff --git a/libsepol/src/libsepol.pc.in b/libsepol/src/libsepol.pc.in
index e52f5892..f807fec6 100644
--- a/libsepol/src/libsepol.pc.in
+++ b/libsepol/src/libsepol.pc.in
@@ -1,6 +1,6 @@
 prefix=@prefix@
 exec_prefix=${prefix}
-libdir=${exec_prefix}/@libdir@
+libdir=@libdir@
 includedir=@includedir@
 
 Name: libsepol
diff --git a/libsepol/utils/Makefile b/libsepol/utils/Makefile
index fba1d8a0..8ce4bf47 100644
--- a/libsepol/utils/Makefile
+++ b/libsepol/utils/Makefile
@@ -1,6 +1,6 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-BINDIR ?= $(PREFIX)/bin
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
 
 CFLAGS ?= -Wall -Werror
 override CFLAGS += -I../include
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 02/14] libselinux: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 01/14] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 03/14] libsemanage: " Marcus Folkesson
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

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

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 libselinux/include/Makefile     |  4 ++--
 libselinux/man/Makefile         |  7 ++++---
 libselinux/src/Makefile         | 14 +++++++++-----
 libselinux/src/libselinux.pc.in |  2 +-
 libselinux/utils/Makefile       |  6 ++----
 5 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/libselinux/include/Makefile b/libselinux/include/Makefile
index 757a6c9c..3b51f5ce 100644
--- a/libselinux/include/Makefile
+++ b/libselinux/include/Makefile
@@ -1,6 +1,6 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCDIR ?= $(PREFIX)/include/selinux
+PREFIX ?= /usr
+INCDIR = $(DESTDIR)$(PREFIX)/include/selinux
 
 all:
 
diff --git a/libselinux/man/Makefile b/libselinux/man/Makefile
index 0643e6af..233bfaa9 100644
--- a/libselinux/man/Makefile
+++ b/libselinux/man/Makefile
@@ -1,7 +1,8 @@
 # Installation directories.
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
-MAN5DIR ?= $(DESTDIR)/usr/share/man/man5
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX	?= /usr
+MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8
+MAN5DIR ?= $(DESTDIR)$(PREFIX)/share/man/man5
+MAN3DIR ?= $(DESTDIR)$(PREFIX)/share/man/man3
 
 all:
 
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 18df75c8..e18c00f2 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -8,8 +8,8 @@ RUBYPREFIX ?= $(notdir $(RUBY))
 PKG_CONFIG ?= pkg-config
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
+PREFIX ?= /usr
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 SHLIBDIR ?= $(DESTDIR)/lib
 INCLUDEDIR ?= $(PREFIX)/include
 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
@@ -19,8 +19,6 @@ PYCEXT ?= $(shell $(PYTHON) -c 'import imp;print([s for s,m,t in imp.get_suffixe
 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"]')
-LIBBASE ?= $(shell basename $(LIBDIR))
-LIBSEPOLA ?= $(LIBDIR)/libsepol.a
 
 VERSION = $(shell cat ../VERSION)
 LIBVERSION = 1
@@ -50,6 +48,12 @@ LIBSO=$(TARGET).$(LIBVERSION)
 AUDIT2WHYLOBJ=$(PYPREFIX)audit2why.lo
 AUDIT2WHYSO=$(PYPREFIX)audit2why.so
 
+
+# If no specific libsepol.a is specified, fall back on LDFLAGS search path
+ifeq ($(LIBSEPOLA),)
+       LDFLAGS += -l:libsepol.a
+endif
+
 GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) selinuxswig_python_exception.i
 SRCS= $(filter-out $(GENERATED) audit2why.c, $(sort $(wildcard *.c)))
 
@@ -148,7 +152,7 @@ $(LIBSO): $(LOBJS)
 	ln -sf $@ $(TARGET)
 
 $(LIBPC): $(LIBPC).in ../VERSION
-	sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):; s:@PCRE_MODULE@:$(PCRE_MODULE):' < $< > $@
+	sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBDIR):; s:@includedir@:$(INCLUDEDIR):; s:@PCRE_MODULE@:$(PCRE_MODULE):' < $< > $@
 
 selinuxswig_python_exception.i: ../include/selinux/selinux.h
 	bash -e exception.sh > $@ || (rm -f $@ ; false)
diff --git a/libselinux/src/libselinux.pc.in b/libselinux/src/libselinux.pc.in
index 2e90a844..7c66b1fa 100644
--- a/libselinux/src/libselinux.pc.in
+++ b/libselinux/src/libselinux.pc.in
@@ -1,6 +1,6 @@
 prefix=@prefix@
 exec_prefix=${prefix}
-libdir=${exec_prefix}/@libdir@
+libdir=@libdir@
 includedir=@includedir@
 
 Name: libselinux
diff --git a/libselinux/utils/Makefile b/libselinux/utils/Makefile
index eb4851a9..9adce6d3 100644
--- a/libselinux/utils/Makefile
+++ b/libselinux/utils/Makefile
@@ -1,8 +1,6 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
-SBINDIR ?= $(PREFIX)/sbin
-INCLUDEDIR ?= $(PREFIX)/include
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
 
 OS ?= $(shell uname)
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 03/14] libsemanage: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 01/14] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 02/14] libselinux: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 04/14] checkpolicy: " Marcus Folkesson
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

This 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

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 libsemanage/include/Makefile      | 4 ++--
 libsemanage/man/Makefile          | 5 +++--
 libsemanage/src/Makefile          | 9 +++------
 libsemanage/src/libsemanage.pc.in | 2 +-
 libsemanage/tests/Makefile        | 3 ---
 libsemanage/utils/Makefile        | 4 ++--
 6 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/libsemanage/include/Makefile b/libsemanage/include/Makefile
index b660660e..f4234b9e 100644
--- a/libsemanage/include/Makefile
+++ b/libsemanage/include/Makefile
@@ -1,6 +1,6 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCDIR ?= $(PREFIX)/include/semanage
+PREFIX ?= /usr
+INCDIR ?= $(DESTDIR)$(PREFIX)/include/semanage
 
 all:
 
diff --git a/libsemanage/man/Makefile b/libsemanage/man/Makefile
index 852043d4..43c2b3f6 100644
--- a/libsemanage/man/Makefile
+++ b/libsemanage/man/Makefile
@@ -1,6 +1,7 @@
 # Installation directories.
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
-MAN5DIR ?= $(DESTDIR)/usr/share/man/man5
+PREFIX ?= /usr
+MAN3DIR ?= $(DESTDIR)$(PREFIX)/share/man/man3
+MAN5DIR ?= $(DESTDIR)$(PREFIX)/share/man/man5
 
 all:
 
diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
index fdb178f5..f66d1b73 100644
--- a/libsemanage/src/Makefile
+++ b/libsemanage/src/Makefile
@@ -8,9 +8,8 @@ RUBYPREFIX ?= $(notdir $(RUBY))
 PKG_CONFIG ?= pkg-config
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
-SHLIBDIR ?= $(DESTDIR)/lib
+PREFIX ?= /usr
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 INCLUDEDIR ?= $(PREFIX)/include
 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
 PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
@@ -20,8 +19,6 @@ RUBYINC ?= $(shell $(RUBY) -e 'puts "-I" + RbConfig::CONFIG["rubyarchhdrdir"] +
 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"]')
 
-LIBBASE=$(shell basename $(LIBDIR))
-
 DEFAULT_SEMANAGE_CONF_LOCATION=$(DESTDIR)/etc/selinux/semanage.conf
 
 ifeq ($(DEBUG),1)
@@ -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)
diff --git a/libsemanage/src/libsemanage.pc.in b/libsemanage/src/libsemanage.pc.in
index d3eaa062..43681ddb 100644
--- a/libsemanage/src/libsemanage.pc.in
+++ b/libsemanage/src/libsemanage.pc.in
@@ -1,6 +1,6 @@
 prefix=@prefix@
 exec_prefix=${prefix}
-libdir=${exec_prefix}/@libdir@
+libdir=@libdir@
 includedir=@includedir@
 
 Name: libsemanage
diff --git a/libsemanage/tests/Makefile b/libsemanage/tests/Makefile
index 2ef8d30d..324766a0 100644
--- a/libsemanage/tests/Makefile
+++ b/libsemanage/tests/Makefile
@@ -1,6 +1,3 @@
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
-
 # Add your test source files here:
 SOURCES = $(sort $(wildcard *.c))
 
diff --git a/libsemanage/utils/Makefile b/libsemanage/utils/Makefile
index 725f0eec..f527ad07 100644
--- a/libsemanage/utils/Makefile
+++ b/libsemanage/utils/Makefile
@@ -1,6 +1,6 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBEXECDIR ?= $(PREFIX)/libexec
+PREFIX ?= /usr
+LIBEXECDIR ?= $(DESTDIR)$(PREFIX)/libexec
 SELINUXEXECDIR ?= $(LIBEXECDIR)/selinux/
 
 all:
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 04/14] checkpolicy: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (2 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 03/14] libsemanage: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 05/14] gui: " Marcus Folkesson
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

This 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

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 checkpolicy/Makefile      | 19 ++++++++++++-------
 checkpolicy/test/Makefile | 15 ++++++++++-----
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/checkpolicy/Makefile b/checkpolicy/Makefile
index 68e11f2a..78a8a43b 100644
--- a/checkpolicy/Makefile
+++ b/checkpolicy/Makefile
@@ -1,12 +1,10 @@
 #
 # Makefile for building the checkpolicy program
 #
-PREFIX ?= $(DESTDIR)/usr
-BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
-INCLUDEDIR ?= $(PREFIX)/include
-LIBSEPOLA ?= $(LIBDIR)/libsepol.a
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 TARGETS = checkpolicy checkmodule
 
 LEX = flex
@@ -14,6 +12,11 @@ YACC = bison -y
 
 CFLAGS ?= -g -Wall -Werror -Wshadow -O2 -pipe -fno-strict-aliasing
 
+# If no specific libsepol.a is specified, fall back on LDFLAGS search path
+ifeq ($(LIBSEPOLA),)
+       LDFLAGS += -l:libsepol.a
+endif
+
 override CFLAGS += -I.
 
 CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \
@@ -27,11 +30,13 @@ all:  $(TARGETS)
 	$(MAKE) -C test
 
 checkpolicy: $(CHECKPOLOBJS) $(LIBSEPOLA)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
 checkmodule: $(CHECKMODOBJS) $(LIBSEPOLA)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
 %.o: %.c 
-	$(CC) $(CFLAGS) -o $@ -c $<
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
 
 y.tab.o: y.tab.c
 	$(CC) $(filter-out -Werror, $(CFLAGS)) -o $@ -c $<
diff --git a/checkpolicy/test/Makefile b/checkpolicy/test/Makefile
index 59fa4460..3eb1c512 100644
--- a/checkpolicy/test/Makefile
+++ b/checkpolicy/test/Makefile
@@ -1,19 +1,24 @@
 #
 # Makefile for building the dispol program
 #
-PREFIX ?= $(DESTDIR)/usr
-BINDIR ?= $(PREFIX)/bin
-LIBDIR ?= $(PREFIX)/lib
-INCLUDEDIR ?= $(PREFIX)/include
-LIBSEPOLA ?= $(LIBDIR)/libsepol.a
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 
 CFLAGS ?= -g -Wall -W -Werror -O2 -pipe
 
+# If no specific libsepol.a is specified, fall back on LDFLAGS search path
+ifeq ($(LIBSEPOLA),)
+       LDFLAGS += -l:libsepol.a
+endif
+
 all: dispol dismod
 
 dispol: dispol.o $(LIBSEPOLA)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
 dismod: dismod.o $(LIBSEPOLA)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
 clean:
 	-rm -f dispol dismod *.o 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 05/14] gui: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (3 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 04/14] checkpolicy: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 06/14] mcstrans: " Marcus Folkesson
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 gui/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gui/Makefile b/gui/Makefile
index cfe47405..5efd17d7 100644
--- a/gui/Makefile
+++ b/gui/Makefile
@@ -1,9 +1,9 @@
 # Installation directories.
-PREFIX ?= ${DESTDIR}/usr
-BINDIR ?= $(PREFIX)/bin
-SHAREDIR ?= $(PREFIX)/share/system-config-selinux
-DATADIR ?= $(PREFIX)/share
-MANDIR ?= $(PREFIX)/share/man
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+SHAREDIR ?= $(DESTDIR)$(PREFIX)/share/system-config-selinux
+DATADIR ?= $(DESTDIR)$(PREFIX)/share
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 
 TARGETS= \
 booleansPage.py \
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 06/14] mcstrans: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (4 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 05/14] gui: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 07/14] policycoreutils: " Marcus Folkesson
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 mcstrans/man/Makefile   |  3 ++-
 mcstrans/src/Makefile   | 18 +++++++++++-------
 mcstrans/utils/Makefile | 20 ++++++++++++++------
 3 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/mcstrans/man/Makefile b/mcstrans/man/Makefile
index 8e971192..5030fa81 100644
--- a/mcstrans/man/Makefile
+++ b/mcstrans/man/Makefile
@@ -1,5 +1,6 @@
 # Installation directories.
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
+PREFIX ?= /usr
+MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8
 
 all:
 
diff --git a/mcstrans/src/Makefile b/mcstrans/src/Makefile
index 3f4a89c3..09551d63 100644
--- a/mcstrans/src/Makefile
+++ b/mcstrans/src/Makefile
@@ -1,10 +1,14 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
+PREFIX ?= /usr
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 SBINDIR ?= $(DESTDIR)/sbin
 INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
-SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd
-LIBSEPOLA ?= $(LIBDIR)/libsepol.a
+SYSTEMDDIR ?= $(DESTDIR)$(PREFIX)/lib/systemd
+
+# If no specific libsepol.a is specified, fall back on LDFLAGS search path
+ifeq ($(LIBSEPOLA),)
+       LDFLAGS += -l:libsepol.a
+endif
 
 PROG_SRC=mcstrans.c  mcscolor.c  mcstransd.c  mls_level.c
 PROG_OBJS= $(patsubst %.c,%.o,$(PROG_SRC))
@@ -15,11 +19,11 @@ 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) -pie -o $@ $^ -lselinux -lcap -lpcre $(LDFLAGS)
 
 %.o:  %.c 
-	$(CC) $(CFLAGS) -fPIE -c -o $@ $<
+	$(CC) $(CFLAGS) -fPIE -c -o $@ $< $(LDFLAGS)
 
 install: all
 	test -d $(SBINDIR) || install -m 755 -d $(SBINDIR)
diff --git a/mcstrans/utils/Makefile b/mcstrans/utils/Makefile
index 4d3cbfcb..0a0452a4 100644
--- a/mcstrans/utils/Makefile
+++ b/mcstrans/utils/Makefile
@@ -1,18 +1,26 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
-SBINDIR ?= $(PREFIX)/sbin
-LIBSEPOLA ?= $(LIBDIR)/libsepol.a
+PREFIX ?= /usr
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
 
 CFLAGS ?= -Wall
 override CFLAGS += -I../src -D_GNU_SOURCE
 override LDLIBS += -lselinux -lpcre
 
-TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
+TARGETS=transcon untranscon
+
+# If no specific libsepol.a is specified, fall back on LDFLAGS search path
+ifeq ($(LIBSEPOLA),)
+       LDFLAGS += -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) $(CFLAGS) -o $@ $^ $(LDFLAGS) -lpcre -lselinux
+
+untranscon: untranscon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) -lpcre -lselinux
 
 install: all
 	-mkdir -p $(SBINDIR)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 07/14] policycoreutils: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (5 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 06/14] mcstrans: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 08/14] python: " Marcus Folkesson
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 policycoreutils/hll/pp/Makefile      |  7 ++-----
 policycoreutils/load_policy/Makefile |  8 ++++----
 policycoreutils/man/Makefile         |  3 ++-
 policycoreutils/newrole/Makefile     |  8 ++++----
 policycoreutils/po/Makefile          |  3 ++-
 policycoreutils/run_init/Makefile    |  8 ++++----
 policycoreutils/scripts/Makefile     |  8 ++++----
 policycoreutils/secon/Makefile       |  9 ++++-----
 policycoreutils/semodule/Makefile    |  8 +++-----
 policycoreutils/sestatus/Makefile    |  8 ++++----
 policycoreutils/setfiles/Makefile    |  5 ++---
 policycoreutils/setsebool/Makefile   | 10 ++++------
 12 files changed, 39 insertions(+), 46 deletions(-)

diff --git a/policycoreutils/hll/pp/Makefile b/policycoreutils/hll/pp/Makefile
index 3401dcc9..ce58e0cf 100644
--- a/policycoreutils/hll/pp/Makefile
+++ b/policycoreutils/hll/pp/Makefile
@@ -1,9 +1,6 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
-MANDIR = $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
-LIBEXECDIR ?= $(PREFIX)/libexec
+PREFIX ?= /usr
+LIBEXECDIR ?= $(DESTDIR)$(PREFIX)/libexec
 HLLDIR ?= $(LIBEXECDIR)/selinux/hll
 
 CFLAGS ?= -Werror -Wall -W
diff --git a/policycoreutils/load_policy/Makefile b/policycoreutils/load_policy/Makefile
index b85833c2..720bf45f 100644
--- a/policycoreutils/load_policy/Makefile
+++ b/policycoreutils/load_policy/Makefile
@@ -1,8 +1,8 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-SBINDIR ?= $(DESTDIR)/sbin
-MANDIR ?= $(PREFIX)/share/man
-LOCALEDIR ?= /usr/share/locale
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
+LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
 
 CFLAGS ?= -Werror -Wall -W
 override CFLAGS += $(LDFLAGS) -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
diff --git a/policycoreutils/man/Makefile b/policycoreutils/man/Makefile
index 0d91cd46..8a8fbd49 100644
--- a/policycoreutils/man/Makefile
+++ b/policycoreutils/man/Makefile
@@ -1,5 +1,6 @@
 # Installation directories.
-MAN5DIR ?= $(DESTDIR)/usr/share/man/man5
+PREFIX ?= /usr
+MAN5DIR ?= $(DESTDIR)$(PREFIX)/share/man/man5
 
 all:
 
diff --git a/policycoreutils/newrole/Makefile b/policycoreutils/newrole/Makefile
index 196af926..4dbe6f52 100644
--- a/policycoreutils/newrole/Makefile
+++ b/policycoreutils/newrole/Makefile
@@ -1,9 +1,9 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/share/man
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 ETCDIR ?= $(DESTDIR)/etc
-LOCALEDIR = /usr/share/locale
+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.
diff --git a/policycoreutils/po/Makefile b/policycoreutils/po/Makefile
index 58148613..c583d23a 100644
--- a/policycoreutils/po/Makefile
+++ b/policycoreutils/po/Makefile
@@ -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 = $(DESTDIR)$(PREFIX)/share/locale
 
 # PO catalog handling
 MSGMERGE	= msgmerge
diff --git a/policycoreutils/run_init/Makefile b/policycoreutils/run_init/Makefile
index 921f0b07..4178493e 100644
--- a/policycoreutils/run_init/Makefile
+++ b/policycoreutils/run_init/Makefile
@@ -1,10 +1,10 @@
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-SBINDIR ?= $(PREFIX)/sbin
-MANDIR ?= $(PREFIX)/share/man
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 ETCDIR ?= $(DESTDIR)/etc
-LOCALEDIR ?= /usr/share/locale
+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)
 
diff --git a/policycoreutils/scripts/Makefile b/policycoreutils/scripts/Makefile
index d9e86ffe..cfd841ec 100644
--- a/policycoreutils/scripts/Makefile
+++ b/policycoreutils/scripts/Makefile
@@ -1,8 +1,8 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-SBINDIR ?= $(DESTDIR)/sbin
-MANDIR ?= $(PREFIX)/share/man
-LOCALEDIR ?= $(PREFIX)/share/locale
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
+LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
 
 .PHONY: all
 all: fixfiles
diff --git a/policycoreutils/secon/Makefile b/policycoreutils/secon/Makefile
index 8e491d74..4ecbd57d 100644
--- a/policycoreutils/secon/Makefile
+++ b/policycoreutils/secon/Makefile
@@ -1,9 +1,8 @@
 # secon tool - command-line context
-PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
-BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
+LIBDIR ?= $(DESTDIR)$(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)
diff --git a/policycoreutils/semodule/Makefile b/policycoreutils/semodule/Makefile
index fffb43ac..9d47e7e1 100644
--- a/policycoreutils/semodule/Makefile
+++ b/policycoreutils/semodule/Makefile
@@ -1,9 +1,7 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
-SBINDIR ?= $(PREFIX)/sbin
-MANDIR = $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR = $(DESTDIR)$(PREFIX)/share/man
 
 CFLAGS ?= -Werror -Wall -W
 override LDLIBS += -lsepol -lselinux -lsemanage
diff --git a/policycoreutils/sestatus/Makefile b/policycoreutils/sestatus/Makefile
index 41ca6832..15443800 100644
--- a/policycoreutils/sestatus/Makefile
+++ b/policycoreutils/sestatus/Makefile
@@ -1,9 +1,9 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-SBINDIR ?= $(PREFIX)/sbin
-MANDIR = $(PREFIX)/share/man
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR = $(DESTDIR)$(PREFIX)/share/man
 ETCDIR ?= $(DESTDIR)/etc
-LIBDIR ?= $(PREFIX)/lib
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
 
 CFLAGS ?= -Werror -Wall -W
 override CFLAGS += -D_FILE_OFFSET_BITS=64
diff --git a/policycoreutils/setfiles/Makefile b/policycoreutils/setfiles/Makefile
index c08e2dd1..2a384234 100644
--- a/policycoreutils/setfiles/Makefile
+++ b/policycoreutils/setfiles/Makefile
@@ -1,8 +1,7 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
+PREFIX ?= /usr
 SBINDIR ?= $(DESTDIR)/sbin
-MANDIR = $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
+MANDIR = $(DESTDIR)$(PREFIX)/share/man
 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 }')
diff --git a/policycoreutils/setsebool/Makefile b/policycoreutils/setsebool/Makefile
index bc254dab..cf300336 100644
--- a/policycoreutils/setsebool/Makefile
+++ b/policycoreutils/setsebool/Makefile
@@ -1,10 +1,8 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
-SBINDIR ?= $(PREFIX)/sbin
-MANDIR = $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
-BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR = $(DESTDIR)$(PREFIX)/share/man
+BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
 
 CFLAGS ?= -Werror -Wall -W
 override LDLIBS += -lsepol -lselinux -lsemanage
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 08/14] python: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (6 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 07/14] policycoreutils: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-23 10:24   ` Petr Lautrbach
  2018-01-21 21:46 ` [PATCH v3 09/14] restorecond: " Marcus Folkesson
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 python/audit2allow/Makefile           | 17 ++++++++++-------
 python/chcat/Makefile                 |  8 ++++----
 python/semanage/Makefile              | 11 +++++------
 python/sepolgen/src/sepolgen/Makefile |  3 ++-
 python/sepolicy/Makefile              | 18 +++++++++---------
 5 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/python/audit2allow/Makefile b/python/audit2allow/Makefile
index 8db8075f..d1d4ca8d 100644
--- a/python/audit2allow/Makefile
+++ b/python/audit2allow/Makefile
@@ -1,19 +1,22 @@
 PYTHON ?= python
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-BINDIR ?= $(PREFIX)/bin
-LIBDIR ?= $(PREFIX)/lib
-MANDIR ?= $(PREFIX)/share/man
-LOCALEDIR ?= /usr/share/locale
-INCLUDEDIR ?= $(PREFIX)/include
-LIBSEPOLA ?= $(LIBDIR)/libsepol.a
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 
 CFLAGS ?= -Werror -Wall -W
 
+# If no specific libsepol.a is specified, fall back on LDFLAGS search path
+ifeq ($(LIBSEPOLA),)
+       LDFLAGS += -l:libsepol.a
+endif
+
 all: audit2why sepolgen-ifgen-attr-helper
 
 sepolgen-ifgen-attr-helper: sepolgen-ifgen-attr-helper.o $(LIBSEPOLA)
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
 audit2why:
 	ln -sf audit2allow audit2why
diff --git a/python/chcat/Makefile b/python/chcat/Makefile
index 0fd12d6d..947734a0 100644
--- a/python/chcat/Makefile
+++ b/python/chcat/Makefile
@@ -1,8 +1,8 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/share/man
-LOCALEDIR ?= $(PREFIX)/share/locale
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
+LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
 
 .PHONY: all
 all: chcat
diff --git a/python/semanage/Makefile b/python/semanage/Makefile
index 132162bc..0218222d 100644
--- a/python/semanage/Makefile
+++ b/python/semanage/Makefile
@@ -1,13 +1,12 @@
 PYTHON ?= python
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
-SBINDIR ?= $(PREFIX)/sbin
-MANDIR = $(PREFIX)/share/man
-PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR = $(DESTDIR)$(PREFIX)/share/man
+PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))")
 PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)
-BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
+BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
 
 TARGETS=semanage
 
diff --git a/python/sepolgen/src/sepolgen/Makefile b/python/sepolgen/src/sepolgen/Makefile
index d3aa7715..2121a955 100644
--- a/python/sepolgen/src/sepolgen/Makefile
+++ b/python/sepolgen/src/sepolgen/Makefile
@@ -1,5 +1,6 @@
+PREFIX ?= /usr
 PYTHON ?= python
-PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
+PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))")
 PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/sepolgen
 
 all:
diff --git a/python/sepolicy/Makefile b/python/sepolicy/Makefile
index 5a56e6c8..1c02ee06 100644
--- a/python/sepolicy/Makefile
+++ b/python/sepolicy/Makefile
@@ -1,14 +1,14 @@
 PYTHON ?= python
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-LIBDIR ?= $(PREFIX)/lib
-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
+PREFIX ?= /usr
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+DATADIR ?= $(DESTDIR)$(PREFIX)/share
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
+LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
+BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
+SHAREDIR ?= $(DESTDIR)$(PREFIX)/share/sandbox
 CFLAGS ?= -Wall -Werror -Wextra -W
 override CFLAGS += -DPACKAGE="policycoreutils" -DSHARED -shared
 
@@ -30,7 +30,7 @@ test:
 	@$(PYTHON) test_sepolicy.py -v
 
 install:
-	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
+	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
 	[ -d $(BINDIR) ] || mkdir -p $(BINDIR)
 	install -m 755 sepolicy.py $(BINDIR)/sepolicy
 	(cd $(BINDIR); ln -sf sepolicy sepolgen)
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 09/14] restorecond: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (7 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 08/14] python: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 10/14] sandbox: " Marcus Folkesson
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 restorecond/Makefile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/restorecond/Makefile b/restorecond/Makefile
index ada94aeb..a2316947 100644
--- a/restorecond/Makefile
+++ b/restorecond/Makefile
@@ -1,13 +1,12 @@
 PKG_CONFIG ?= pkg-config
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-SBINDIR ?= $(PREFIX)/sbin
-LIBDIR ?= $(PREFIX)/lib
-MANDIR = $(PREFIX)/share/man
+PREFIX ?= /usr
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR = $(DESTDIR)$(PREFIX)/share/man
 AUTOSTARTDIR = $(DESTDIR)/etc/xdg/autostart
-DBUSSERVICEDIR = $(DESTDIR)/usr/share/dbus-1/services
-SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd
+DBUSSERVICEDIR = $(DESTDIR)$(PREFIX)/share/dbus-1/services
+SYSTEMDDIR ?= $(DESTDIR)$(PREFIX)/lib/systemd
 
 autostart_DATA = sealertauto.desktop
 INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 10/14] sandbox: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (8 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 09/14] restorecond: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 11/14] secilc: " Marcus Folkesson
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 sandbox/Makefile | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sandbox/Makefile b/sandbox/Makefile
index 05c3d658..5a6b707a 100644
--- a/sandbox/Makefile
+++ b/sandbox/Makefile
@@ -1,14 +1,14 @@
 PYTHON ?= python
 
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
+PREFIX ?= /usr
 SYSCONFDIR ?= $(DESTDIR)/etc/sysconfig
-LIBDIR ?= $(PREFIX)/lib
-BINDIR ?= $(PREFIX)/bin
-SBINDIR ?= $(PREFIX)/sbin
-MANDIR ?= $(PREFIX)/share/man
+LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 LOCALEDIR ?= /usr/share/locale
-SHAREDIR ?= $(PREFIX)/share/sandbox
+SHAREDIR ?= $(DESTDIR)$(PREFIX)/share/sandbox
 override CFLAGS += -DPACKAGE="\"policycoreutils\"" -Wall -Werror -Wextra -W
 override LDLIBS += -lselinux -lcap-ng
 SEUNSHARE_OBJS = seunshare.o
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 11/14] secilc: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (9 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 10/14] sandbox: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 12/14] semodule-utils: " Marcus Folkesson
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 secilc/Makefile | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/secilc/Makefile b/secilc/Makefile
index 1cac53e4..5b0a4852 100644
--- a/secilc/Makefile
+++ b/secilc/Makefile
@@ -1,8 +1,6 @@
-PREFIX ?= $(DESTDIR)/usr
-BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
-INCLUDEDIR ?= $(PREFIX)/include
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 
 SECILC = secilc
 SECILC_SRCS := secilc.c
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 12/14] semodule-utils: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (10 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 11/14] secilc: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 13/14] dbus: " Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 14/14] build: add prefix for includes in top Makefile Marcus Folkesson
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 semodule-utils/semodule_expand/Makefile  | 8 +++-----
 semodule-utils/semodule_link/Makefile    | 8 +++-----
 semodule-utils/semodule_package/Makefile | 8 +++-----
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/semodule-utils/semodule_expand/Makefile b/semodule-utils/semodule_expand/Makefile
index 072f2137..c2ab3f65 100644
--- a/semodule-utils/semodule_expand/Makefile
+++ b/semodule-utils/semodule_expand/Makefile
@@ -1,9 +1,7 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
-BINDIR ?= $(PREFIX)/bin
-LIBDIR ?= $(PREFIX)/lib
-MANDIR ?= $(PREFIX)/share/man
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 
 CFLAGS ?= -Werror -Wall -W
 override LDLIBS += -lsepol
diff --git a/semodule-utils/semodule_link/Makefile b/semodule-utils/semodule_link/Makefile
index cc4687bd..bcf98765 100644
--- a/semodule-utils/semodule_link/Makefile
+++ b/semodule-utils/semodule_link/Makefile
@@ -1,9 +1,7 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
-BINDIR ?= $(PREFIX)/bin
-MANDIR ?= $(PREFIX)/share/man
-LIBDIR ?= $(PREFIX)/lib
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 
 CFLAGS ?= -Werror -Wall -W
 override LDLIBS += -lsepol
diff --git a/semodule-utils/semodule_package/Makefile b/semodule-utils/semodule_package/Makefile
index 96dd7c4f..33a95e16 100644
--- a/semodule-utils/semodule_package/Makefile
+++ b/semodule-utils/semodule_package/Makefile
@@ -1,9 +1,7 @@
 # Installation directories.
-PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
-BINDIR ?= $(PREFIX)/bin
-LIBDIR ?= $(PREFIX)/lib
-MANDIR ?= $(PREFIX)/share/man
+PREFIX ?= /usr
+BINDIR ?= $(DESTDIR)$(PREFIX)/bin
+MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
 
 CFLAGS ?= -Werror -Wall -W
 override LDLIBS += -lsepol
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 13/14] dbus: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (11 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 12/14] semodule-utils: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  2018-01-21 21:46 ` [PATCH v3 14/14] build: add prefix for includes in top Makefile Marcus Folkesson
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 dbus/Makefile | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/dbus/Makefile b/dbus/Makefile
index 9a6cc90e..53143aff 100644
--- a/dbus/Makefile
+++ b/dbus/Makefile
@@ -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:
 
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 14/14] build: add prefix for includes in top Makefile
  2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
                   ` (12 preceding siblings ...)
  2018-01-21 21:46 ` [PATCH v3 13/14] dbus: " Marcus Folkesson
@ 2018-01-21 21:46 ` Marcus Folkesson
  13 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-21 21:46 UTC (permalink / raw)
  To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 6da7f7b7..6baea148 100644
--- a/Makefile
+++ b/Makefile
@@ -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,8 +20,8 @@ else
 endif
 
 ifneq ($(DESTDIR),)
-	CFLAGS += -I$(DESTDIR)/usr/include
-	LDFLAGS += -L$(DESTDIR)/usr/lib
+	CFLAGS += -I$(DESTDIR)$(PREFIX)/include
+	LDFLAGS += -L$(DESTDIR)$(PREFIX)/lib
 	export CFLAGS
 	export LDFLAGS
 endif
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 08/14] python: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-21 21:46 ` [PATCH v3 08/14] python: " Marcus Folkesson
@ 2018-01-23 10:24   ` Petr Lautrbach
  2018-01-23 19:22     ` Marcus Folkesson
  0 siblings, 1 reply; 17+ messages in thread
From: Petr Lautrbach @ 2018-01-23 10:24 UTC (permalink / raw)
  To: Marcus Folkesson; +Cc: selinux

[-- Attachment #1: Type: text/plain, Size: 5385 bytes --]

On Sun, Jan 21, 2018 at 10:46:11PM +0100, Marcus Folkesson wrote:
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
>  python/audit2allow/Makefile           | 17 ++++++++++-------
>  python/chcat/Makefile                 |  8 ++++----
>  python/semanage/Makefile              | 11 +++++------
>  python/sepolgen/src/sepolgen/Makefile |  3 ++-
>  python/sepolicy/Makefile              | 18 +++++++++---------
>  5 files changed, 30 insertions(+), 27 deletions(-)
> 
> diff --git a/python/audit2allow/Makefile b/python/audit2allow/Makefile
> index 8db8075f..d1d4ca8d 100644
> --- a/python/audit2allow/Makefile
> +++ b/python/audit2allow/Makefile
> @@ -1,19 +1,22 @@
>  PYTHON ?= python
>  
>  # Installation directories.
> -PREFIX ?= $(DESTDIR)/usr
> -BINDIR ?= $(PREFIX)/bin
> -LIBDIR ?= $(PREFIX)/lib
> -MANDIR ?= $(PREFIX)/share/man
> -LOCALEDIR ?= /usr/share/locale
> -INCLUDEDIR ?= $(PREFIX)/include
> -LIBSEPOLA ?= $(LIBDIR)/libsepol.a
> +PREFIX ?= /usr
> +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
> +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
>  
>  CFLAGS ?= -Werror -Wall -W
>  
> +# If no specific libsepol.a is specified, fall back on LDFLAGS search path
> +ifeq ($(LIBSEPOLA),)
> +       LDFLAGS += -l:libsepol.a
> +endif
> +
>  all: audit2why sepolgen-ifgen-attr-helper
>  
>  sepolgen-ifgen-attr-helper: sepolgen-ifgen-attr-helper.o $(LIBSEPOLA)
> +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
>  
>  audit2why:
>  	ln -sf audit2allow audit2why
> diff --git a/python/chcat/Makefile b/python/chcat/Makefile
> index 0fd12d6d..947734a0 100644
> --- a/python/chcat/Makefile
> +++ b/python/chcat/Makefile
> @@ -1,8 +1,8 @@
>  # Installation directories.
> -PREFIX ?= $(DESTDIR)/usr
> -BINDIR ?= $(PREFIX)/bin
> -MANDIR ?= $(PREFIX)/share/man
> -LOCALEDIR ?= $(PREFIX)/share/locale
> +PREFIX ?= /usr
> +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
> +LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
>  
>  .PHONY: all
>  all: chcat
> diff --git a/python/semanage/Makefile b/python/semanage/Makefile
> index 132162bc..0218222d 100644
> --- a/python/semanage/Makefile
> +++ b/python/semanage/Makefile
> @@ -1,13 +1,12 @@
>  PYTHON ?= python
>  
>  # Installation directories.
> -PREFIX ?= $(DESTDIR)/usr
> -LIBDIR ?= $(PREFIX)/lib
> -SBINDIR ?= $(PREFIX)/sbin
> -MANDIR = $(PREFIX)/share/man
> -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
> +PREFIX ?= /usr
> +SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
> +MANDIR = $(DESTDIR)$(PREFIX)/share/man
> +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))")

Note that this change move paths for modules from platform-specific to
platform-shared:

- /home/vagrant/build/usr/lib64/python3.6/site-packages/seobject.py
+ /home/vagrant/build/usr/lib/python3.6/site-packages/seobject.py

I think it's a good change given that there's only pure python
modules, but it would be good to document it in the commit message.


>  PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)
> -BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
> +BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
>  
>  TARGETS=semanage
>  
> diff --git a/python/sepolgen/src/sepolgen/Makefile b/python/sepolgen/src/sepolgen/Makefile
> index d3aa7715..2121a955 100644
> --- a/python/sepolgen/src/sepolgen/Makefile
> +++ b/python/sepolgen/src/sepolgen/Makefile
> @@ -1,5 +1,6 @@
> +PREFIX ?= /usr
>  PYTHON ?= python
> -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
> +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))")
>  PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/sepolgen
>  
>  all:
> diff --git a/python/sepolicy/Makefile b/python/sepolicy/Makefile
> index 5a56e6c8..1c02ee06 100644
> --- a/python/sepolicy/Makefile
> +++ b/python/sepolicy/Makefile
> @@ -1,14 +1,14 @@
>  PYTHON ?= python
>  
>  # Installation directories.
> -PREFIX ?= $(DESTDIR)/usr
> -LIBDIR ?= $(PREFIX)/lib
> -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
> +PREFIX ?= /usr
> +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
> +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> +DATADIR ?= $(DESTDIR)$(PREFIX)/share
> +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
> +LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
> +BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
> +SHAREDIR ?= $(DESTDIR)$(PREFIX)/share/sandbox
>  CFLAGS ?= -Wall -Werror -Wextra -W
>  override CFLAGS += -DPACKAGE="policycoreutils" -DSHARED -shared
>  
> @@ -30,7 +30,7 @@ test:
>  	@$(PYTHON) test_sepolicy.py -v
>  
>  install:
> -	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
> +	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
>  	[ -d $(BINDIR) ] || mkdir -p $(BINDIR)
>  	install -m 755 sepolicy.py $(BINDIR)/sepolicy
>  	(cd $(BINDIR); ln -sf sepolicy sepolgen)
> -- 
> 2.15.1
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 08/14] python: build: follow standard semantics for DESTDIR and PREFIX
  2018-01-23 10:24   ` Petr Lautrbach
@ 2018-01-23 19:22     ` Marcus Folkesson
  0 siblings, 0 replies; 17+ messages in thread
From: Marcus Folkesson @ 2018-01-23 19:22 UTC (permalink / raw)
  To: Petr Lautrbach; +Cc: selinux

[-- Attachment #1: Type: text/plain, Size: 5893 bytes --]

Hi Petr,

On Tue, Jan 23, 2018 at 11:24:47AM +0100, Petr Lautrbach wrote:
> On Sun, Jan 21, 2018 at 10:46:11PM +0100, Marcus Folkesson wrote:
> > Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> > ---
> >  python/audit2allow/Makefile           | 17 ++++++++++-------
> >  python/chcat/Makefile                 |  8 ++++----
> >  python/semanage/Makefile              | 11 +++++------
> >  python/sepolgen/src/sepolgen/Makefile |  3 ++-
> >  python/sepolicy/Makefile              | 18 +++++++++---------
> >  5 files changed, 30 insertions(+), 27 deletions(-)
> > 
> > diff --git a/python/audit2allow/Makefile b/python/audit2allow/Makefile
> > index 8db8075f..d1d4ca8d 100644
> > --- a/python/audit2allow/Makefile
> > +++ b/python/audit2allow/Makefile
> > @@ -1,19 +1,22 @@
> >  PYTHON ?= python
> >  
> >  # Installation directories.
> > -PREFIX ?= $(DESTDIR)/usr
> > -BINDIR ?= $(PREFIX)/bin
> > -LIBDIR ?= $(PREFIX)/lib
> > -MANDIR ?= $(PREFIX)/share/man
> > -LOCALEDIR ?= /usr/share/locale
> > -INCLUDEDIR ?= $(PREFIX)/include
> > -LIBSEPOLA ?= $(LIBDIR)/libsepol.a
> > +PREFIX ?= /usr
> > +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> > +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
> > +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
> >  
> >  CFLAGS ?= -Werror -Wall -W
> >  
> > +# If no specific libsepol.a is specified, fall back on LDFLAGS search path
> > +ifeq ($(LIBSEPOLA),)
> > +       LDFLAGS += -l:libsepol.a
> > +endif
> > +
> >  all: audit2why sepolgen-ifgen-attr-helper
> >  
> >  sepolgen-ifgen-attr-helper: sepolgen-ifgen-attr-helper.o $(LIBSEPOLA)
> > +	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
> >  
> >  audit2why:
> >  	ln -sf audit2allow audit2why
> > diff --git a/python/chcat/Makefile b/python/chcat/Makefile
> > index 0fd12d6d..947734a0 100644
> > --- a/python/chcat/Makefile
> > +++ b/python/chcat/Makefile
> > @@ -1,8 +1,8 @@
> >  # Installation directories.
> > -PREFIX ?= $(DESTDIR)/usr
> > -BINDIR ?= $(PREFIX)/bin
> > -MANDIR ?= $(PREFIX)/share/man
> > -LOCALEDIR ?= $(PREFIX)/share/locale
> > +PREFIX ?= /usr
> > +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> > +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
> > +LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
> >  
> >  .PHONY: all
> >  all: chcat
> > diff --git a/python/semanage/Makefile b/python/semanage/Makefile
> > index 132162bc..0218222d 100644
> > --- a/python/semanage/Makefile
> > +++ b/python/semanage/Makefile
> > @@ -1,13 +1,12 @@
> >  PYTHON ?= python
> >  
> >  # Installation directories.
> > -PREFIX ?= $(DESTDIR)/usr
> > -LIBDIR ?= $(PREFIX)/lib
> > -SBINDIR ?= $(PREFIX)/sbin
> > -MANDIR = $(PREFIX)/share/man
> > -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
> > +PREFIX ?= /usr
> > +SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
> > +MANDIR = $(DESTDIR)$(PREFIX)/share/man
> > +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))")
> 
> Note that this change move paths for modules from platform-specific to
> platform-shared:
> 
> - /home/vagrant/build/usr/lib64/python3.6/site-packages/seobject.py
> + /home/vagrant/build/usr/lib/python3.6/site-packages/seobject.py
> 
> I think it's a good change given that there's only pure python
> modules, but it would be good to document it in the commit message.
> 
> 

I will split up the logical changes and make it to a seperate commit in
v4.

Thanks you!

> >  PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)
> > -BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
> > +BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
> >  
> >  TARGETS=semanage
> >  
> > diff --git a/python/sepolgen/src/sepolgen/Makefile b/python/sepolgen/src/sepolgen/Makefile
> > index d3aa7715..2121a955 100644
> > --- a/python/sepolgen/src/sepolgen/Makefile
> > +++ b/python/sepolgen/src/sepolgen/Makefile
> > @@ -1,5 +1,6 @@
> > +PREFIX ?= /usr
> >  PYTHON ?= python
> > -PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
> > +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(prefix='$(PREFIX)'))")
> >  PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/sepolgen
> >  
> >  all:
> > diff --git a/python/sepolicy/Makefile b/python/sepolicy/Makefile
> > index 5a56e6c8..1c02ee06 100644
> > --- a/python/sepolicy/Makefile
> > +++ b/python/sepolicy/Makefile
> > @@ -1,14 +1,14 @@
> >  PYTHON ?= python
> >  
> >  # Installation directories.
> > -PREFIX ?= $(DESTDIR)/usr
> > -LIBDIR ?= $(PREFIX)/lib
> > -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
> > +PREFIX ?= /usr
> > +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
> > +BINDIR ?= $(DESTDIR)$(PREFIX)/bin
> > +DATADIR ?= $(DESTDIR)$(PREFIX)/share
> > +MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
> > +LOCALEDIR ?= $(DESTDIR)$(PREFIX)/share/locale
> > +BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions
> > +SHAREDIR ?= $(DESTDIR)$(PREFIX)/share/sandbox
> >  CFLAGS ?= -Wall -Werror -Wextra -W
> >  override CFLAGS += -DPACKAGE="policycoreutils" -DSHARED -shared
> >  
> > @@ -30,7 +30,7 @@ test:
> >  	@$(PYTHON) test_sepolicy.py -v
> >  
> >  install:
> > -	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
> > +	$(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
> >  	[ -d $(BINDIR) ] || mkdir -p $(BINDIR)
> >  	install -m 755 sepolicy.py $(BINDIR)/sepolicy
> >  	(cd $(BINDIR); ln -sf sepolicy sepolgen)
> > -- 
> > 2.15.1
> > 
> > 


Best regards
Marcus Folkesson



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-01-23 19:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-21 21:46 Rework of Makefiles v3 Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 01/14] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 02/14] libselinux: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 03/14] libsemanage: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 04/14] checkpolicy: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 05/14] gui: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 06/14] mcstrans: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 07/14] policycoreutils: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 08/14] python: " Marcus Folkesson
2018-01-23 10:24   ` Petr Lautrbach
2018-01-23 19:22     ` Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 09/14] restorecond: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 10/14] sandbox: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 11/14] secilc: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 12/14] semodule-utils: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 13/14] dbus: " Marcus Folkesson
2018-01-21 21:46 ` [PATCH v3 14/14] build: add prefix for includes in top Makefile Marcus Folkesson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.