commit: 3496df638fca284c97927d42ed27a76763b60f36
Author: Matt Whitlock <gentoo <AT> mattwhitlock <DOT> name>
AuthorDate: Sun Aug 3 13:24:04 2025 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Wed Aug 20 22:26:47 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3496df63
multilib.eclass: respect SYSROOT when overriding PKG_CONFIG_* vars
In multilib.eclass, multilib_toolchain_setup() overrides the environment
variables PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH,
PKG_CONFIG_SYSTEM_INCLUDE_PATH, and PKG_CONFIG_SYSTEM_LIBRARY_PATH so
that the .pc files for the correct ABI will be found and used.
As a reminder, pkgconfig is normally called upon to find packages that
have been installed into the *host* system — i.e., packages listed in
DEPEND. The "Ebuild writing: Variables" page[1] describes the SYSROOT
variable as "The absolute path to the root directory containing build
dependencies satisfied by DEPEND" and ESYSROOT as "The same as either
EROOT, BROOT or SYSROOT depending on the value of SYSROOT. Commonly used
to reference the location of headers and libraries at build time."
In order to support the use case of setting SYSROOT to a path other than
"/" while building packages for ABIs other than the default ABI, change
multilib.eclass so that it prefixes the PKG_CONFIG_* vars with
${ESYSROOT} rather than ${EPREFIX}.
For Gentoo users who do not set SYSROOT, this change will have no
bearing.
This change could conceivably affect crossdev users, but I think
typically crossdev sysroots do not support multilib anyway, so this
change wouldn't affect them either.
[1] https://devmanual.gentoo.org/ebuild-writing/variables/
Closes: https://bugs.gentoo.org/945108
Signed-off-by: Matt Whitlock <gentoo <AT> mattwhitlock.name>
Part-of: https://github.com/gentoo/gentoo/pull/43088
Closes: https://github.com/gentoo/gentoo/pull/43088
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
eclass/multilib.eclass | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
index f19ad20af8fd..c28fee7aa1ef 100644
--- a/eclass/multilib.eclass
+++ b/eclass/multilib.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: multilib.eclass
@@ -552,10 +552,10 @@ multilib_toolchain_setup() {
export STRIP="$(tc-getSTRIP)" # Avoid 'strip', use
'${CHOST}-strip'
export CHOST=$(get_abi_CHOST $1)
- export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig
- export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig
- export PKG_CONFIG_SYSTEM_INCLUDE_PATH=${EPREFIX}/usr/include
- export
PKG_CONFIG_SYSTEM_LIBRARY_PATH=${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)
+ export PKG_CONFIG_LIBDIR=${ESYSROOT}/usr/$(get_libdir)/pkgconfig
+ export PKG_CONFIG_PATH=${ESYSROOT}/usr/share/pkgconfig
+ export PKG_CONFIG_SYSTEM_INCLUDE_PATH=${ESYSROOT}/usr/include
+ export
PKG_CONFIG_SYSTEM_LIBRARY_PATH=${ESYSROOT}/$(get_libdir):${ESYSROOT}/usr/$(get_libdir)
fi
}