build: copy the terminfo db using cp so we get symlinks

This commit is contained in:
Mitchell Hashimoto
2023-06-24 12:40:12 -07:00
parent b2cd2e06de
commit d9421b87b0

View File

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