mirror of
https://github.com/ziglang/zig.git
synced 2024-11-16 17:15:37 +00:00
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 ``` Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
This commit is contained in:
parent
c746d7a35d
commit
d263f1ec0e
@ -707,8 +707,9 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult {
|
||||
};
|
||||
|
||||
var code: u8 = undefined;
|
||||
const pkg_config_exe = b.graph.env_map.get("PKG_CONFIG") orelse "pkg-config";
|
||||
const stdout = if (b.runAllowFail(&[_][]const u8{
|
||||
"pkg-config",
|
||||
pkg_config_exe,
|
||||
pkg_name,
|
||||
"--cflags",
|
||||
"--libs",
|
||||
@ -1852,7 +1853,8 @@ pub fn doAtomicSymLinks(
|
||||
}
|
||||
|
||||
fn execPkgConfigList(compile: *std.Build, out_code: *u8) (PkgConfigError || RunError)![]const PkgConfigPkg {
|
||||
const stdout = try compile.runAllowFail(&[_][]const u8{ "pkg-config", "--list-all" }, out_code, .Ignore);
|
||||
const pkg_config_exe = compile.graph.env_map.get("PKG_CONFIG") orelse "pkg-config";
|
||||
const stdout = try compile.runAllowFail(&[_][]const u8{ pkg_config_exe, "--list-all" }, out_code, .Ignore);
|
||||
var list = ArrayList(PkgConfigPkg).init(compile.allocator);
|
||||
errdefer list.deinit();
|
||||
var line_it = mem.tokenizeAny(u8, stdout, "\r\n");
|
||||
|
Loading…
Reference in New Issue
Block a user