zig
zig copied to clipboard
zig build: respect PKG_CONFIG environment variable
PKG_CONFIG
environment variable is used to override path to
pkg-config executable, for example when it's name is prepended by
target triple for cross-compilation purposes:
PKG_CONFIG=/usr/bin/aarch64-unknown-linux-gnu-pkgconf zig build
standard practice here is to check the PKG_CONFIG
env var
standard practice here is to check the
PKG_CONFIG
env var
I know, it was intentionally omitted. I think it will be easier to merge without it, since there are less lines added and less ehh controversial points (IIRC core team wants to avoid this kind of environment variables, f.e. https://github.com/ziglang/zig/issues/17585 and https://github.com/ziglang/zig/issues/10754#issuecomment-1519151708), don't want to convince them, just easy merge.
Fixed merge conflict.
I don't see how those linked issues are relevant. If
PKG_CONFIG
environment variable is a standard practice then it's desirable to use as the default. The purpose of the pkg-config integration is to integrate with the system. Respecting a standard environment variable would make the system integration more complete.
It's even better, will do :)
you can use below code in the build.zig to achieve the same effect.
b.graph.env_map.put("PKG_CONFIG_PATH", "XXXX") catch unreachable;
Thanks!