Skip to content

Commit

Permalink
macOS: depend on bundled headers even for native
Browse files Browse the repository at this point in the history
This is an alternate fix for #6773. Reverts
872bc78.
  • Loading branch information
andrewrk committed Nov 9, 2020
1 parent 4236518 commit 9a3e726
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2148,8 +2148,6 @@ fn detectLibCIncludeDirs(
}

if (target_util.canBuildLibC(target)) outer: {
if (is_native_os and target.isDarwin()) break :outer; // If we're on Darwin, we want to use native since we only have headers.

const generic_name = target_util.libCGenericName(target);
// Some architectures are handled by the same set of headers.
const arch_name = if (target.abi.isMusl()) target_util.archMuslName(target.cpu.arch) else @tagName(target.cpu.arch);
Expand Down
7 changes: 5 additions & 2 deletions src/target.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ pub const available_libcs = [_]ArchOsAbi{
};

pub fn libCGenericName(target: std.Target) [:0]const u8 {
if (target.os.tag == .windows)
return "mingw";
switch (target.os.tag) {
.windows => return "mingw",
.macos, .ios, .tvos, .watchos => return "darwin",
else => {},
}
switch (target.abi) {
.gnu,
.gnuabin32,
Expand Down

0 comments on commit 9a3e726

Please sign in to comment.