| ... | @@ -897,11 +897,11 @@ pub fn resolveLibSystem( | ... | @@ -897,11 +897,11 @@ pub fn resolveLibSystem( |
| 897 | if (self.sdk_layout) |sdk_layout| switch (sdk_layout) { | 897 | if (self.sdk_layout) |sdk_layout| switch (sdk_layout) { |
| 898 | .sdk => { | 898 | .sdk => { |
| 899 | const dir = try fs.path.join(arena, &[_][]const u8{ comp.sysroot.?, "usr", "lib" }); | 899 | const dir = try fs.path.join(arena, &[_][]const u8{ comp.sysroot.?, "usr", "lib" }); |
| 900 | if (try accessLibPath(arena, &test_path, &checked_paths, dir, "libSystem")) break :success; | 900 | if (try accessLibPath(arena, &test_path, &checked_paths, dir, "System")) break :success; |
| 901 | }, | 901 | }, |
| 902 | .vendored => { | 902 | .vendored => { |
| 903 | const dir = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "darwin" }); | 903 | const dir = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "darwin" }); |
| 904 | if (try accessLibPath(arena, &test_path, &checked_paths, dir, "libSystem")) break :success; | 904 | if (try accessLibPath(arena, &test_path, &checked_paths, dir, "System")) break :success; |
| 905 | }, | 905 | }, |
| 906 | }; | 906 | }; |
| 907 | | 907 | |
| ... | @@ -916,51 +916,6 @@ pub fn resolveLibSystem( | ... | @@ -916,51 +916,6 @@ pub fn resolveLibSystem( |
| 916 | }); | 916 | }); |
| 917 | } | 917 | } |
| 918 | | 918 | |
| 919 | fn accessLibPath( | | |
| 920 | gpa: Allocator, | | |
| 921 | test_path: *std.ArrayList(u8), | | |
| 922 | checked_paths: *std.ArrayList([]const u8), | | |
| 923 | search_dir: []const u8, | | |
| 924 | lib_name: []const u8, | | |
| 925 | ) !bool { | | |
| 926 | const sep = fs.path.sep_str; | | |
| 927 | | | |
| 928 | tbd: { | | |
| 929 | test_path.clearRetainingCapacity(); | | |
| 930 | try test_path.writer().print("{s}" ++ sep ++ "{s}.tbd", .{ search_dir, lib_name }); | | |
| 931 | try checked_paths.append(try gpa.dupe(u8, test_path.items)); | | |
| 932 | fs.cwd().access(test_path.items, .{}) catch |err| switch (err) { | | |
| 933 | error.FileNotFound => break :tbd, | | |
| 934 | else => |e| return e, | | |
| 935 | }; | | |
| 936 | return true; | | |
| 937 | } | | |
| 938 | | | |
| 939 | dylib: { | | |
| 940 | test_path.clearRetainingCapacity(); | | |
| 941 | try test_path.writer().print("{s}" ++ sep ++ "{s}.dylib", .{ search_dir, lib_name }); | | |
| 942 | try checked_paths.append(try gpa.dupe(u8, test_path.items)); | | |
| 943 | fs.cwd().access(test_path.items, .{}) catch |err| switch (err) { | | |
| 944 | error.FileNotFound => break :dylib, | | |
| 945 | else => |e| return e, | | |
| 946 | }; | | |
| 947 | return true; | | |
| 948 | } | | |
| 949 | | | |
| 950 | noextension: { | | |
| 951 | test_path.clearRetainingCapacity(); | | |
| 952 | try test_path.writer().print("{s}" ++ sep ++ "{s}", .{ search_dir, lib_name }); | | |
| 953 | try checked_paths.append(try gpa.dupe(u8, test_path.items)); | | |
| 954 | fs.cwd().access(test_path.items, .{}) catch |err| switch (err) { | | |
| 955 | error.FileNotFound => break :noextension, | | |
| 956 | else => |e| return e, | | |
| 957 | }; | | |
| 958 | return true; | | |
| 959 | } | | |
| 960 | | | |
| 961 | return false; | | |
| 962 | } | | |
| 963 | | | |
| 964 | const ParseError = error{ | 919 | const ParseError = error{ |
| 965 | MalformedObject, | 920 | MalformedObject, |
| 966 | MalformedArchive, | 921 | MalformedArchive, |
| ... | @@ -1173,7 +1128,7 @@ fn isHoisted(self: *MachO, install_name: []const u8) bool { | ... | @@ -1173,7 +1128,7 @@ fn isHoisted(self: *MachO, install_name: []const u8) bool { |
| 1173 | return false; | 1128 | return false; |
| 1174 | } | 1129 | } |
| 1175 | | 1130 | |
| 1176 | fn accessLibPath2( | 1131 | fn accessLibPath( |
| 1177 | arena: Allocator, | 1132 | arena: Allocator, |
| 1178 | test_path: *std.ArrayList(u8), | 1133 | test_path: *std.ArrayList(u8), |
| 1179 | checked_paths: *std.ArrayList([]const u8), | 1134 | checked_paths: *std.ArrayList([]const u8), |
| ... | @@ -1274,7 +1229,7 @@ fn parseDependentDylibs(self: *MachO) !void { | ... | @@ -1274,7 +1229,7 @@ fn parseDependentDylibs(self: *MachO) !void { |
| 1274 | const lib_name = eatPrefix(stem, "lib") orelse stem; | 1229 | const lib_name = eatPrefix(stem, "lib") orelse stem; |
| 1275 | for (lib_dirs) |dir| { | 1230 | for (lib_dirs) |dir| { |
| 1276 | test_path.clearRetainingCapacity(); | 1231 | test_path.clearRetainingCapacity(); |
| 1277 | if (try accessLibPath2(arena, &test_path, &checked_paths, dir, lib_name)) break :full_path test_path.items; | 1232 | if (try accessLibPath(arena, &test_path, &checked_paths, dir, lib_name)) break :full_path test_path.items; |
| 1278 | } | 1233 | } |
| 1279 | } | 1234 | } |
| 1280 | | 1235 | |