Commit e4b8148e9c
Changed files (2)
lib
std
zig
src
lib/std/zig/system.zig
@@ -15,8 +15,6 @@ const Target = std.Target;
const CrossTarget = std.zig.CrossTarget;
const macos = @import("system/macos.zig");
-const is_windows = Target.current.os.tag == .windows;
-
pub const getSDKPath = macos.getSDKPath;
pub const NativePaths = struct {
@@ -26,7 +24,9 @@ pub const NativePaths = struct {
rpaths: ArrayList([:0]u8),
warnings: ArrayList([:0]u8),
- pub fn detect(allocator: *Allocator) !NativePaths {
+ pub fn detect(allocator: *Allocator, native_info: NativeTargetInfo) !NativePaths {
+ const native_target = native_info.target;
+
var self: NativePaths = .{
.include_dirs = ArrayList([:0]u8).init(allocator),
.lib_dirs = ArrayList([:0]u8).init(allocator),
@@ -103,9 +103,9 @@ pub const NativePaths = struct {
return self;
}
- if (!is_windows) {
- const triple = try Target.current.linuxTriple(allocator);
- const qual = Target.current.cpu.arch.ptrBitWidth();
+ if (native_target.os.tag != .windows) {
+ const triple = try native_target.linuxTriple(allocator);
+ const qual = native_target.cpu.arch.ptrBitWidth();
// TODO: $ ld --verbose | grep SEARCH_DIR
// the output contains some paths that end with lib64, maybe include them too?
src/main.zig
@@ -1448,7 +1448,7 @@ fn buildOutputType(
}
if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
- const paths = std.zig.system.NativePaths.detect(arena) catch |err| {
+ const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
fatal("unable to detect native system paths: {s}", .{@errorName(err)});
};
for (paths.warnings.items) |warning| {