From a8a42c8658e82ed2fd55f7592d6b87bda02b1665 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 7 Jan 2024 12:10:48 -0800 Subject: [PATCH] fix macos `zig build test` failures --- build.zig | 18 +++++++++--------- src/build/LibtoolStep.zig | 12 ++++++------ src/build/LipoStep.zig | 16 ++++++++-------- src/build/XCFrameworkStep.zig | 14 +++++++------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/build.zig b/build.zig index bbe1796fe..44c374662 100644 --- a/build.zig +++ b/build.zig @@ -445,21 +445,21 @@ pub fn build(b: *std.Build) !void { } // On Mac we can build the embedding library. - if (builtin.target.isDarwin() and target.isDarwin()) { + if (builtin.target.isDarwin() and target.result.isDarwin()) { const static_lib_aarch64 = lib: { const lib = b.addStaticLibrary(.{ .name = "ghostty", .root_source_file = .{ .path = "src/main_c.zig" }, - .target = .{ + .target = b.resolveTargetQuery(.{ .cpu_arch = .aarch64, .os_tag = .macos, - .os_version_min = target.os_version_min, - }, + .os_version_min = target.query.os_version_min, + }), .optimize = optimize, }); lib.bundle_compiler_rt = true; lib.linkLibC(); - lib.addOptions("build_options", exe_options); + lib.root_module.addOptions("build_options", exe_options); // Create a single static lib with all our dependencies merged var lib_list = try addDeps(b, lib, true); @@ -479,16 +479,16 @@ pub fn build(b: *std.Build) !void { const lib = b.addStaticLibrary(.{ .name = "ghostty", .root_source_file = .{ .path = "src/main_c.zig" }, - .target = .{ + .target = b.resolveTargetQuery(.{ .cpu_arch = .x86_64, .os_tag = .macos, - .os_version_min = target.os_version_min, - }, + .os_version_min = target.query.os_version_min, + }), .optimize = optimize, }); lib.bundle_compiler_rt = true; lib.linkLibC(); - lib.addOptions("build_options", exe_options); + lib.root_module.addOptions("build_options", exe_options); // Create a single static lib with all our dependencies merged var lib_list = try addDeps(b, lib, true); diff --git a/src/build/LibtoolStep.zig b/src/build/LibtoolStep.zig index adb2e77a2..d2b514927 100644 --- a/src/build/LibtoolStep.zig +++ b/src/build/LibtoolStep.zig @@ -3,9 +3,9 @@ const LibtoolStep = @This(); const std = @import("std"); -const Step = std.build.Step; -const RunStep = std.build.RunStep; -const FileSource = std.build.FileSource; +const Step = std.Build.Step; +const RunStep = std.Build.Step.Run; +const LazyPath = std.Build.LazyPath; pub const Options = struct { /// The name of this step. @@ -16,14 +16,14 @@ pub const Options = struct { out_name: []const u8, /// Library files (.a) to combine. - sources: []FileSource, + sources: []LazyPath, }; /// The step to depend on. step: *Step, /// The output file from the libtool run. -output: FileSource, +output: LazyPath, /// Run libtool against a list of library files to combine into a single /// static library. @@ -33,7 +33,7 @@ pub fn create(b: *std.Build, opts: Options) *LibtoolStep { const run_step = RunStep.create(b, b.fmt("libtool {s}", .{opts.name})); run_step.addArgs(&.{ "libtool", "-static", "-o" }); const output = run_step.addOutputFileArg(opts.out_name); - for (opts.sources) |source| run_step.addFileSourceArg(source); + for (opts.sources) |source| run_step.addFileArg(source); self.* = .{ .step = &run_step.step, diff --git a/src/build/LipoStep.zig b/src/build/LipoStep.zig index 49187f307..c9c1530ef 100644 --- a/src/build/LipoStep.zig +++ b/src/build/LipoStep.zig @@ -3,9 +3,9 @@ const LipoStep = @This(); const std = @import("std"); -const Step = std.build.Step; -const RunStep = std.build.RunStep; -const FileSource = std.build.FileSource; +const Step = std.Build.Step; +const RunStep = std.Build.Step.Run; +const LazyPath = std.Build.LazyPath; pub const Options = struct { /// The name of the xcframework to create. @@ -15,14 +15,14 @@ pub const Options = struct { out_name: []const u8, /// Library file (dylib, a) to package. - input_a: FileSource, - input_b: FileSource, + input_a: LazyPath, + input_b: LazyPath, }; step: *Step, /// Resulting binary -output: FileSource, +output: LazyPath, pub fn create(b: *std.Build, opts: Options) *LipoStep { const self = b.allocator.create(LipoStep) catch @panic("OOM"); @@ -30,8 +30,8 @@ pub fn create(b: *std.Build, opts: Options) *LipoStep { const run_step = RunStep.create(b, b.fmt("lipo {s}", .{opts.name})); run_step.addArgs(&.{ "lipo", "-create", "-output" }); const output = run_step.addOutputFileArg(opts.out_name); - run_step.addFileSourceArg(opts.input_a); - run_step.addFileSourceArg(opts.input_b); + run_step.addFileArg(opts.input_a); + run_step.addFileArg(opts.input_b); self.* = .{ .step = &run_step.step, diff --git a/src/build/XCFrameworkStep.zig b/src/build/XCFrameworkStep.zig index 36fdbebc6..a611edc4b 100644 --- a/src/build/XCFrameworkStep.zig +++ b/src/build/XCFrameworkStep.zig @@ -4,9 +4,9 @@ const XCFrameworkStep = @This(); const std = @import("std"); -const Step = std.build.Step; -const RunStep = std.build.RunStep; -const FileSource = std.build.FileSource; +const Step = std.Build.Step; +const RunStep = std.Build.Step.Run; +const LazyPath = std.Build.LazyPath; pub const Options = struct { /// The name of the xcframework to create. @@ -16,10 +16,10 @@ pub const Options = struct { out_path: []const u8, /// Library file (dylib, a) to package. - library: std.build.FileSource, + library: LazyPath, /// Path to a directory with the headers. - headers: std.build.FileSource, + headers: LazyPath, }; step: *Step, @@ -42,9 +42,9 @@ pub fn create(b: *std.Build, opts: Options) *XCFrameworkStep { run.has_side_effects = true; run.addArgs(&.{ "xcodebuild", "-create-xcframework" }); run.addArg("-library"); - run.addFileSourceArg(opts.library); + run.addFileArg(opts.library); run.addArg("-headers"); - run.addFileSourceArg(opts.headers); + run.addFileArg(opts.headers); run.addArg("-output"); run.addArg(opts.out_path); break :run run;