| author | |
| committer | |
| log | 1264469a41e89e72635c3b60b4cd3dca17876964 |
| tree | faf1a8ae1dc20b72abd562d101684c1151732662 |
| parent | 54865e0483bf02bc1ace9f06c00071fce32534cc |
4 files changed, 14 insertions(+), 14 deletions(-)
lib/std/zig/LibCInstallation.zig+2-2| ... | @@ -177,9 +177,9 @@ pub fn findNative(gpa: Allocator, io: Io, args: FindNativeOptions) FindError!Lib | ... | @@ -177,9 +177,9 @@ pub fn findNative(gpa: Allocator, io: Io, args: FindNativeOptions) FindError!Lib |
| 177 | var self: LibCInstallation = .{}; | 177 | var self: LibCInstallation = .{}; |
| 178 | 178 | ||
| 179 | if (is_darwin and args.target.os.tag.isDarwin()) { | 179 | if (is_darwin and args.target.os.tag.isDarwin()) { |
| 180 | if (!std.zig.system.darwin.isSdkInstalled(gpa)) | 180 | if (!std.zig.system.darwin.isSdkInstalled(gpa, io)) |
| 181 | return error.DarwinSdkNotFound; | 181 | return error.DarwinSdkNotFound; |
| 182 | const sdk = std.zig.system.darwin.getSdk(gpa, args.target) orelse | 182 | const sdk = std.zig.system.darwin.getSdk(gpa, io, args.target) orelse |
| 183 | return error.DarwinSdkNotFound; | 183 | return error.DarwinSdkNotFound; |
| 184 | defer gpa.free(sdk); | 184 | defer gpa.free(sdk); |
| 185 | 185 |
lib/std/zig/system/NativePaths.zig+7-6| ... | @@ -1,11 +1,12 @@ | ... | @@ -1,11 +1,12 @@ |
| 1 | const std = @import("../../std.zig"); | 1 | const NativePaths = @This(); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | |||
| 4 | const std = @import("../../std.zig"); | ||
| 5 | const Io = std.Io; | ||
| 3 | const Allocator = std.mem.Allocator; | 6 | const Allocator = std.mem.Allocator; |
| 4 | const process = std.process; | 7 | const process = std.process; |
| 5 | const mem = std.mem; | 8 | const mem = std.mem; |
| 6 | 9 | ||
| 7 | const NativePaths = @This(); | ||
| 8 | |||
| 9 | arena: Allocator, | 10 | arena: Allocator, |
| 10 | include_dirs: std.ArrayList([]const u8) = .empty, | 11 | include_dirs: std.ArrayList([]const u8) = .empty, |
| 11 | lib_dirs: std.ArrayList([]const u8) = .empty, | 12 | lib_dirs: std.ArrayList([]const u8) = .empty, |
| ... | @@ -13,7 +14,7 @@ framework_dirs: std.ArrayList([]const u8) = .empty, | ... | @@ -13,7 +14,7 @@ framework_dirs: std.ArrayList([]const u8) = .empty, |
| 13 | rpaths: std.ArrayList([]const u8) = .empty, | 14 | rpaths: std.ArrayList([]const u8) = .empty, |
| 14 | warnings: std.ArrayList([]const u8) = .empty, | 15 | warnings: std.ArrayList([]const u8) = .empty, |
| 15 | 16 | ||
| 16 | pub fn detect(arena: Allocator, native_target: *const std.Target) !NativePaths { | 17 | pub fn detect(arena: Allocator, io: Io, native_target: *const std.Target) !NativePaths { |
| 17 | var self: NativePaths = .{ .arena = arena }; | 18 | var self: NativePaths = .{ .arena = arena }; |
| 18 | var is_nix = false; | 19 | var is_nix = false; |
| 19 | if (process.getEnvVarOwned(arena, "NIX_CFLAGS_COMPILE")) |nix_cflags_compile| { | 20 | if (process.getEnvVarOwned(arena, "NIX_CFLAGS_COMPILE")) |nix_cflags_compile| { |
| ... | @@ -115,8 +116,8 @@ pub fn detect(arena: Allocator, native_target: *const std.Target) !NativePaths { | ... | @@ -115,8 +116,8 @@ pub fn detect(arena: Allocator, native_target: *const std.Target) !NativePaths { |
| 115 | 116 | ||
| 116 | // TODO: consider also adding macports paths | 117 | // TODO: consider also adding macports paths |
| 117 | if (builtin.target.os.tag.isDarwin()) { | 118 | if (builtin.target.os.tag.isDarwin()) { |
| 118 | if (std.zig.system.darwin.isSdkInstalled(arena)) sdk: { | 119 | if (std.zig.system.darwin.isSdkInstalled(arena, io)) sdk: { |
| 119 | const sdk = std.zig.system.darwin.getSdk(arena, native_target) orelse break :sdk; | 120 | const sdk = std.zig.system.darwin.getSdk(arena, io, native_target) orelse break :sdk; |
| 120 | try self.addLibDir(try std.fs.path.join(arena, &.{ sdk, "usr/lib" })); | 121 | try self.addLibDir(try std.fs.path.join(arena, &.{ sdk, "usr/lib" })); |
| 121 | try self.addFrameworkDir(try std.fs.path.join(arena, &.{ sdk, "System/Library/Frameworks" })); | 122 | try self.addFrameworkDir(try std.fs.path.join(arena, &.{ sdk, "System/Library/Frameworks" })); |
| 122 | try self.addIncludeDir(try std.fs.path.join(arena, &.{ sdk, "usr/include" })); | 123 | try self.addIncludeDir(try std.fs.path.join(arena, &.{ sdk, "usr/include" })); |
src/link/MachO.zig+3-3| ... | @@ -617,7 +617,7 @@ pub fn flush( | ... | @@ -617,7 +617,7 @@ pub fn flush( |
| 617 | else => |e| return diags.fail("failed to write code signature: {s}", .{@errorName(e)}), | 617 | else => |e| return diags.fail("failed to write code signature: {s}", .{@errorName(e)}), |
| 618 | }; | 618 | }; |
| 619 | const emit = self.base.emit; | 619 | const emit = self.base.emit; |
| 620 | invalidateKernelCache(emit.root_dir.handle, emit.sub_path) catch |err| switch (err) { | 620 | invalidateKernelCache(io, emit.root_dir.handle, emit.sub_path) catch |err| switch (err) { |
| 621 | else => |e| return diags.fail("failed to invalidate kernel cache: {t}", .{e}), | 621 | else => |e| return diags.fail("failed to invalidate kernel cache: {t}", .{e}), |
| 622 | }; | 622 | }; |
| 623 | } | 623 | } |
| ... | @@ -3621,11 +3621,11 @@ pub fn getTarget(self: *const MachO) *const std.Target { | ... | @@ -3621,11 +3621,11 @@ pub fn getTarget(self: *const MachO) *const std.Target { |
| 3621 | /// into a new inode, remove the original file, and rename the copy to match | 3621 | /// into a new inode, remove the original file, and rename the copy to match |
| 3622 | /// the original file. This is super messy, but there doesn't seem any other | 3622 | /// the original file. This is super messy, but there doesn't seem any other |
| 3623 | /// way to please the XNU. | 3623 | /// way to please the XNU. |
| 3624 | pub fn invalidateKernelCache(dir: Io.Dir, sub_path: []const u8) !void { | 3624 | pub fn invalidateKernelCache(io: Io, dir: Io.Dir, sub_path: []const u8) !void { |
| 3625 | const tracy = trace(@src()); | 3625 | const tracy = trace(@src()); |
| 3626 | defer tracy.end(); | 3626 | defer tracy.end(); |
| 3627 | if (builtin.target.os.tag.isDarwin() and builtin.target.cpu.arch == .aarch64) { | 3627 | if (builtin.target.os.tag.isDarwin() and builtin.target.cpu.arch == .aarch64) { |
| 3628 | try dir.copyFile(sub_path, dir, sub_path, .{}); | 3628 | try dir.copyFile(sub_path, dir, sub_path, io, .{}); |
| 3629 | } | 3629 | } |
| 3630 | } | 3630 | } |
| 3631 | 3631 |
src/main.zig+2-3| ... | @@ -3985,9 +3985,8 @@ fn createModule( | ... | @@ -3985,9 +3985,8 @@ fn createModule( |
| 3985 | resolved_target.is_native_os and resolved_target.is_native_abi and | 3985 | resolved_target.is_native_os and resolved_target.is_native_abi and |
| 3986 | create_module.want_native_include_dirs) | 3986 | create_module.want_native_include_dirs) |
| 3987 | { | 3987 | { |
| 3988 | var paths = std.zig.system.NativePaths.detect(arena, target) catch |err| { | 3988 | var paths = std.zig.system.NativePaths.detect(arena, io, target) catch |err| |
| 3989 | fatal("unable to detect native system paths: {s}", .{@errorName(err)}); | 3989 | fatal("unable to detect native system paths: {t}", .{err}); |
| 3990 | }; | ||
| 3991 | for (paths.warnings.items) |warning| { | 3990 | for (paths.warnings.items) |warning| { |
| 3992 | warn("{s}", .{warning}); | 3991 | warn("{s}", .{warning}); |
| 3993 | } | 3992 | } |