env: Reject pkg-config ignoring PKG_CONFIG_LIBDIR

The pkgconf-pypi shim silently does nothing when it is set, which made
Meson fall back to building all dependencies from source.
This commit is contained in:
Ole André Vadla Ravnås committed 2026-10-29 10:15:57 +01:00
1 parent 33c17e8b6f
commit 07e5aa86ee
1 file changed
+10
+10
View File
@@ -335,9 +335,19 @@ def find_usable_system_pkg_config() -> Optional[str]:
is_strawberry_perl_stub = "Pure-Perl" in helptext
if is_strawberry_perl_stub:
return None
if not responds_when_libdir_is_set(binary):
return None
return binary
def responds_when_libdir_is_set(pkg_config: str) -> bool:
version = subprocess.run([pkg_config, "--version"],
capture_output=True,
text=True,
env={**os.environ, "PKG_CONFIG_LIBDIR": os.devnull}).stdout
return version.strip() != ""
def make_pkg_config_wrapper(pkg_config: List[str], pkg_config_path: List[str], pkg_config_libdir: Optional[str] = None) -> str:
lines = [
"import os",