* [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 21:29 ` Nicolas Iooss
2018-01-24 9:27 ` [PATCH v4 02/15] libselinux: " Marcus Folkesson
` (13 subsequent siblings)
14 siblings, 1 reply; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* Re: [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 ` [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
@ 2018-01-24 21:29 ` Nicolas Iooss
2018-01-31 11:40 ` Marcus Folkesson
0 siblings, 1 reply; 23+ messages in thread
From: Nicolas Iooss @ 2018-01-24 21:29 UTC (permalink / raw)
To: Marcus Folkesson; +Cc: selinux, Stephen Smalley
On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
<marcus.folkesson@gmail.com> wrote:
> 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
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
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 21:29 ` Nicolas Iooss
@ 2018-01-31 11:40 ` Marcus Folkesson
0 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-31 11:40 UTC (permalink / raw)
To: Nicolas Iooss; +Cc: selinux, Stephen Smalley
[-- Attachment #1: Type: text/plain, Size: 4356 bytes --]
On Wed, Jan 24, 2018 at 10:29:07PM +0100, Nicolas Iooss wrote:
> On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
> <marcus.folkesson@gmail.com> wrote:
> > 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
>
> 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?
>
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)
> Best,
> Nicolas
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v4 02/15] libselinux: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 03/15] libsemanage: " Marcus Folkesson
` (12 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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 | 17 +++++++++++------
libselinux/src/libselinux.pc.in | 2 +-
libselinux/utils/Makefile | 6 ++----
5 files changed, 20 insertions(+), 16 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..bd9980db 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,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 $@ $<
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] 23+ messages in thread* [PATCH v4 03/15] libsemanage: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 01/15] libsepol: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 02/15] libselinux: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 04/15] checkpolicy: " Marcus Folkesson
` (11 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 04/15] checkpolicy: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (2 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 03/15] libsemanage: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 22:04 ` Nicolas Iooss
2018-01-24 9:27 ` [PATCH v4 05/15] gui: " Marcus Folkesson
` (10 subsequent siblings)
14 siblings, 1 reply; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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 | 17 ++++++++++++-----
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/checkpolicy/Makefile b/checkpolicy/Makefile
index 68e11f2a..9a55b968 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,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 $<
diff --git a/checkpolicy/test/Makefile b/checkpolicy/test/Makefile
index 59fa4460..094e7ee2 100644
--- a/checkpolicy/test/Makefile
+++ b/checkpolicy/test/Makefile
@@ -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
--
2.15.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH v4 04/15] checkpolicy: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 ` [PATCH v4 04/15] checkpolicy: " Marcus Folkesson
@ 2018-01-24 22:04 ` Nicolas Iooss
2018-01-31 11:58 ` Marcus Folkesson
0 siblings, 1 reply; 23+ messages in thread
From: Nicolas Iooss @ 2018-01-24 22:04 UTC (permalink / raw)
To: Marcus Folkesson; +Cc: selinux, Stephen Smalley
On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
<marcus.folkesson@gmail.com> wrote:
> 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 | 17 ++++++++++++-----
> 2 files changed, 25 insertions(+), 11 deletions(-)
>
> diff --git a/checkpolicy/Makefile b/checkpolicy/Makefile
> index 68e11f2a..9a55b968 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,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)
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)
> %.o: %.c
> $(CC) $(CFLAGS) -o $@ -c $<
> diff --git a/checkpolicy/test/Makefile b/checkpolicy/test/Makefile
> index 59fa4460..094e7ee2 100644
> --- a/checkpolicy/test/Makefile
> +++ b/checkpolicy/test/Makefile
> @@ -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)
Same comment here. Please remove $(CFLAGS).
Best regards,
Nicolas
>
> clean:
> -rm -f dispol dismod *.o
> --
> 2.15.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 04/15] checkpolicy: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 22:04 ` Nicolas Iooss
@ 2018-01-31 11:58 ` Marcus Folkesson
0 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-31 11:58 UTC (permalink / raw)
To: Nicolas Iooss; +Cc: selinux, Stephen Smalley
[-- Attachment #1: Type: text/plain, Size: 4026 bytes --]
On Wed, Jan 24, 2018 at 11:04:10PM +0100, Nicolas Iooss wrote:
> On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
> <marcus.folkesson@gmail.com> wrote:
> > 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 | 17 ++++++++++++-----
> > 2 files changed, 25 insertions(+), 11 deletions(-)
> >
> > diff --git a/checkpolicy/Makefile b/checkpolicy/Makefile
> > index 68e11f2a..9a55b968 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,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.
I will remove this override as well.
> >
> > 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)
>
> 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
>
> > %.o: %.c
> > $(CC) $(CFLAGS) -o $@ -c $<
> > diff --git a/checkpolicy/test/Makefile b/checkpolicy/test/Makefile
> > index 59fa4460..094e7ee2 100644
> > --- a/checkpolicy/test/Makefile
> > +++ b/checkpolicy/test/Makefile
> > @@ -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)
>
> Same comment here. Please remove $(CFLAGS).
Will do, thanks
>
> Best regards,
> Nicolas
>
> >
> > clean:
> > -rm -f dispol dismod *.o
> > --
> > 2.15.1
> >
Best regards
Marcus
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v4 05/15] gui: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (3 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 04/15] checkpolicy: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 06/15] mcstrans: " Marcus Folkesson
` (9 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 06/15] mcstrans: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (4 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 05/15] gui: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 21:48 ` Nicolas Iooss
2018-01-24 9:27 ` [PATCH v4 07/15] policycoreutils: " Marcus Folkesson
` (8 subsequent siblings)
14 siblings, 1 reply; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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 | 22 ++++++++++++++++------
3 files changed, 30 insertions(+), 13 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..8a8743f1 100644
--- a/mcstrans/src/Makefile
+++ b/mcstrans/src/Makefile
@@ -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 $@ $<
diff --git a/mcstrans/utils/Makefile b/mcstrans/utils/Makefile
index 4d3cbfcb..9d740617 100644
--- a/mcstrans/utils/Makefile
+++ b/mcstrans/utils/Makefile
@@ -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)
--
2.15.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH v4 06/15] mcstrans: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 ` [PATCH v4 06/15] mcstrans: " Marcus Folkesson
@ 2018-01-24 21:48 ` Nicolas Iooss
2018-01-31 11:43 ` Marcus Folkesson
0 siblings, 1 reply; 23+ messages in thread
From: Nicolas Iooss @ 2018-01-24 21:48 UTC (permalink / raw)
To: Marcus Folkesson; +Cc: selinux, Stephen Smalley
On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
<marcus.folkesson@gmail.com> wrote:
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
> mcstrans/man/Makefile | 3 ++-
> mcstrans/src/Makefile | 18 ++++++++++++------
> mcstrans/utils/Makefile | 22 ++++++++++++++++------
> 3 files changed, 30 insertions(+), 13 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..8a8743f1 100644
> --- a/mcstrans/src/Makefile
> +++ b/mcstrans/src/Makefile
> @@ -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 $@ $<
> diff --git a/mcstrans/utils/Makefile b/mcstrans/utils/Makefile
> index 4d3cbfcb..9d740617 100644
> --- a/mcstrans/utils/Makefile
> +++ b/mcstrans/utils/Makefile
> @@ -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)
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v4 06/15] mcstrans: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 21:48 ` Nicolas Iooss
@ 2018-01-31 11:43 ` Marcus Folkesson
0 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-31 11:43 UTC (permalink / raw)
To: Nicolas Iooss; +Cc: selinux, Stephen Smalley
[-- Attachment #1: Type: text/plain, Size: 4448 bytes --]
On Wed, Jan 24, 2018 at 10:48:29PM +0100, Nicolas Iooss wrote:
> On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
> <marcus.folkesson@gmail.com> wrote:
> > Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> > ---
> > mcstrans/man/Makefile | 3 ++-
> > mcstrans/src/Makefile | 18 ++++++++++++------
> > mcstrans/utils/Makefile | 22 ++++++++++++++++------
> > 3 files changed, 30 insertions(+), 13 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..8a8743f1 100644
> > --- a/mcstrans/src/Makefile
> > +++ b/mcstrans/src/Makefile
> > @@ -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 $@ $<
> > diff --git a/mcstrans/utils/Makefile b/mcstrans/utils/Makefile
> > index 4d3cbfcb..9d740617 100644
> > --- a/mcstrans/utils/Makefile
> > +++ b/mcstrans/utils/Makefile
> > @@ -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)
>
> 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.
>
> 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.
I will remove the overriding
>
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v4 07/15] policycoreutils: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (5 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 06/15] mcstrans: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 08/15] python: " Marcus Folkesson
` (7 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 08/15] python: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (6 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 07/15] policycoreutils: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 22:06 ` Nicolas Iooss
2018-01-24 9:27 ` [PATCH v4 09/15] python: build: move modules from platform-specific to platform-shared Marcus Folkesson
` (6 subsequent siblings)
14 siblings, 1 reply; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 UTC (permalink / raw)
To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
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(-)
diff --git a/python/audit2allow/Makefile b/python/audit2allow/Makefile
index 8db8075f..7463ed85 100644
--- a/python/audit2allow/Makefile
+++ b/python/audit2allow/Makefile
@@ -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
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..3e48b673 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(plat_specific=1, 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..84548e98 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(plat_specific=1, 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] 23+ messages in thread* Re: [PATCH v4 08/15] python: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 ` [PATCH v4 08/15] python: " Marcus Folkesson
@ 2018-01-24 22:06 ` Nicolas Iooss
0 siblings, 0 replies; 23+ messages in thread
From: Nicolas Iooss @ 2018-01-24 22:06 UTC (permalink / raw)
To: Marcus Folkesson; +Cc: selinux, Stephen Smalley
On Wed, Jan 24, 2018 at 10:27 AM, Marcus Folkesson
<marcus.folkesson@gmail.com> wrote:
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
> ---
> 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(-)
>
> diff --git a/python/audit2allow/Makefile b/python/audit2allow/Makefile
> index 8db8075f..7463ed85 100644
> --- a/python/audit2allow/Makefile
> +++ b/python/audit2allow/Makefile
> @@ -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)
Please remove $(CFLAGS) here, as it is not needed when linking object files.
>
> ...
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v4 09/15] python: build: move modules from platform-specific to platform-shared
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (7 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 08/15] python: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 10/15] restorecond: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
` (5 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 UTC (permalink / raw)
To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
python/semanage/Makefile | 2 +-
python/sepolgen/src/sepolgen/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/semanage/Makefile b/python/semanage/Makefile
index 3e48b673..0218222d 100644
--- a/python/semanage/Makefile
+++ b/python/semanage/Makefile
@@ -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
diff --git a/python/sepolgen/src/sepolgen/Makefile b/python/sepolgen/src/sepolgen/Makefile
index 84548e98..2121a955 100644
--- a/python/sepolgen/src/sepolgen/Makefile
+++ b/python/sepolgen/src/sepolgen/Makefile
@@ -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:
--
2.15.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH v4 10/15] restorecond: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (8 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 09/15] python: build: move modules from platform-specific to platform-shared Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 11/15] sandbox: " Marcus Folkesson
` (4 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 11/15] sandbox: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (9 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 10/15] restorecond: build: follow standard semantics for DESTDIR and PREFIX Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 12/15] secilc: " Marcus Folkesson
` (3 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 12/15] secilc: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (10 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 11/15] sandbox: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 13/15] semodule-utils: " Marcus Folkesson
` (2 subsequent siblings)
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 13/15] semodule-utils: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (11 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 12/15] secilc: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 14/15] dbus: " Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 15/15] build: setup buildpaths if DESTDIR is specified Marcus Folkesson
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 14/15] dbus: build: follow standard semantics for DESTDIR and PREFIX
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (12 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 13/15] semodule-utils: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
2018-01-24 9:27 ` [PATCH v4 15/15] build: setup buildpaths if DESTDIR is specified Marcus Folkesson
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 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] 23+ messages in thread* [PATCH v4 15/15] build: setup buildpaths if DESTDIR is specified
2018-01-24 9:27 Rework of Makefiles Marcus Folkesson
` (13 preceding siblings ...)
2018-01-24 9:27 ` [PATCH v4 14/15] dbus: " Marcus Folkesson
@ 2018-01-24 9:27 ` Marcus Folkesson
14 siblings, 0 replies; 23+ messages in thread
From: Marcus Folkesson @ 2018-01-24 9:27 UTC (permalink / raw)
To: selinux, nicolas.iooss, sds; +Cc: Marcus Folkesson
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
Makefile | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 6da7f7b7..c238dbc8 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,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:
--
2.15.1
^ permalink raw reply related [flat|nested] 23+ messages in thread