update to latest build API, rebase

This commit is contained in:
Mitchell Hashimoto
2023-02-14 21:18:17 -08:00
parent 2b3531378f
commit 1f9d4eb9f4
3 changed files with 22 additions and 14 deletions

View File

@ -138,10 +138,13 @@ pub fn build(b: *std.build.Builder) !void {
const macapp = b.step("macapp", "Build macOS app using XCode.");
if (builtin.target.isDarwin()) {
const static_lib_aarch64 = lib: {
const lib = b.addStaticLibrary("ghostty", "src/main_c.zig");
const lib = b.addStaticLibrary(.{
.name = "ghostty",
.root_source_file = .{ .path = "src/main_c.zig" },
.target = try std.zig.CrossTarget.parse(.{ .arch_os_abi = "aarch64-macos" }),
.optimize = optimize,
});
lib.bundle_compiler_rt = true;
lib.setBuildMode(mode);
lib.setTarget(try std.zig.CrossTarget.parse(.{ .arch_os_abi = "aarch64-macos" }));
lib.linkLibC();
lib.addOptions("build_options", exe_options);
b.default_step.dependOn(&lib.step);
@ -160,10 +163,13 @@ pub fn build(b: *std.build.Builder) !void {
};
const static_lib_x86_64 = lib: {
const lib = b.addStaticLibrary("ghostty", "src/main_c.zig");
const lib = b.addStaticLibrary(.{
.name = "ghostty",
.root_source_file = .{ .path = "src/main_c.zig" },
.target = try std.zig.CrossTarget.parse(.{ .arch_os_abi = "x86_64-macos" }),
.optimize = optimize,
});
lib.bundle_compiler_rt = true;
lib.setBuildMode(mode);
lib.setTarget(try std.zig.CrossTarget.parse(.{ .arch_os_abi = "x86_64-macos" }));
lib.linkLibC();
lib.addOptions("build_options", exe_options);
b.default_step.dependOn(&lib.step);

View File

@ -20,7 +20,7 @@ pub const Options = struct {
};
step: Step,
builder: *std.build.Builder,
builder: *std.Build,
/// Resulting binary
out_path: GeneratedFile,
@ -30,7 +30,7 @@ name: []const u8,
out_name: []const u8,
sources: []FileSource,
pub fn create(builder: *std.build.Builder, opts: Options) *LibtoolStep {
pub fn create(builder: *std.Build, opts: Options) *LibtoolStep {
const self = builder.allocator.create(LibtoolStep) catch @panic("OOM");
self.* = .{
.step = Step.init(.custom, builder.fmt("lipo {s}", .{opts.name}), builder.allocator, make),
@ -48,9 +48,10 @@ fn make(step: *Step) !void {
// TODO: use the zig cache system when it is in the stdlib
// https://github.com/ziglang/zig/pull/14571
const output_path = self.builder.pathJoin(&.{
self.builder.cache_root, self.out_name,
});
const output_path = try self.builder.cache_root.join(
self.builder.allocator,
&.{self.out_name},
);
// We use a RunStep here to ease our configuration.
{

View File

@ -50,9 +50,10 @@ fn make(step: *Step) !void {
// TODO: use the zig cache system when it is in the stdlib
// https://github.com/ziglang/zig/pull/14571
const output_path = self.builder.pathJoin(&.{
self.builder.cache_root, self.out_name,
});
const output_path = try self.builder.cache_root.join(
self.builder.allocator,
&.{self.out_name},
);
// We use a RunStep here to ease our configuration.
{