* [PATCH] libselinux: introduce PCPREFIX substitute variables for .pc files
@ 2018-01-03 16:29 Marcus Folkesson
2018-01-03 21:13 ` [PATCH v2] libselinux: introduce PCPREFIX substitute variable " Marcus Folkesson
0 siblings, 1 reply; 4+ messages in thread
From: Marcus Folkesson @ 2018-01-03 16:29 UTC (permalink / raw)
To: selinux; +Cc: Marcus Folkesson
Some environments (e.g. Buildroot [1] ) when using specified sysroot does
not expect `prefix` (or `exec_prefix`) to be an absolute paths including
sysroot directory.
`includedir` may be overridden by `INCLUDEDIR` but `libdir` is using
`PREFIX` that is used in other places than .pc-files.
Therefor, introduce PCPREFIX to make it possible to generate a more
customized .pc file.
[1] https://buildroot.org/
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
libselinux/src/Makefile | 5 +++--
libsemanage/src/Makefile | 5 +++--
libsepol/src/Makefile | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 18df75c8..baa2ba0f 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -9,9 +9,10 @@ PKG_CONFIG ?= pkg-config
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
+PCPREFIX ?= $(PREFIX)
LIBDIR ?= $(PREFIX)/lib
SHLIBDIR ?= $(DESTDIR)/lib
-INCLUDEDIR ?= $(PREFIX)/include
+INCLUDEDIR ?= $(PCPREFIX)/include
PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
@@ -148,7 +149,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):; s:@PCRE_MODULE@:$(PCRE_MODULE):' < $< > $@
selinuxswig_python_exception.i: ../include/selinux/selinux.h
bash -e exception.sh > $@ || (rm -f $@ ; false)
diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
index fdb178f5..8fe2f6dd 100644
--- a/libsemanage/src/Makefile
+++ b/libsemanage/src/Makefile
@@ -9,9 +9,10 @@ PKG_CONFIG ?= pkg-config
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
+PCPREFIX ?= $(PREFIX)
LIBDIR ?= $(PREFIX)/lib
SHLIBDIR ?= $(DESTDIR)/lib
-INCLUDEDIR ?= $(PREFIX)/include
+INCLUDEDIR ?= $(PCPREFIX)/include
PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
@@ -95,7 +96,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
semanageswig_python_exception.i: ../include/semanage/semanage.h
bash -e exception.sh > $@ || (rm -f $@ ; false)
diff --git a/libsepol/src/Makefile b/libsepol/src/Makefile
index 819d261b..59c287aa 100644
--- a/libsepol/src/Makefile
+++ b/libsepol/src/Makefile
@@ -1,6 +1,7 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
+PCPREFIX ?= $(PREFIX)
+INCLUDEDIR ?= $(PCPREFIX)/include
LIBDIR ?= $(PREFIX)/lib
SHLIBDIR ?= $(DESTDIR)/lib
RANLIB ?= ranlib
@@ -52,7 +53,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
$(LIBMAP): $(LIBMAP).in
ifneq ($(DISABLE_CIL),y)
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] libselinux: introduce PCPREFIX substitute variable for .pc files
2018-01-03 16:29 [PATCH] libselinux: introduce PCPREFIX substitute variables for .pc files Marcus Folkesson
@ 2018-01-03 21:13 ` Marcus Folkesson
2018-01-07 20:38 ` Nicolas Iooss
0 siblings, 1 reply; 4+ messages in thread
From: Marcus Folkesson @ 2018-01-03 21:13 UTC (permalink / raw)
To: selinux; +Cc: Marcus Folkesson
`prefix` in the .pc file may be messed up when using a buildsystem
that has specified a sysroot as DESTDIR.
We need to make it possible to override the default `libdir`
and `includedir`.
`includedir` may be overridden by `INCLUDEDIR` but `libdir` is using
`PREFIX` to setup the path.
Therefore, introduce PCPREFIX to make it possible to generate a more
customized .pc file.
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
---
v2:
- Reword commit message to be easier to understand...
libselinux/src/Makefile | 5 +++--
libsemanage/src/Makefile | 5 +++--
libsepol/src/Makefile | 5 +++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 18df75c8..baa2ba0f 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -9,9 +9,10 @@ PKG_CONFIG ?= pkg-config
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
+PCPREFIX ?= $(PREFIX)
LIBDIR ?= $(PREFIX)/lib
SHLIBDIR ?= $(DESTDIR)/lib
-INCLUDEDIR ?= $(PREFIX)/include
+INCLUDEDIR ?= $(PCPREFIX)/include
PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
@@ -148,7 +149,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):; s:@PCRE_MODULE@:$(PCRE_MODULE):' < $< > $@
selinuxswig_python_exception.i: ../include/selinux/selinux.h
bash -e exception.sh > $@ || (rm -f $@ ; false)
diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
index fdb178f5..8fe2f6dd 100644
--- a/libsemanage/src/Makefile
+++ b/libsemanage/src/Makefile
@@ -9,9 +9,10 @@ PKG_CONFIG ?= pkg-config
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
+PCPREFIX ?= $(PREFIX)
LIBDIR ?= $(PREFIX)/lib
SHLIBDIR ?= $(DESTDIR)/lib
-INCLUDEDIR ?= $(PREFIX)/include
+INCLUDEDIR ?= $(PCPREFIX)/include
PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
@@ -95,7 +96,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
semanageswig_python_exception.i: ../include/semanage/semanage.h
bash -e exception.sh > $@ || (rm -f $@ ; false)
diff --git a/libsepol/src/Makefile b/libsepol/src/Makefile
index 819d261b..59c287aa 100644
--- a/libsepol/src/Makefile
+++ b/libsepol/src/Makefile
@@ -1,6 +1,7 @@
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
-INCLUDEDIR ?= $(PREFIX)/include
+PCPREFIX ?= $(PREFIX)
+INCLUDEDIR ?= $(PCPREFIX)/include
LIBDIR ?= $(PREFIX)/lib
SHLIBDIR ?= $(DESTDIR)/lib
RANLIB ?= ranlib
@@ -52,7 +53,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
$(LIBMAP): $(LIBMAP).in
ifneq ($(DISABLE_CIL),y)
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] libselinux: introduce PCPREFIX substitute variable for .pc files
2018-01-03 21:13 ` [PATCH v2] libselinux: introduce PCPREFIX substitute variable " Marcus Folkesson
@ 2018-01-07 20:38 ` Nicolas Iooss
2018-01-07 20:49 ` Marcus Folkesson
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Iooss @ 2018-01-07 20:38 UTC (permalink / raw)
To: Marcus Folkesson; +Cc: selinux
On Wed, Jan 3, 2018 at 10:13 PM, Marcus Folkesson
<marcus.folkesson@gmail.com> wrote:
> `prefix` in the .pc file may be messed up when using a buildsystem
> that has specified a sysroot as DESTDIR.
> We need to make it possible to override the default `libdir`
> and `includedir`.
>
> `includedir` may be overridden by `INCLUDEDIR` but `libdir` is using
> `PREFIX` to setup the path.
>
> Therefore, introduce PCPREFIX to make it possible to generate a more
> customized .pc file.
>
> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Looks good to me. This patch does not seem to break the existing usage
and adds more flexibility for packagers. By the way, I was worried by
the modification on INCLUDEDIR, but as this variable is only used to
generate pkg-config files, it is reasonable to use PCPREFIX instead of
PREFIX in its definition.
Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
> ---
>
> v2:
> - Reword commit message to be easier to understand...
>
> libselinux/src/Makefile | 5 +++--
> libsemanage/src/Makefile | 5 +++--
> libsepol/src/Makefile | 5 +++--
> 3 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 18df75c8..baa2ba0f 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -9,9 +9,10 @@ PKG_CONFIG ?= pkg-config
>
> # Installation directories.
> PREFIX ?= $(DESTDIR)/usr
> +PCPREFIX ?= $(PREFIX)
> LIBDIR ?= $(PREFIX)/lib
> SHLIBDIR ?= $(DESTDIR)/lib
> -INCLUDEDIR ?= $(PREFIX)/include
> +INCLUDEDIR ?= $(PCPREFIX)/include
> PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
> PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
> PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
> @@ -148,7 +149,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):; s:@PCRE_MODULE@:$(PCRE_MODULE):' < $< > $@
>
> selinuxswig_python_exception.i: ../include/selinux/selinux.h
> bash -e exception.sh > $@ || (rm -f $@ ; false)
> diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
> index fdb178f5..8fe2f6dd 100644
> --- a/libsemanage/src/Makefile
> +++ b/libsemanage/src/Makefile
> @@ -9,9 +9,10 @@ PKG_CONFIG ?= pkg-config
>
> # Installation directories.
> PREFIX ?= $(DESTDIR)/usr
> +PCPREFIX ?= $(PREFIX)
> LIBDIR ?= $(PREFIX)/lib
> SHLIBDIR ?= $(DESTDIR)/lib
> -INCLUDEDIR ?= $(PREFIX)/include
> +INCLUDEDIR ?= $(PCPREFIX)/include
> PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
> PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX))
> PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
> @@ -95,7 +96,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
>
> semanageswig_python_exception.i: ../include/semanage/semanage.h
> bash -e exception.sh > $@ || (rm -f $@ ; false)
> diff --git a/libsepol/src/Makefile b/libsepol/src/Makefile
> index 819d261b..59c287aa 100644
> --- a/libsepol/src/Makefile
> +++ b/libsepol/src/Makefile
> @@ -1,6 +1,7 @@
> # Installation directories.
> PREFIX ?= $(DESTDIR)/usr
> -INCLUDEDIR ?= $(PREFIX)/include
> +PCPREFIX ?= $(PREFIX)
> +INCLUDEDIR ?= $(PCPREFIX)/include
> LIBDIR ?= $(PREFIX)/lib
> SHLIBDIR ?= $(DESTDIR)/lib
> RANLIB ?= ranlib
> @@ -52,7 +53,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@:$(PCPREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
>
> $(LIBMAP): $(LIBMAP).in
> ifneq ($(DISABLE_CIL),y)
> --
> 2.15.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] libselinux: introduce PCPREFIX substitute variable for .pc files
2018-01-07 20:38 ` Nicolas Iooss
@ 2018-01-07 20:49 ` Marcus Folkesson
0 siblings, 0 replies; 4+ messages in thread
From: Marcus Folkesson @ 2018-01-07 20:49 UTC (permalink / raw)
To: Nicolas Iooss; +Cc: selinux
Hi,
On Sun, Jan 07, 2018 at 09:38:58PM +0100, Nicolas Iooss wrote:
> On Wed, Jan 3, 2018 at 10:13 PM, Marcus Folkesson
> <marcus.folkesson@gmail.com> wrote:
> > `prefix` in the .pc file may be messed up when using a buildsystem
> > that has specified a sysroot as DESTDIR.
> > We need to make it possible to override the default `libdir`
> > and `includedir`.
> >
> > `includedir` may be overridden by `INCLUDEDIR` but `libdir` is using
> > `PREFIX` to setup the path.
> >
> > Therefore, introduce PCPREFIX to make it possible to generate a more
> > customized .pc file.
> >
> > Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
>
> Looks good to me. This patch does not seem to break the existing usage
> and adds more flexibility for packagers. By the way, I was worried by
> the modification on INCLUDEDIR, but as this variable is only used to
> generate pkg-config files, it is reasonable to use PCPREFIX instead of
> PREFIX in its definition.
>
> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
Thank you for your review Nicolas.
I'm currently reworking the Makefiles again.
After more digging I have came to the conclusion that the main problem
is that the Makefiles does not follow the standard semantic of DESTDIR
and PREFIX.
I will try to fix this.
I suggest that we drop this patch and wait for my new patchsets.
Thank you
Best regards
Marcus Folkesson
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-07 20:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-03 16:29 [PATCH] libselinux: introduce PCPREFIX substitute variables for .pc files Marcus Folkesson
2018-01-03 21:13 ` [PATCH v2] libselinux: introduce PCPREFIX substitute variable " Marcus Folkesson
2018-01-07 20:38 ` Nicolas Iooss
2018-01-07 20:49 ` Marcus Folkesson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.