]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
classes/pkgconfig: rationalise variable usage
authorRoss Burton <ross.burton@arm.com>
Thu, 26 Feb 2026 14:31:10 +0000 (14:31 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 5 Mar 2026 17:36:54 +0000 (17:36 +0000)
commit52c7dbb1d4f28cc8d51c2129b93775ded0d3ef31
treef111841bce7d460c09e0882a377d59fee1a34216
parentaf423b499c8f8601eb635b9180b29fe782b12403
classes/pkgconfig: rationalise variable usage

Our PKG_CONFIG_* variables were a bit of a mess.

First, PKG_CONFIG_DIR is not used by either pkg-config or pkgconf.  It's
set to (approximately) ${libdir}/pkgconfig but we also want to search
${datadir}/pkgconfig so it isn't actually useful as an intermediate
variable.

Remove PKG_CONFIG_DIR and replace with the neatest expression for the
value we want: ${STAGING_LIBDIR}/pkgconfig.

Second, PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR shouldn't be set to the
same paths. The semantics of these variables is that PKG_CONFIG_PATH is
searched first, followed by either PKG_CONFIG_LIBDIR or the default paths
compiled into the pkg-config binary.

Currently we set PKG_CONFIG_PATH to (approx.) ${libdir}:${datadir} and
PKG_CONFIG_LIBDIR to ${libdir}, so we search libdir twice.

Also the default paths embedded in the binary will be incorrect as they
point to pkgconfig-native's sysroot, so we absolutely need to set
PKG_CONFIG_LIBDIR.

Instead, set PKG_CONFIG_LIBDIR to ${libdir}:${datadir} so that the
default search path is correct. We can then leave PKG_CONFIG_PATH empty,
if a recipe has specific needs it can set that but normally it is not
needed anymore.

Then bubble these changes out to the few places where the variables are
used directly:

- Kernel/kconfig interaction where 'pkg-config' needs to read the
native files, not target.

- The class classes (native, etc) which redefine the values.  However,
as the values are defined in terms of sysroot variables, we can
typically remove assignments from those classes as they are redundant.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/cml1.bbclass
meta/classes-recipe/cross-canadian.bbclass
meta/classes-recipe/cross.bbclass
meta/classes-recipe/kernel.bbclass
meta/classes-recipe/native.bbclass
meta/classes-recipe/nativesdk.bbclass
meta/classes-recipe/pkgconfig.bbclass
meta/recipes-kernel/linux/linux-yocto.inc