| author | |
| committer | |
| log | 15fd7cd154316e7eb3bf254e249072e562fdbe2c |
| tree | 7ebf55a244fdb21b1739b30e4dfeec073d86b3f4 |
| parent | 52e835492626b34b34a46115f953591e01d1088e |
| signature |
- update include dirs to use combined dir
- use one libSystem.tbd (drop use of libSystem.VERSION.tbd)
- update canBuildLibC to check for minimum os version only3 files changed, 6 insertions(+), 30 deletions(-)
src/Compilation.zig+3-20| ... | @@ -5656,31 +5656,14 @@ const LibCDirs = struct { | ... | @@ -5656,31 +5656,14 @@ const LibCDirs = struct { |
| 5656 | sysroot: ?[]const u8, | 5656 | sysroot: ?[]const u8, |
| 5657 | }; | 5657 | }; |
| 5658 | 5658 | ||
| 5659 | fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8, target: Target) !LibCDirs { | 5659 | fn getZigShippedLibCIncludeDirsDarwin(arena: Allocator, zig_lib_dir: []const u8) !LibCDirs { |
| 5660 | const arch_name = @tagName(target.cpu.arch); | ||
| 5661 | const os_name = try std.fmt.allocPrint(arena, "{s}.{d}", .{ | ||
| 5662 | @tagName(target.os.tag), | ||
| 5663 | target.os.version_range.semver.min.major, | ||
| 5664 | }); | ||
| 5665 | const s = std.fs.path.sep_str; | 5660 | const s = std.fs.path.sep_str; |
| 5666 | const list = try arena.alloc([]const u8, 3); | 5661 | const list = try arena.alloc([]const u8, 1); |
| 5667 | |||
| 5668 | list[0] = try std.fmt.allocPrint( | 5662 | list[0] = try std.fmt.allocPrint( |
| 5669 | arena, | ||
| 5670 | "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "{s}-{s}-none", | ||
| 5671 | .{ zig_lib_dir, arch_name, os_name }, | ||
| 5672 | ); | ||
| 5673 | list[1] = try std.fmt.allocPrint( | ||
| 5674 | arena, | ||
| 5675 | "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "any-{s}-any", | ||
| 5676 | .{ zig_lib_dir, os_name }, | ||
| 5677 | ); | ||
| 5678 | list[2] = try std.fmt.allocPrint( | ||
| 5679 | arena, | 5663 | arena, |
| 5680 | "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "any-macos-any", | 5664 | "{s}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "any-macos-any", |
| 5681 | .{zig_lib_dir}, | 5665 | .{zig_lib_dir}, |
| 5682 | ); | 5666 | ); |
| 5683 | |||
| 5684 | return LibCDirs{ | 5667 | return LibCDirs{ |
| 5685 | .libc_include_dir_list = list, | 5668 | .libc_include_dir_list = list, |
| 5686 | .libc_installation = null, | 5669 | .libc_installation = null, |
| ... | @@ -5823,7 +5806,7 @@ fn detectLibCFromBuilding( | ... | @@ -5823,7 +5806,7 @@ fn detectLibCFromBuilding( |
| 5823 | target: std.Target, | 5806 | target: std.Target, |
| 5824 | ) !LibCDirs { | 5807 | ) !LibCDirs { |
| 5825 | if (target.isDarwin()) | 5808 | if (target.isDarwin()) |
| 5826 | return getZigShippedLibCIncludeDirsDarwin(arena, zig_lib_dir, target); | 5809 | return getZigShippedLibCIncludeDirsDarwin(arena, zig_lib_dir); |
| 5827 | 5810 | ||
| 5828 | const generic_name = target_util.libCGenericName(target); | 5811 | const generic_name = target_util.libCGenericName(target); |
| 5829 | // Some architectures are handled by the same set of headers. | 5812 | // Some architectures are handled by the same set of headers. |
src/link/MachO.zig+1-4| ... | @@ -661,10 +661,7 @@ pub fn resolveLibSystem( | ... | @@ -661,10 +661,7 @@ pub fn resolveLibSystem( |
| 661 | )) break :success; | 661 | )) break :success; |
| 662 | 662 | ||
| 663 | const dir = try comp.zig_lib_directory.join(tmp_arena, &[_][]const u8{ "libc", "darwin" }); | 663 | const dir = try comp.zig_lib_directory.join(tmp_arena, &[_][]const u8{ "libc", "darwin" }); |
| 664 | const lib_name = try std.fmt.allocPrint(tmp_arena, "libSystem.{d}", .{ | 664 | if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success; |
| 665 | self.base.options.target.os.version_range.semver.min.major, | ||
| 666 | }); | ||
| 667 | if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, lib_name)) break :success; | ||
| 668 | 665 | ||
| 669 | try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{}); | 666 | try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{}); |
| 670 | return; | 667 | return; |
src/target.zig+2-6| ... | @@ -18,8 +18,6 @@ pub const available_libcs = [_]ArchOsAbi{ | ... | @@ -18,8 +18,6 @@ pub const available_libcs = [_]ArchOsAbi{ |
| 18 | .{ .arch = .aarch64, .os = .linux, .abi = .musl }, | 18 | .{ .arch = .aarch64, .os = .linux, .abi = .musl }, |
| 19 | .{ .arch = .aarch64, .os = .windows, .abi = .gnu }, | 19 | .{ .arch = .aarch64, .os = .windows, .abi = .gnu }, |
| 20 | .{ .arch = .aarch64, .os = .macos, .abi = .none, .os_ver = .{ .major = 11, .minor = 0, .patch = 0 } }, | 20 | .{ .arch = .aarch64, .os = .macos, .abi = .none, .os_ver = .{ .major = 11, .minor = 0, .patch = 0 } }, |
| 21 | .{ .arch = .aarch64, .os = .macos, .abi = .none, .os_ver = .{ .major = 12, .minor = 0, .patch = 0 } }, | ||
| 22 | .{ .arch = .aarch64, .os = .macos, .abi = .none, .os_ver = .{ .major = 13, .minor = 0, .patch = 0 } }, | ||
| 23 | .{ .arch = .armeb, .os = .linux, .abi = .gnueabi }, | 21 | .{ .arch = .armeb, .os = .linux, .abi = .gnueabi }, |
| 24 | .{ .arch = .armeb, .os = .linux, .abi = .gnueabihf }, | 22 | .{ .arch = .armeb, .os = .linux, .abi = .gnueabihf }, |
| 25 | .{ .arch = .armeb, .os = .linux, .abi = .musleabi }, | 23 | .{ .arch = .armeb, .os = .linux, .abi = .musleabi }, |
| ... | @@ -72,9 +70,7 @@ pub const available_libcs = [_]ArchOsAbi{ | ... | @@ -72,9 +70,7 @@ pub const available_libcs = [_]ArchOsAbi{ |
| 72 | .{ .arch = .x86_64, .os = .linux, .abi = .gnux32 }, | 70 | .{ .arch = .x86_64, .os = .linux, .abi = .gnux32 }, |
| 73 | .{ .arch = .x86_64, .os = .linux, .abi = .musl }, | 71 | .{ .arch = .x86_64, .os = .linux, .abi = .musl }, |
| 74 | .{ .arch = .x86_64, .os = .windows, .abi = .gnu }, | 72 | .{ .arch = .x86_64, .os = .windows, .abi = .gnu }, |
| 75 | .{ .arch = .x86_64, .os = .macos, .abi = .none, .os_ver = .{ .major = 11, .minor = 0, .patch = 0 } }, | 73 | .{ .arch = .x86_64, .os = .macos, .abi = .none, .os_ver = .{ .major = 10, .minor = 7, .patch = 0 } }, |
| 76 | .{ .arch = .x86_64, .os = .macos, .abi = .none, .os_ver = .{ .major = 12, .minor = 0, .patch = 0 } }, | ||
| 77 | .{ .arch = .x86_64, .os = .macos, .abi = .none, .os_ver = .{ .major = 13, .minor = 0, .patch = 0 } }, | ||
| 78 | }; | 74 | }; |
| 79 | 75 | ||
| 80 | pub fn libCGenericName(target: std.Target) [:0]const u8 { | 76 | pub fn libCGenericName(target: std.Target) [:0]const u8 { |
| ... | @@ -153,7 +149,7 @@ pub fn canBuildLibC(target: std.Target) bool { | ... | @@ -153,7 +149,7 @@ pub fn canBuildLibC(target: std.Target) bool { |
| 153 | if (target.cpu.arch == libc.arch and target.os.tag == libc.os and target.abi == libc.abi) { | 149 | if (target.cpu.arch == libc.arch and target.os.tag == libc.os and target.abi == libc.abi) { |
| 154 | if (target.os.tag == .macos) { | 150 | if (target.os.tag == .macos) { |
| 155 | const ver = target.os.version_range.semver; | 151 | const ver = target.os.version_range.semver; |
| 156 | if (ver.min.major != libc.os_ver.?.major) continue; // no match, keep going | 152 | return ver.min.order(libc.os_ver.?) != .lt; |
| 157 | } | 153 | } |
| 158 | return true; | 154 | return true; |
| 159 | } | 155 | } |