selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: selinux@vger.kernel.org
Cc: James Carter <jwcart2@gmail.com>
Subject: [PATCH] Policycoreutils: Make pkg-config work for more types of builds
Date: Tue,  1 Jul 2025 09:03:09 -0400	[thread overview]
Message-ID: <20250701130309.260015-1-jwcart2@gmail.com> (raw)

To support static builds, pkg-config is used to add the libraries
needed for libselinux and libsemanage during the build. Unforunately,
pkg-config will always use the installed pc files for libselinux and
libsemanage.

Instead set PKG_CONFIG_PATH when invoking pkg-config so that
it searches in order:
1) The directory specified by PKG_CONFIG_PATH, if already set.
2) The local src directories of libselinux and libsemaange.
3) The default directories specified by the system.

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 policycoreutils/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/policycoreutils/Makefile b/policycoreutils/Makefile
index 0f3d62f2..7c9706e3 100644
--- a/policycoreutils/Makefile
+++ b/policycoreutils/Makefile
@@ -2,8 +2,8 @@ SUBDIRS = setfiles load_policy newrole run_init secon sestatus semodule setseboo
 
 PKG_CONFIG ?= pkg-config
 
-LIBSELINUX_LDLIBS := $(shell $(PKG_CONFIG) --libs libselinux)
-LIBSEMANAGE_LDLIBS := $(shell $(PKG_CONFIG) --libs libsemanage)
+LIBSELINUX_LDLIBS := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):../libselinux/src" $(PKG_CONFIG) --libs libselinux)
+LIBSEMANAGE_LDLIBS := $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH):../libsemanage/src" $(PKG_CONFIG) --libs libsemanage)
 export LIBSELINUX_LDLIBS LIBSEMANAGE_LDLIBS
 
 all install relabel clean indent:
-- 
2.50.0


             reply	other threads:[~2025-07-01 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-01 13:03 James Carter [this message]
2025-07-01 15:14 ` [PATCH] Policycoreutils: Make pkg-config work for more types of builds James Carter
2025-07-02 17:35 ` James Carter

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=20250701130309.260015-1-jwcart2@gmail.com \
    --to=jwcart2@gmail.com \
    --cc=selinux@vger.kernel.org \
    /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 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).