mirror of
https://github.com/ziglang/zig.git
synced 2026-02-17 23:10:09 +00:00
Merge pull request #2985 from fengb/fix-build-references
Fix build references
This commit is contained in:
commit
1823a5979a
@ -805,11 +805,7 @@ pub const Builder = struct {
|
||||
return name;
|
||||
}
|
||||
const full_path = try fs.path.join(self.allocator, [_][]const u8{ search_prefix, "bin", self.fmt("{}{}", name, exe_extension) });
|
||||
if (fs.path.real(self.allocator, full_path)) |real_path| {
|
||||
return real_path;
|
||||
} else |_| {
|
||||
continue;
|
||||
}
|
||||
return fs.realpathAlloc(self.allocator, full_path) catch continue;
|
||||
}
|
||||
}
|
||||
if (self.env_map.get("PATH")) |PATH| {
|
||||
@ -817,14 +813,10 @@ pub const Builder = struct {
|
||||
if (fs.path.isAbsolute(name)) {
|
||||
return name;
|
||||
}
|
||||
var it = mem.tokenize(PATH, []u8{fs.path.delimiter});
|
||||
var it = mem.tokenize(PATH, [_]u8{fs.path.delimiter});
|
||||
while (it.next()) |path| {
|
||||
const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) });
|
||||
if (fs.path.real(self.allocator, full_path)) |real_path| {
|
||||
return real_path;
|
||||
} else |_| {
|
||||
continue;
|
||||
}
|
||||
return fs.realpathAlloc(self.allocator, full_path) catch continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -834,11 +826,7 @@ pub const Builder = struct {
|
||||
}
|
||||
for (paths) |path| {
|
||||
const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) });
|
||||
if (fs.path.real(self.allocator, full_path)) |real_path| {
|
||||
return real_path;
|
||||
} else |_| {
|
||||
continue;
|
||||
}
|
||||
return fs.realpathAlloc(self.allocator, full_path) catch continue;
|
||||
}
|
||||
}
|
||||
return error.FileNotFound;
|
||||
@ -904,6 +892,15 @@ pub const Builder = struct {
|
||||
}
|
||||
};
|
||||
|
||||
test "builder.findProgram compiles" {
|
||||
//allocator: *Allocator,
|
||||
//zig_exe: []const u8,
|
||||
//build_root: []const u8,
|
||||
//cache_root: []const u8,
|
||||
const builder = try Builder.create(std.heap.direct_allocator, "zig", "zig-cache", "zig-cache");
|
||||
_ = builder.findProgram([_][]const u8{}, [_][]const u8{}) catch null;
|
||||
}
|
||||
|
||||
pub const Version = struct {
|
||||
major: u32,
|
||||
minor: u32,
|
||||
@ -1122,6 +1119,9 @@ pub const Target = union(enum) {
|
||||
}
|
||||
|
||||
pub fn libPrefix(self: Target) []const u8 {
|
||||
if (self.isWasm()) {
|
||||
return "";
|
||||
}
|
||||
switch (self.getAbi()) {
|
||||
.msvc => return "",
|
||||
else => return "lib",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user