Rework of Makefiles
Subsystems (2)
Hello,
I have updated the patchset.
We had a problem with overriding LIBDIR.
Please test to compile with:
make DESTDIR=/tmp/myroot PREFIX=/myusr install
or
make DESTDIR=/tmp/myroot install
Thanks to Nicolas and Petr for feedback.
Changes:
v4:
- top Makefile: add LIBDIR to LDFLAGS if DESTDIR is specified
- top Makefile: export LIBSEPOLA if DESTDIR is specified
- python: move platform from platform specific to platform shared installation directory
- Introduce LDLIBS_LIBSEPOLA if LIBSEPOLA is not defined.
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)
PATCH v4 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
--- 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(-)
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 +2 -2
@@ -1,6 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCDIR ?= $(PREFIX)/include/sepol +PREFIX ?= /usr +INCDIR = $(DESTDIR)$(PREFIX)/include/sepol CILDIR ?= ../cil all:
libsepol/man/Makefile +3 -2
@@ -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:
libsepol/src/Makefile +3 -4
@@ -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)
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 +2 -2
@@ -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
Signature · 1 line
2.15.1
Re: [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX
Quoted 86 lines · 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 standardSigned-off-by Marcus Folkesson <[email protected]>--- 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(-)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 +2
-2@@ -1,6 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCDIR ?= $(PREFIX)/include/sepol +PREFIX ?= /usr +INCDIR = $(DESTDIR)$(PREFIX)/include/sepol CILDIR ?= ../cil all:libsepol/man/Makefile +3
-2@@ -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:libsepol/src/Makefile +3
-4@@ -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)libsepol/src/libsepol.pc.in +0
-0
libsepol/src/libsepol.pc.in line 6
Quoted 7 lines
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
So this patch results in producing libsepol.pc with the value of $(DESTDIR) in libdir (because "s:@libdir@:$(LIBDIR):" in the sed command, and "LIBDIR ?= $(DESTDIR)$(PREFIX)/lib" in the Makefile). Is this intended? I supposed the point of these patches was to craft pkg-config files without references to $(DESTDIR), like the first version of this patch did. What did I miss?
Best,
Nicolas
Re: [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX
Quoted 94 lines · Nicolas Iooss
Quoted 92 lines · 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 standardSigned-off-by Marcus Folkesson <[email protected]>--- 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(-)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 +2
-2@@ -1,6 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCDIR ?= $(PREFIX)/include/sepol +PREFIX ?= /usr +INCDIR = $(DESTDIR)$(PREFIX)/include/sepol CILDIR ?= ../cil all:libsepol/man/Makefile +3
-2@@ -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:libsepol/src/Makefile +3
-4@@ -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)libsepol/src/libsepol.pc.in +1
-1@@ -1,6 +1,6 @@ prefix=@prefix@ exec_prefix=${prefix} -libdir=${exec_prefix}/@libdir@ +libdir=@libdir@ includedir=@includedir@
Quoted 9 lines
libsepol/src/libsepol.pc.in line 6
Quoted 1 line
libsepol/src/libsepol.pc.in +0
-0Name: libsepolSo this patch results in producing libsepol.pc with the value of $(DESTDIR) in libdir (because "s:@libdir@:$(LIBDIR):" in the sed command, and "LIBDIR ?= $(DESTDIR)$(PREFIX)/lib" in the
Makefile). Is this intended? I supposed the point of these patches was to craft pkg-config files without references to $(DESTDIR), like the first version of this patch did. What did I miss?
This is a regression between v2 and v3 I think.
Maybe we should remove DESTDIR from all variables and only use it in the install target.
e.g.
SHLIBDIR ?= /lib
...
install:
install -m 755 $(LIBSO) $(DESTDIR)$(SHLIBDIR)
Quoted 3 lines
Best,
Nicolas
PATCH v4 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
--- libselinux/include/Makefile | 4 ++-- libselinux/man/Makefile | 7 ++++--- libselinux/src/Makefile | 17 +++++++++++------ libselinux/src/libselinux.pc.in | 2 +- libselinux/utils/Makefile | 6 ++---- 5 files changed, 20 insertions(+), 16 deletions(-)
libselinux/include/Makefile +2 -2
@@ -1,6 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCDIR ?= $(PREFIX)/include/selinux +PREFIX ?= /usr +INCDIR = $(DESTDIR)$(PREFIX)/include/selinux all:
libselinux/man/Makefile +4 -3
@@ -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:
libselinux/src/Makefile +11 -6
@@ -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,13 @@ LIBSO=$(TARGET).$(LIBVERSION) AUDIT2WHYLOBJ=$(PYPREFIX)audit2why.lo AUDIT2WHYSO=$(PYPREFIX)audit2why.so +# 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 + GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) selinuxswig_python_exception.i SRCS= $(filter-out $(GENERATED) audit2why.c, $(sort $(wildcard *.c)))
@@ -148,7 +153,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)
@@ -157,7 +162,7 @@ $(AUDIT2WHYLOBJ): audit2why.c $(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $< $(AUDIT2WHYSO): $(AUDIT2WHYLOBJ) $(LIBSEPOLA) - $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(PYLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(LDLIBS_LIBSEPOLA) $(PYLIBS) %.o: %.c policy.h $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
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 +2 -4
@@ -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)
Signature · 1 line
2.15.1
PATCH v4 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
--- 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(-)
libsemanage/include/Makefile +2 -2
@@ -1,6 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -INCDIR ?= $(PREFIX)/include/semanage +PREFIX ?= /usr +INCDIR ?= $(DESTDIR)$(PREFIX)/include/semanage all:
libsemanage/man/Makefile +3 -2
@@ -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:
libsemanage/src/Makefile +3 -6
@@ -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)
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 +2 -2
@@ -1,6 +1,6 @@ # Installation directories. -PREFIX ?= $(DESTDIR)/usr -LIBEXECDIR ?= $(PREFIX)/libexec +PREFIX ?= /usr +LIBEXECDIR ?= $(DESTDIR)$(PREFIX)/libexec SELINUXEXECDIR ?= $(LIBEXECDIR)/selinux/ all:
Signature · 1 line
2.15.1
PATCH v4 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
--- checkpolicy/Makefile | 19 +++++++++++++------ checkpolicy/test/Makefile | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 11 deletions(-)
checkpolicy/Makefile +13 -6
@@ -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,13 @@ 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 +# 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 + override CFLAGS += -I. CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \
@@ -27,8 +32,10 @@ all: $(TARGETS) $(MAKE) -C test checkpolicy: $(CHECKPOLOBJS) $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA) checkmodule: $(CHECKMODOBJS) $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA) %.o: %.c $(CC) $(CFLAGS) -o $@ -c $<
checkpolicy/test/Makefile +12 -5
@@ -1,19 +1,26 @@ # # 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 +# 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) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) dismod: dismod.o $(LIBSEPOLA) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) clean: -rm -f dispol dismod *.o
Signature · 1 line
2.15.1
Re: [PATCH v4 04/15] checkpolicy: build: follow standard semantics for DESTDIR and PREFIX
Quoted 48 lines · 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 standardSigned-off-by Marcus Folkesson <[email protected]>--- checkpolicy/Makefile | 19 +++++++++++++------ checkpolicy/test/Makefile | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 11 deletions(-)checkpolicy/Makefile +11
-6@@ -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,13 @@ 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 +# 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 + override CFLAGS += -I. CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \
checkpolicy/Makefile all: $(TARGETS) · line 38
Quoted 7 lines
checkpolicy/Makefile +2
-0@@ -27,8 +32,10 @@ all: $(TARGETS) $(MAKE) -C test checkpolicy: $(CHECKPOLOBJS) $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA) checkmodule: $(CHECKMODOBJS) $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA)
Please do not introduce $(CFLAGS) in linking rules (if I remember correctly, clang reports warnings when using some compile-time-only options at link time, which breaks the build when using -Werror). The rules for checkpolicy and checkmodule should be:
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)
Quoted 25 lines
checkpolicy/Makefile +0
-0%.o: %.c $(CC) $(CFLAGS) -o $@ -c $<checkpolicy/test/Makefile +7
-5@@ -1,19 +1,26 @@ # # 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 +# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there +# is no need to define a value for LDLIBS_LIBSEPOLA +ifeq ($(LIBSEPOLA),)
checkpolicy/test/Makefile line 23
Quoted 10 lines
checkpolicy/test/Makefile +5
-0+ LDLIBS_LIBSEPOLA := -l:libsepol.a +endif + all: dispol dismod dispol: dispol.o $(LIBSEPOLA) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) dismod: dismod.o $(LIBSEPOLA) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)
Same comment here. Please remove $(CFLAGS).
Best regards,
Nicolas
Quoted 6 lines
checkpolicy/test/Makefile +0
-1clean: -rm -f dispol dismod *.o --2.15.1
Re: [PATCH v4 04/15] checkpolicy: build: follow standard semantics for DESTDIR and PREFIX
Quoted 39 lines · Nicolas Iooss
Quoted 37 lines · 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 standardSigned-off-by Marcus Folkesson <[email protected]>--- checkpolicy/Makefile | 19 +++++++++++++------ checkpolicy/test/Makefile | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 11 deletions(-)checkpolicy/Makefile +4
-6@@ -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,13 @@ YACC = bison -y CFLAGS ?= -g -Wall -Werror -Wshadow -O2 -pipe -fno-strict-aliasing
Quoted 8 lines
checkpolicy/Makefile YACC = bison -y · line 22
Quoted 8 lines
checkpolicy/Makefile +7
-0+# 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 + override CFLAGS += -I.
I will remove this override as well.
Quoted 8 lines
Quoted 8 lines
checkpolicy/Makefile +1
-0CHECKOBJS = y.tab.o lex.yy.o queue.o module_compiler.o parse_util.o \@@ -27,8 +32,10 @@ all: $(TARGETS) $(MAKE) -C test checkpolicy: $(CHECKPOLOBJS) $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA)
Quoted 8 lines
checkpolicy/Makefile all: $(TARGETS) · line 38
Quoted 2 lines
checkpolicy/Makefile +1
-0checkmodule: $(CHECKMODOBJS) $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS_LIBSEPOLA)Please do not introduce $(CFLAGS) in linking rules (if I remember correctly, clang reports warnings when using some compile-time-only options at link time, which breaks the build when using -Werror). The rules for checkpolicy and checkmodule should be:
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)
Will do, thanks
Quoted 31 lines
Quoted 31 lines
checkpolicy/Makefile +0
-0%.o: %.c $(CC) $(CFLAGS) -o $@ -c $<checkpolicy/test/Makefile +10
-5@@ -1,19 +1,26 @@ # # 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 +# 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
Quoted 7 lines
checkpolicy/test/Makefile line 23
Quoted 5 lines
checkpolicy/test/Makefile +2
-0dispol: dispol.o $(LIBSEPOLA) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) dismod: dismod.o $(LIBSEPOLA) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)Same comment here. Please remove $(CFLAGS).
Will do, thanks
Quoted 10 lines
Best regards,
NicolasQuoted 6 lines
checkpolicy/test/Makefile +0
-1clean: -rm -f dispol dismod *.o --2.15.1
Best regards
Marcus
PATCH v4 5/15 gui: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- gui/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
gui/Makefile +5 -5
@@ -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 \
Signature · 1 line
2.15.1
PATCH v4 6/15 mcstrans: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- mcstrans/man/Makefile | 3 ++- mcstrans/src/Makefile | 18 ++++++++++++------ mcstrans/utils/Makefile | 22 ++++++++++++++++------ 3 files changed, 30 insertions(+), 13 deletions(-)
mcstrans/man/Makefile +2 -1
@@ -1,5 +1,6 @@ # Installation directories. -MAN8DIR ?= $(DESTDIR)/usr/share/man/man8 +PREFIX ?= /usr +MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8 all:
mcstrans/src/Makefile +12 -6
@@ -1,10 +1,16 @@ # 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 +# 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))
@@ -15,8 +21,8 @@ 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 $@ $<
mcstrans/utils/Makefile +16 -6
@@ -1,18 +1,28 @@ # 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 +# 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) $(CFLAGS) -o $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA) + +untranscon: untranscon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA) install: all -mkdir -p $(SBINDIR)
Signature · 1 line
2.15.1
Re: [PATCH v4 06/15] mcstrans: build: follow standard semantics for DESTDIR and PREFIX
Quoted 81 lines · Marcus Folkesson
Signed-off-by Marcus Folkesson <[email protected]>--- mcstrans/man/Makefile | 3 ++- mcstrans/src/Makefile | 18 ++++++++++++------ mcstrans/utils/Makefile | 22 ++++++++++++++++------ 3 files changed, 30 insertions(+), 13 deletions(-)mcstrans/man/Makefile +2
-1@@ -1,5 +1,6 @@ # Installation directories. -MAN8DIR ?= $(DESTDIR)/usr/share/man/man8 +PREFIX ?= /usr +MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8 all:mcstrans/src/Makefile +12
-6@@ -1,10 +1,16 @@ # 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 +# 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))@@ -15,8 +21,8 @@ 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 $@ $<mcstrans/utils/Makefile +10
-5@@ -1,18 +1,28 @@ # 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 +# 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
mcstrans/utils/Makefile line 25
Quoted 10 lines
mcstrans/utils/Makefile +6
-1+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 $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA) + +untranscon: untranscon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA)
These new rules for transcon and untranscon use CFLAGS instead of LDFLAGS, which breaks building with a defined DESTDIR, as the linker fails to find libselinux.so (option -L$(LIBDIR) is then missing).
Moreover, the Makefile in mcstrans/utils actually uses the implicit rule of linking a program [1]: $(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS). This is why there is "override LDLIBS += -lselinux -lpcre" beforehand in the file. Now that the linking rules are made explicit (which I like better, IMHO), this now-useless statement could be removed.
Best,
Nicolas
[1] Part "Linking a single object file" of Make documentation:
https://www.gnu.org/software/make/manual/make.html#Catalogue-of-Rules
Re: [PATCH v4 06/15] mcstrans: build: follow standard semantics for DESTDIR and PREFIX
Quoted 87 lines · Nicolas Iooss
Quoted 85 lines · Marcus Folkesson
Signed-off-by Marcus Folkesson <[email protected]>--- mcstrans/man/Makefile | 3 ++- mcstrans/src/Makefile | 18 ++++++++++++------ mcstrans/utils/Makefile | 22 ++++++++++++++++------ 3 files changed, 30 insertions(+), 13 deletions(-)mcstrans/man/Makefile +2
-1@@ -1,5 +1,6 @@ # Installation directories. -MAN8DIR ?= $(DESTDIR)/usr/share/man/man8 +PREFIX ?= /usr +MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8 all:mcstrans/src/Makefile +12
-6@@ -1,10 +1,16 @@ # 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 +# 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))@@ -15,8 +21,8 @@ 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 $@ $<mcstrans/utils/Makefile +11
-5@@ -1,18 +1,28 @@ # 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 +# 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)
Quoted 10 lines
mcstrans/utils/Makefile line 25
Quoted 6 lines
mcstrans/utils/Makefile +5
-1-$(TARGETS): ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) +transcon: transcon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA) + +untranscon: untranscon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA) + $(CC) $(CFLAGS) -o $@ $^ -lpcre -lselinux $(LDLIBS_LIBSEPOLA)These new rules for transcon and untranscon use CFLAGS instead of LDFLAGS, which breaks building with a defined DESTDIR, as the linker fails to find libselinux.so (option -L$(LIBDIR) is then missing).
Will change to LDFLAGS.
Quoted 7 lines
Moreover, the
Makefilein mcstrans/utils actually uses the implicit rule of linking a program [1]: $(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS). This is why there is "override LDLIBS += -lselinux -lpcre" beforehand in the file. Now that the linking rules are made explicit (which I like better, IMHO), this now-useless statement could be removed.
I will remove the overriding
Quoted 6 lines
Best,
Nicolas[1] Part "Linking a single object file" of Make documentation:
https://www.gnu.org/software/make/manual/make.html#Catalogue-of-Rules
Thanks,
Marcus
PATCH v4 7/15 policycoreutils: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- 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(-)
policycoreutils/hll/pp/Makefile +2 -5
@@ -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
policycoreutils/load_policy/Makefile +4 -4
@@ -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\""
policycoreutils/man/Makefile +2 -1
@@ -1,5 +1,6 @@ # Installation directories. -MAN5DIR ?= $(DESTDIR)/usr/share/man/man5 +PREFIX ?= /usr +MAN5DIR ?= $(DESTDIR)$(PREFIX)/share/man/man5 all:
policycoreutils/newrole/Makefile +4 -4
@@ -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.
policycoreutils/po/Makefile +2 -1
@@ -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
policycoreutils/run_init/Makefile +4 -4
@@ -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)
policycoreutils/scripts/Makefile +4 -4
@@ -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
policycoreutils/secon/Makefile +4 -5
@@ -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)
policycoreutils/semodule/Makefile +3 -5
@@ -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
policycoreutils/sestatus/Makefile +4 -4
@@ -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
policycoreutils/setfiles/Makefile +2 -3
@@ -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 }')
policycoreutils/setsebool/Makefile +4 -6
@@ -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
Signature · 1 line
2.15.1
PATCH v4 8/15 python: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- python/audit2allow/Makefile | 19 ++++++++++++------- python/chcat/Makefile | 8 ++++---- python/semanage/Makefile | 11 +++++------ python/sepolgen/src/sepolgen/Makefile | 3 ++- python/sepolicy/Makefile | 18 +++++++++--------- 5 files changed, 32 insertions(+), 27 deletions(-)
python/audit2allow/Makefile +12 -7
@@ -1,19 +1,24 @@ 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 +# 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) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA) audit2why: ln -sf audit2allow audit2why
python/chcat/Makefile +4 -4
@@ -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
python/semanage/Makefile +5 -6
@@ -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(plat_specific=1, prefix='$(PREFIX)'))") PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR) -BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions +BASHCOMPLETIONDIR ?= $(DESTDIR)$(PREFIX)/share/bash-completion/completions TARGETS=semanage
python/sepolgen/src/sepolgen/Makefile +2 -1
@@ -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(plat_specific=1, prefix='$(PREFIX)'))") PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)/sepolgen all:
python/sepolicy/Makefile +9 -9
@@ -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)
Signature · 1 line
2.15.1
Re: [PATCH v4 08/15] python: build: follow standard semantics for DESTDIR and PREFIX
Quoted 32 lines · Marcus Folkesson
Signed-off-by Marcus Folkesson <[email protected]>--- python/audit2allow/Makefile | 19 ++++++++++++------- python/chcat/Makefile | 8 ++++---- python/semanage/Makefile | 11 +++++------ python/sepolgen/src/sepolgen/Makefile | 3 ++- python/sepolicy/Makefile | 18 +++++++++--------- 5 files changed, 32 insertions(+), 27 deletions(-)python/audit2allow/Makefile +5
-7@@ -1,19 +1,24 @@ 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
python/audit2allow/Makefile line 21
Quoted 10 lines
python/audit2allow/Makefile +7
-0+# 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) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS_LIBSEPOLA)
Please remove $(CFLAGS) here, as it is not needed when linking object files.
Quoted 2 lines
...
PATCH v4 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 ?= $(DESTDIR)$(PREFIX)/sbin MANDIR = $(DESTDIR)$(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 ?= $(DESTDIR)/$(PYTHONLIBDIR) BASHCOMPLETIONDIR ?= $(DESTDIR)$(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 ?= $(DESTDIR)/$(PYTHONLIBDIR)/sepolgen all:
Signature · 1 line
2.15.1
PATCH v4 10/15 restorecond: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- restorecond/Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
restorecond/Makefile +5 -6
@@ -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
Signature · 1 line
2.15.1
PATCH v4 11/15 sandbox: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- sandbox/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sandbox/Makefile +6 -6
@@ -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
Signature · 1 line
2.15.1
PATCH v4 12/15 secilc: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- secilc/Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
secilc/Makefile +3 -5
@@ -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
Signature · 1 line
2.15.1
PATCH v4 13/15 semodule-utils: build: follow standard semantics for DESTDIR and PREFIX
In reply to Marcus Folkesson--- 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(-)
semodule-utils/semodule_expand/Makefile +3 -5
@@ -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
semodule-utils/semodule_link/Makefile +3 -5
@@ -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
semodule-utils/semodule_package/Makefile +3 -5
@@ -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
Signature · 1 line
2.15.1
PATCH v4 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 v4 15/15 build: setup buildpaths if DESTDIR is specified
In reply to Marcus Folkesson--- 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