authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-02 15:49:16-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2019-08-02 15:49:16-07:00
log1823a5979ad444a59a05dfa381d1dc88348cbd74
treeeb1ddb255813c8fc18f57aba2ee797c983802b48
parentb2d94f9af2968e01bd3d8db38c9ae1992bbd3678
parent723aea8369375d17d19bc1e6d02dbf6eb4d9ba49
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #2985 from fengb/fix-build-references

Fix build references

1 files changed, 16 insertions(+), 16 deletions(-)

std/build.zig+16-16
......@@ -805,11 +805,7 @@ pub const Builder = struct {
805805 return name;
806806 }
807807 const full_path = try fs.path.join(self.allocator, [_][]const u8{ search_prefix, "bin", self.fmt("{}{}", name, exe_extension) });
808 if (fs.path.real(self.allocator, full_path)) |real_path| {
809 return real_path;
810 } else |_| {
811 continue;
812 }
808 return fs.realpathAlloc(self.allocator, full_path) catch continue;
813809 }
814810 }
815811 if (self.env_map.get("PATH")) |PATH| {
......@@ -817,14 +813,10 @@ pub const Builder = struct {
817813 if (fs.path.isAbsolute(name)) {
818814 return name;
819815 }
820 var it = mem.tokenize(PATH, []u8{fs.path.delimiter});
816 var it = mem.tokenize(PATH, [_]u8{fs.path.delimiter});
821817 while (it.next()) |path| {
822818 const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) });
823 if (fs.path.real(self.allocator, full_path)) |real_path| {
824 return real_path;
825 } else |_| {
826 continue;
827 }
819 return fs.realpathAlloc(self.allocator, full_path) catch continue;
828820 }
829821 }
830822 }
......@@ -834,11 +826,7 @@ pub const Builder = struct {
834826 }
835827 for (paths) |path| {
836828 const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) });
837 if (fs.path.real(self.allocator, full_path)) |real_path| {
838 return real_path;
839 } else |_| {
840 continue;
841 }
829 return fs.realpathAlloc(self.allocator, full_path) catch continue;
842830 }
843831 }
844832 return error.FileNotFound;
......@@ -904,6 +892,15 @@ pub const Builder = struct {
904892 }
905893};
906894
895test "builder.findProgram compiles" {
896 //allocator: *Allocator,
897 //zig_exe: []const u8,
898 //build_root: []const u8,
899 //cache_root: []const u8,
900 const builder = try Builder.create(std.heap.direct_allocator, "zig", "zig-cache", "zig-cache");
901 _ = builder.findProgram([_][]const u8{}, [_][]const u8{}) catch null;
902}
903
907904pub const Version = struct {
908905 major: u32,
909906 minor: u32,
......@@ -1122,6 +1119,9 @@ pub const Target = union(enum) {
11221119 }
11231120
11241121 pub fn libPrefix(self: Target) []const u8 {
1122 if (self.isWasm()) {
1123 return "";
1124 }
11251125 switch (self.getAbi()) {
11261126 .msvc => return "",
11271127 else => return "lib",