Meson does not expose PKG_CONFIG_SYSROOT_DIR to the pkg-config process.
Currently meson.cross as generated in meson.bbclass points directly to the pkg-config executable (no wrapper script).
PKG_CONFIG_SYSROOT_DIR behaves like a simple string prepend to all package config variable queries. So if you want to determine the absolute path of a variable in .pc you set PKG_CONFIG_SYSROOT_DIR and make your query. Currently this is not possible with Yocto+Meson.
I think a simple wrapper script would resolve this. This is from https://autotools.io/pkgconfig/cross-compiling.html:
#!/bin/sh
SYSROOT=/build/root
export PKG_CONFIG_PATH=
export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig:${SYSROOT}/usr/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
exec pkg-config "$@"
The wrapper script would be generated per recipe via meson.bbclass, meson.cross would then reference this wrapper instead of the pkg-config executable.
Thoughts?
Joel