Policycoreutils: Make pkg-config work for more types of builds
PATCH 1/1 Policycoreutils: Make pkg-config work for more types of builds
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.
--- policycoreutils/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
policycoreutils/Makefile +2 -2
@@ -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:
Signature · 1 line
2.50.0
Quoted 6 lines · James Carter
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.
Quoted 7 lines
Instead set
PKG_CONFIG_PATHwhen invoking pkg-config so that it searches in order:
1) The directory specified byPKG_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 <[email protected]>
BTW, this applies on top of Alyssa's two patches.
Jim
Quoted 22 lines
--- policycoreutils/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)policycoreutils/Makefile +2
-3@@ -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
Quoted 6 lines · James Carter
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.
Quoted 7 lines
Instead set
PKG_CONFIG_PATHwhen invoking pkg-config so that it searches in order:
1) The directory specified byPKG_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 <[email protected]>
It seems like there are no objections, so I have merged this. Jim
Quoted 22 lines
--- policycoreutils/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)policycoreutils/Makefile +2
-3@@ -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