commit:     d57c266058fcfd2bc3f535a832ab86efde3fb0ab
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 20 07:59:29 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 23 12:56:09 2023 +0000
URL:        https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=d57c2660

cross-pkg-config: Properly set PKG_CONFIG_SYSTEM_*_PATH variables

Perhaps this was a difference between pkg-config and pkgconf, but we
have not set PKG_CONFIG_SYSTEM_LIBRARY_PATH correctly since we began
setting it in 2014. It should include the SYSROOT. We also never set
PKG_CONFIG_SYSTEM_INCLUDE_PATH at all.

These variables tell pkg-config not to emit paths that the toolchain
would search in anyway. This helps to reduce the noise appearing in
newly-installed .pc files.

This change does assume that if you have set SYSROOT differently to the
toolchain's default, then you have also added the --sysroot argument to
your compiler flags. Neither Portage nor Gentoo currently do this for
you. cross-boss does, but it's not an officially supported solution. The
change could therefore potentially break things, but it's likely you'll
run into other problems if you don't add --sysroot anyway.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Closes: https://github.com/gentoo/crossdev/pull/13
Signed-off-by: Sam James <sam <AT> gentoo.org>

 wrappers/cross-pkg-config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/wrappers/cross-pkg-config b/wrappers/cross-pkg-config
index 4e4da92..ba4d3ac 100755
--- a/wrappers/cross-pkg-config
+++ b/wrappers/cross-pkg-config
@@ -118,7 +118,9 @@ if [ -z "${libdir}" ] ; then
        libdir=${libdir##*/}
 fi
 : ${libdir:=lib}
-export 
PKG_CONFIG_SYSTEM_LIBRARY_PATH="${PREFIX}/usr/${libdir}:${PREFIX}/${libdir}"
+export \
+       
PKG_CONFIG_SYSTEM_LIBRARY_PATH="${PKG_CONFIG_ESYSROOT_DIR}/usr/${libdir}:${PKG_CONFIG_ESYSROOT_DIR}/${libdir}"
 \
+       PKG_CONFIG_SYSTEM_INCLUDE_PATH="${PKG_CONFIG_ESYSROOT_DIR}/usr/include"
 
 #
 # Set the pkg-config search paths to our staging directory.

Reply via email to