| author | |
| committer | |
| log | e582a3642bb001a7a19ecb72b128f45ab7fc08aa |
| tree | 81b880b895b220fd14e21756e59956ff8d9b6ffd |
| parent | da91ef5c28bd11823bd84b6f54df9ca601f03e21 |
5 files changed, 10 insertions(+), 13 deletions(-)
lib/std/zig/system/NativePaths.zig+2-2| ... | @@ -79,8 +79,8 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths { | ... | @@ -79,8 +79,8 @@ pub fn detect(arena: Allocator, native_info: NativeTargetInfo) !NativePaths { |
| 79 | // TODO: consider also adding homebrew paths | 79 | // TODO: consider also adding homebrew paths |
| 80 | // TODO: consider also adding macports paths | 80 | // TODO: consider also adding macports paths |
| 81 | if (comptime builtin.target.isDarwin()) { | 81 | if (comptime builtin.target.isDarwin()) { |
| 82 | if (std.zig.system.darwin.isDarwinSDKInstalled(arena)) sdk: { | 82 | if (std.zig.system.darwin.isSdkInstalled(arena)) sdk: { |
| 83 | const sdk = std.zig.system.darwin.getDarwinSDK(arena, native_target) orelse break :sdk; | 83 | const sdk = std.zig.system.darwin.getSdk(arena, native_target) orelse break :sdk; |
| 84 | try self.addLibDir(try std.fs.path.join(arena, &.{ sdk.path, "usr/lib" })); | 84 | try self.addLibDir(try std.fs.path.join(arena, &.{ sdk.path, "usr/lib" })); |
| 85 | try self.addFrameworkDir(try std.fs.path.join(arena, &.{ sdk.path, "System/Library/Frameworks" })); | 85 | try self.addFrameworkDir(try std.fs.path.join(arena, &.{ sdk.path, "System/Library/Frameworks" })); |
| 86 | try self.addIncludeDir(try std.fs.path.join(arena, &.{ sdk.path, "usr/include" })); | 86 | try self.addIncludeDir(try std.fs.path.join(arena, &.{ sdk.path, "usr/include" })); |
lib/std/zig/system/darwin.zig+5-5| ... | @@ -11,7 +11,7 @@ pub const macos = @import("darwin/macos.zig"); | ... | @@ -11,7 +11,7 @@ pub const macos = @import("darwin/macos.zig"); |
| 11 | /// Therefore, we resort to the same tool used by Homebrew, namely, invoking `xcode-select --print-path` | 11 | /// Therefore, we resort to the same tool used by Homebrew, namely, invoking `xcode-select --print-path` |
| 12 | /// and checking if the status is nonzero or the returned string in nonempty. | 12 | /// and checking if the status is nonzero or the returned string in nonempty. |
| 13 | /// https://github.com/Homebrew/brew/blob/e119bdc571dcb000305411bc1e26678b132afb98/Library/Homebrew/brew.sh#L630 | 13 | /// https://github.com/Homebrew/brew/blob/e119bdc571dcb000305411bc1e26678b132afb98/Library/Homebrew/brew.sh#L630 |
| 14 | pub fn isDarwinSDKInstalled(allocator: Allocator) bool { | 14 | pub fn isSdkInstalled(allocator: Allocator) bool { |
| 15 | const argv = &[_][]const u8{ "/usr/bin/xcode-select", "--print-path" }; | 15 | const argv = &[_][]const u8{ "/usr/bin/xcode-select", "--print-path" }; |
| 16 | const result = std.ChildProcess.exec(.{ .allocator = allocator, .argv = argv }) catch return false; | 16 | const result = std.ChildProcess.exec(.{ .allocator = allocator, .argv = argv }) catch return false; |
| 17 | defer { | 17 | defer { |
| ... | @@ -29,7 +29,7 @@ pub fn isDarwinSDKInstalled(allocator: Allocator) bool { | ... | @@ -29,7 +29,7 @@ pub fn isDarwinSDKInstalled(allocator: Allocator) bool { |
| 29 | /// Calls `xcrun --sdk <target_sdk> --show-sdk-path` which fetches the path to the SDK sysroot (if any). | 29 | /// Calls `xcrun --sdk <target_sdk> --show-sdk-path` which fetches the path to the SDK sysroot (if any). |
| 30 | /// Subsequently calls `xcrun --sdk <target_sdk> --show-sdk-version` which fetches version of the SDK. | 30 | /// Subsequently calls `xcrun --sdk <target_sdk> --show-sdk-version` which fetches version of the SDK. |
| 31 | /// The caller needs to deinit the resulting struct. | 31 | /// The caller needs to deinit the resulting struct. |
| 32 | pub fn getDarwinSDK(allocator: Allocator, target: Target) ?DarwinSDK { | 32 | pub fn getSdk(allocator: Allocator, target: Target) ?Sdk { |
| 33 | const is_simulator_abi = target.abi == .simulator; | 33 | const is_simulator_abi = target.abi == .simulator; |
| 34 | const sdk = switch (target.os.tag) { | 34 | const sdk = switch (target.os.tag) { |
| 35 | .macos => "macosx", | 35 | .macos => "macosx", |
| ... | @@ -73,7 +73,7 @@ pub fn getDarwinSDK(allocator: Allocator, target: Target) ?DarwinSDK { | ... | @@ -73,7 +73,7 @@ pub fn getDarwinSDK(allocator: Allocator, target: Target) ?DarwinSDK { |
| 73 | }; | 73 | }; |
| 74 | break :version version; | 74 | break :version version; |
| 75 | }; | 75 | }; |
| 76 | return DarwinSDK{ | 76 | return Sdk{ |
| 77 | .path = path, | 77 | .path = path, |
| 78 | .version = version, | 78 | .version = version, |
| 79 | }; | 79 | }; |
| ... | @@ -96,11 +96,11 @@ fn parseSdkVersion(raw: []const u8) ?Version { | ... | @@ -96,11 +96,11 @@ fn parseSdkVersion(raw: []const u8) ?Version { |
| 96 | return Version.parse(buffer[0..len]) catch null; | 96 | return Version.parse(buffer[0..len]) catch null; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | pub const DarwinSDK = struct { | 99 | pub const Sdk = struct { |
| 100 | path: []const u8, | 100 | path: []const u8, |
| 101 | version: Version, | 101 | version: Version, |
| 102 | 102 | ||
| 103 | pub fn deinit(self: DarwinSDK, allocator: Allocator) void { | 103 | pub fn deinit(self: Sdk, allocator: Allocator) void { |
| 104 | allocator.free(self.path); | 104 | allocator.free(self.path); |
| 105 | } | 105 | } |
| 106 | }; | 106 | }; |
src/libc_installation.zig+2-2| ... | @@ -183,9 +183,9 @@ pub const LibCInstallation = struct { | ... | @@ -183,9 +183,9 @@ pub const LibCInstallation = struct { |
| 183 | var self: LibCInstallation = .{}; | 183 | var self: LibCInstallation = .{}; |
| 184 | 184 | ||
| 185 | if (is_darwin) { | 185 | if (is_darwin) { |
| 186 | if (!std.zig.system.darwin.isDarwinSDKInstalled(args.allocator)) | 186 | if (!std.zig.system.darwin.isSdkInstalled(args.allocator)) |
| 187 | return error.DarwinSdkNotFound; | 187 | return error.DarwinSdkNotFound; |
| 188 | const sdk = std.zig.system.darwin.getDarwinSDK(args.allocator, args.target) orelse | 188 | const sdk = std.zig.system.darwin.getSdk(args.allocator, args.target) orelse |
| 189 | return error.DarwinSdkNotFound; | 189 | return error.DarwinSdkNotFound; |
| 190 | defer args.allocator.free(sdk.path); | 190 | defer args.allocator.free(sdk.path); |
| 191 | 191 |
src/main.zig-3| ... | @@ -2857,9 +2857,6 @@ fn buildOutputType( | ... | @@ -2857,9 +2857,6 @@ fn buildOutputType( |
| 2857 | std.log.err("unable to find {s} system library '{s}' using strategy '{s}'. searched paths:{s}", .{ | 2857 | std.log.err("unable to find {s} system library '{s}' using strategy '{s}'. searched paths:{s}", .{ |
| 2858 | @tagName(f.preferred_mode), f.name, @tagName(f.strategy), searched_paths, | 2858 | @tagName(f.preferred_mode), f.name, @tagName(f.strategy), searched_paths, |
| 2859 | }); | 2859 | }); |
| 2860 | if (f.preferred_mode == .Dynamic and f.strategy == .no_fallback) { | ||
| 2861 | std.log.info("to link statically, pass the library as a positional argument", .{}); | ||
| 2862 | } | ||
| 2863 | } | 2860 | } |
| 2864 | process.exit(1); | 2861 | process.exit(1); |
| 2865 | } | 2862 | } |
test/link/macho/bugs/13056/build.zig+1-1| ... | @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { |
| 16 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { | 16 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void { |
| 17 | const target: std.zig.CrossTarget = .{ .os_tag = .macos }; | 17 | const target: std.zig.CrossTarget = .{ .os_tag = .macos }; |
| 18 | const target_info = std.zig.system.NativeTargetInfo.detect(target) catch unreachable; | 18 | const target_info = std.zig.system.NativeTargetInfo.detect(target) catch unreachable; |
| 19 | const sdk = std.zig.system.darwin.getDarwinSDK(b.allocator, target_info.target) orelse | 19 | const sdk = std.zig.system.darwin.getSdk(b.allocator, target_info.target) orelse |
| 20 | @panic("macOS SDK is required to run the test"); | 20 | @panic("macOS SDK is required to run the test"); |
| 21 | 21 | ||
| 22 | const exe = b.addExecutable(.{ | 22 | const exe = b.addExecutable(.{ |