diff mbox series

[kirkstone,08/27] buildtools-tarball: set pkg-config search path

Message ID 9a110453f6b4b2c2d86af4ae20860037796a284d.1676236110.git.steve@sakoman.com
State Accepted, archived
Commit 9a110453f6b4b2c2d86af4ae20860037796a284d
Headers show
Series [kirkstone,01/27] python3-certifi: fix for CVE-2022-23491 | expand

Commit Message

Steve Sakoman Feb. 12, 2023, 9:10 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

The buildtools-tarball includes a native sysroot with .pc files, and
in the case of buildtools-extended-tarball a pkg-config binary too.

If we're using the host pkg-config then it doesn't know to search in the
native sysroot.  If we're using our pkg-config then it searches in the
build-time prefix and not the actual SDK installation location.

Neither of these are correct, so set PKG_CONFIG_LIBDIR to search:
- The native sysroot
- The host pkg-config's default search path, if present
- Falling back to /usr/lib/pkgconfig, if not

In an ideal world this would be handled by the generic toolchain script,
but that is slightly more involved.

[ YOCTO #15007 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 8f768a3f4c7ff477e994d60800e5a1b83891615a)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/recipes-core/meta/buildtools-tarball.bb | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
index de399173ba..34f7773398 100644
--- a/meta/recipes-core/meta/buildtools-tarball.bb
+++ b/meta/recipes-core/meta/buildtools-tarball.bb
@@ -75,6 +75,9 @@  create_sdk_files:append () {
 		echo 'export REQUESTS_CA_BUNDLE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
 		echo 'export CURL_CA_BUNDLE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
 	fi
+	echo 'HOST_PKG_PATH=$(command -p pkg-config --variable=pc_path pkg-config 2>/dev/null)' >>$script
+	echo 'export PKG_CONFIG_LIBDIR=${SDKPATHNATIVE}/${libdir}/pkgconfig:${SDKPATHNATIVE}/${datadir}/pkgconfig:${HOST_PKG_PATH:-/usr/lib/pkgconfig:/usr/share/pkgconfig}' >>$script
+	echo 'unset HOST_PKG_PATH'
 
 	toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}