diff options
author | 2021-01-16 21:54:24 +0000 | |
---|---|---|
committer | 2021-01-17 08:09:39 +0000 | |
commit | 9f5826dfc470a52cc69a5a7d545438e0f8f6f212 (patch) | |
tree | b99826e20fc2f827d392e7a23eba9332e0a0902e /wrappers | |
parent | README: add more tuple examples that happen to work today (diff) | |
download | crossdev-9f5826dfc470a52cc69a5a7d545438e0f8f6f212.tar.gz crossdev-9f5826dfc470a52cc69a5a7d545438e0f8f6f212.tar.bz2 crossdev-9f5826dfc470a52cc69a5a7d545438e0f8f6f212.zip |
cross-pkg-config: Respect PKG_CONFIG_SYSROOT_DIR if its already set
When using --variable, pkgconf prepends PKG_CONFIG_SYSROOT_DIR to the
value when it starts with /, even though the original pkg-config
didn't do this. Upstream have confirmed that this is intentional
[1]. The original pkg-config is no longer maintained and will probably
be dropped from Gentoo.
$ PKG_CONFIG_SYSROOT_DIR=/foo pkgconf --variable=udevdir udev
/foo/lib/udev
$ PKG_CONFIG_SYSROOT_DIR=/foo pkg-config --variable=udevdir udev
/lib/udev
In some contexts, we do not want the SYSROOT to be prepended
here. This would normally just be a case of not setting
PKG_CONFIG_SYSROOT_DIR but our wrapper uses SYSROOT to set both
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_LIBDIR. It will not set one
without the other but we need the latter to find the right .pc file in
the first place.
One example where this issue arises is Gentoo's udev eclass. Packages
installing udev rules call get_udevdir() to find out where to put
them. With ROOT=/foo SYSROOT=/foo, this will return something like
/foo/lib/udev but since ROOT is already handled by Portage when
merging, the rules will actually end up in /foo/foo/lib/udev.
This can be resolved by respecting PKG_CONFIG_SYSROOT_DIR, even when
it is set but blank. It is unlikely to be set more widely when using
cross-pkg-config so this should be safe.
[1] https://github.com/pkgconf/pkgconf/issues/69#issuecomment-48434876
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'wrappers')
-rwxr-xr-x | wrappers/cross-pkg-config | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/wrappers/cross-pkg-config b/wrappers/cross-pkg-config index e7a234c..d569bb9 100755 --- a/wrappers/cross-pkg-config +++ b/wrappers/cross-pkg-config @@ -99,7 +99,8 @@ export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/${libdir}/pkgconfig:${SYSROOT}/usr/shar if [ -n "${EXTRA_PKG_CONFIG_LIBDIR}" ] ; then PKG_CONFIG_LIBDIR="${EXTRA_PKG_CONFIG_LIBDIR}:${PKG_CONFIG_LIBDIR}" fi -export PKG_CONFIG_SYSROOT_DIR="${SYSROOT}" +: ${PKG_CONFIG_SYSROOT_DIR=${SYSROOT}} +export PKG_CONFIG_SYSROOT_DIR # # Sanity check the output to catch common errors that do not |