build: fix race conditions, use actual filesource

This commit is contained in:
Mitchell Hashimoto
2023-06-24 14:24:58 -07:00
parent d9421b87b0
commit 7e51dbb7e5
2 changed files with 16 additions and 22 deletions

View File

@ -318,34 +318,28 @@ pub fn build(b: *std.Build) !void {
// Compile the terminfo source into a terminfo database
{
// Hardcoded until: https://github.com/ziglang/zig/issues/16187
const path = "zig-cache/tmp/terminfo";
const run_step = RunStep.create(b, "tic");
run_step.addArgs(&.{ "tic", "-x", "-o", path });
run_step.addArgs(&.{ "tic", "-x", "-o" });
const path = run_step.addOutputFileArg("terminfo");
run_step.addFileSourceArg(src_source);
_ = run_step.captureStdErr(); // so we don't see stderr
{
const copy_step = RunStep.create(b, "copy terminfo db");
copy_step.step.dependOn(&run_step.step);
copy_step.addArgs(&.{
"cp",
"-R",
path,
b.fmt("{s}/share", .{b.install_prefix}),
});
copy_step.addArgs(&.{ "cp", "-R" });
copy_step.addFileSourceArg(path);
copy_step.addArg(b.fmt("{s}/share", .{b.install_prefix}));
b.getInstallStep().dependOn(&copy_step.step);
}
if (target.isDarwin()) {
const mac_copy_step = RunStep.create(b, "copy terminfo db");
mac_copy_step.step.dependOn(&run_step.step);
mac_copy_step.addArgs(&.{
"cp",
"-R",
path,
const copy_step = RunStep.create(b, "copy terminfo db");
copy_step.addArgs(&.{ "cp", "-R" });
copy_step.addFileSourceArg(path);
copy_step.addArg(
b.fmt("{s}/Ghostty.app/Contents/Resources", .{b.install_prefix}),
});
b.getInstallStep().dependOn(&mac_copy_step.step);
);
b.getInstallStep().dependOn(&copy_step.step);
}
}
}

View File

@ -101,7 +101,7 @@ pub const ghostty: Source = .{
.{ .name = "cbt", .value = .{ .string = "\\E[Z" } },
.{ .name = "civis", .value = .{ .string = "\\E[?25l" } },
.{ .name = "clear", .value = .{ .string = "\\E[H\\E[2J" } },
.{ .name = "cnorm", .value = .{ .string = "\\E[?25h" } },
.{ .name = "cnorm", .value = .{ .string = "\\E[?12l\\E[?25h" } },
.{ .name = "cr", .value = .{ .string = "\\r" } },
.{ .name = "csr", .value = .{ .string = "\\E[%i%p1%d;%p2%dr" } },
.{ .name = "cub", .value = .{ .string = "\\E[%p1%dD" } },