selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selinux: make use of variables when defining libdir and  includedir
@ 2020-07-16 20:32 W. Michael Petullo
  2020-07-19 17:15 ` Nicolas Iooss
  0 siblings, 1 reply; 2+ messages in thread
From: W. Michael Petullo @ 2020-07-16 20:32 UTC (permalink / raw)
  To: selinux

Pkg-config definitions commonly make use of ${exec_prefix} and
${prefix} when defining libdir and includedir, respectively. OpenWrt,
for example, relies on this when it adjusts things for cross
compiling.

Signed-off-by: W. Michael Petullo <mike@flyn.org>
---
 libselinux/src/libselinux.pc.in | 4 ++--
 libsepol/src/libsepol.pc.in     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libselinux/src/libselinux.pc.in
b/libselinux/src/libselinux.pc.in
index 7c66b1fa..d9d58125 100644
--- a/libselinux/src/libselinux.pc.in
+++ b/libselinux/src/libselinux.pc.in
@@ -1,7 +1,7 @@
 prefix=@prefix@
 exec_prefix=${prefix}
-libdir=@libdir@
-includedir=@includedir@
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include

 Name: libselinux
 Description: SELinux utility library
diff --git a/libsepol/src/libsepol.pc.in b/libsepol/src/libsepol.pc.in
index f807fec6..cf2411e4 100644
--- a/libsepol/src/libsepol.pc.in
+++ b/libsepol/src/libsepol.pc.in
@@ -1,7 +1,7 @@
 prefix=@prefix@
 exec_prefix=${prefix}
-libdir=@libdir@
-includedir=@includedir@
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include

 Name: libsepol
 Description: SELinux policy library
-- 
2.26.2



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

* Re: [PATCH] selinux: make use of variables when defining libdir and includedir
  2020-07-16 20:32 [PATCH] selinux: make use of variables when defining libdir and includedir W. Michael Petullo
@ 2020-07-19 17:15 ` Nicolas Iooss
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Iooss @ 2020-07-19 17:15 UTC (permalink / raw)
  To: W. Michael Petullo, SElinux list

On Thu, Jul 16, 2020 at 10:39 PM W. Michael Petullo <mike@flyn.org> wrote:
>
> Pkg-config definitions commonly make use of ${exec_prefix} and
> ${prefix} when defining libdir and includedir, respectively. OpenWrt,
> for example, relies on this when it adjusts things for cross
> compiling.
>
> Signed-off-by: W. Michael Petullo <mike@flyn.org>
> ---
>  libselinux/src/libselinux.pc.in | 4 ++--
>  libsepol/src/libsepol.pc.in     | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libselinux/src/libselinux.pc.in
> b/libselinux/src/libselinux.pc.in
> index 7c66b1fa..d9d58125 100644
> --- a/libselinux/src/libselinux.pc.in
> +++ b/libselinux/src/libselinux.pc.in
> @@ -1,7 +1,7 @@
>  prefix=@prefix@
>  exec_prefix=${prefix}
> -libdir=@libdir@
> -includedir=@includedir@
> +libdir=${exec_prefix}/lib
> +includedir=${prefix}/include
>
>  Name: libselinux
>  Description: SELinux utility library
> diff --git a/libsepol/src/libsepol.pc.in b/libsepol/src/libsepol.pc.in
> index f807fec6..cf2411e4 100644
> --- a/libsepol/src/libsepol.pc.in
> +++ b/libsepol/src/libsepol.pc.in
> @@ -1,7 +1,7 @@
>  prefix=@prefix@
>  exec_prefix=${prefix}
> -libdir=@libdir@
> -includedir=@includedir@
> +libdir=${exec_prefix}/lib
> +includedir=${prefix}/include
>
>  Name: libsepol
>  Description: SELinux policy library
> --
> 2.26.2

Hello,
I am wondering whether this could break some distributions that use
another path for their lib directory. For example on Fedora 31,
/usr/lib64/pkgconfig/libselinux.pc contains:

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=/usr/include

Looking at other libraries, here is what I see for example for libpcre2-posix:

* In Debian 10, /usr/lib/x86_64-linux-gnu/pkgconfig/libpcre2-posix.pc
contains libdir=${prefix}/lib/x86_64-linux-gnu
* In Arch Linux, /usr/lib/pkgconfig/libpcre2-posix.pc contains
libdir=${exec_prefix}/lib (and exec_prefix=${prefix})
* In Fedora 31, /usr/lib64/pkgconfig/libpcre2-posix.pc contains
libdir=/usr/lib64
* Upstream, https://vcs.pcre.org/pcre2/code/tags/pcre2-10.35/libpcre2-posix.pc.in?view=markup
contains libdir=@libdir@ and @libdir@ is replaced using
AC_CONFIG_FILES(libpcre2-posix.pc) in configure.ac.

libsepol and libselinux use Makefile variables instead of autoconf, to
generate the .pc files from the .pc.in files. I can work on a way to
make the file contain ${exec_prefix}/lib when LIBDIR is $(PREFIX)/lib
in Makefile, but before doing so I would like to have more information
about your use-case. Do you encounter issues while building libsepol
and libselinux themselves, or when linking other projects using
"$(pkgconf --libs libselinux)"? Could you share a simple example that
reproduces your issue?

About the includedir part, this is quite different as it seems all
distributions agree on the location of header files. It makes sense to
drop the INCLUDEDIR variable from the Makefile and use
includedir=${prefix}/include, as your patch does.

Thanks,
Nicolas


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

end of thread, other threads:[~2020-07-19 17:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 20:32 [PATCH] selinux: make use of variables when defining libdir and includedir W. Michael Petullo
2020-07-19 17:15 ` Nicolas Iooss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).