mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-07 14:24:43 +00:00
std.Build: Detect pkg-config names with "lib" prefix
This commit is contained in:
parent
cfdb001a8f
commit
97b8d662e6
1 changed files with 7 additions and 5 deletions
|
|
@ -695,6 +695,7 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult {
|
||||||
// -lSDL2 -> pkg-config sdl2
|
// -lSDL2 -> pkg-config sdl2
|
||||||
// -lgdk-3 -> pkg-config gdk-3.0
|
// -lgdk-3 -> pkg-config gdk-3.0
|
||||||
// -latk-1.0 -> pkg-config atk
|
// -latk-1.0 -> pkg-config atk
|
||||||
|
// -lpulse -> pkg-config libpulse
|
||||||
const pkgs = try getPkgConfigList(b);
|
const pkgs = try getPkgConfigList(b);
|
||||||
|
|
||||||
// Exact match means instant winner.
|
// Exact match means instant winner.
|
||||||
|
|
@ -711,13 +712,14 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now try appending ".0".
|
// Prefixed "lib" or suffixed ".0".
|
||||||
for (pkgs) |pkg| {
|
for (pkgs) |pkg| {
|
||||||
if (std.ascii.indexOfIgnoreCase(pkg.name, lib_name)) |pos| {
|
if (std.ascii.indexOfIgnoreCase(pkg.name, lib_name)) |pos| {
|
||||||
if (pos != 0) continue;
|
const prefix = pkg.name[0..pos];
|
||||||
if (mem.eql(u8, pkg.name[lib_name.len..], ".0")) {
|
const suffix = pkg.name[pos + lib_name.len ..];
|
||||||
break :match pkg.name;
|
if (prefix.len > 0 and !mem.eql(u8, prefix, "lib")) continue;
|
||||||
}
|
if (suffix.len > 0 and !mem.eql(u8, suffix, ".0")) continue;
|
||||||
|
break :match pkg.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue