All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: selinux@tycho.nsa.gov
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
Subject: [PATCH v2] libselinux: introduce PCPREFIX substitute variable for .pc files
Date: Wed,  3 Jan 2018 22:13:46 +0100	[thread overview]
Message-ID: <20180103211346.27213-1-marcus.folkesson@gmail.com> (raw)
In-Reply-To: <20180103162955.22677-1-marcus.folkesson@gmail.com>

`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

  reply	other threads:[~2018-01-03 21:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03 16:29 [PATCH] libselinux: introduce PCPREFIX substitute variables for .pc files Marcus Folkesson
2018-01-03 21:13 ` Marcus Folkesson [this message]
2018-01-07 20:38   ` [PATCH v2] libselinux: introduce PCPREFIX substitute variable " Nicolas Iooss
2018-01-07 20:49     ` Marcus Folkesson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180103211346.27213-1-marcus.folkesson@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.