diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-11-26 16:08:44 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2021-11-26 16:26:44 +0100 |
| commit | 8317dbd1cb32eaeafa509e7142766f3d9a82de5f (patch) | |
| tree | 780a0c6d17d3b10b22a3cce70543240a4900d13e /src/main.zig | |
| parent | 02d8ca71f98800df08754ce3d2d2e39541178f64 (diff) | |
| download | zig-8317dbd1cb32eaeafa509e7142766f3d9a82de5f.tar.gz zig-8317dbd1cb32eaeafa509e7142766f3d9a82de5f.zip | |
macos: detect SDK path and version, then pass to the linker
Since we are already detecting the path to the native SDK,
if available, also fetch SDK's version and route that to the linker.
The linker can then use it to correctly populate LC_BUILD_VERSION
load command.
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig index 3c291048d6..ee1bd324d5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -663,7 +663,7 @@ fn buildOutputType( var minor_subsystem_version: ?u32 = null; var wasi_exec_model: ?std.builtin.WasiExecModel = null; var enable_link_snapshots: bool = false; - var native_macos_sdk_path: ?[]const u8 = null; + var native_darwin_sdk: ?std.zig.system.darwin.DarwinSDK = null; var system_libs = std.StringArrayHashMap(Compilation.SystemLib).init(gpa); defer system_libs.deinit(); @@ -1858,11 +1858,11 @@ fn buildOutputType( } const has_sysroot = if (comptime builtin.target.isDarwin()) outer: { - if (try std.zig.system.darwin.getSDKPath(arena, target_info.target)) |sdk_path| { - native_macos_sdk_path = sdk_path; + if (try std.zig.system.darwin.getDarwinSDK(arena, target_info.target)) |sdk| { + native_darwin_sdk = sdk; try clang_argv.ensureUnusedCapacity(2); clang_argv.appendAssumeCapacity("-isysroot"); - clang_argv.appendAssumeCapacity(sdk_path); + clang_argv.appendAssumeCapacity(sdk.path); break :outer true; } else break :outer false; } else false; @@ -2342,7 +2342,7 @@ fn buildOutputType( .wasi_exec_model = wasi_exec_model, .debug_compile_errors = debug_compile_errors, .enable_link_snapshots = enable_link_snapshots, - .native_macos_sdk_path = native_macos_sdk_path, + .native_darwin_sdk = native_darwin_sdk, }) catch |err| { fatal("unable to create compilation: {s}", .{@errorName(err)}); }; |
