From 2114e0a613a2e786f82430804e9d2ad0d05a6a45 Mon Sep 17 00:00:00 2001 From: Bryan Lee <38807139+liby@users.noreply.github.com> Date: Fri, 27 Dec 2024 22:56:44 +0800 Subject: [PATCH] Fix `DESTDIR` handling for terminfo installation Use `install_path` instead of `install_prefix` when installing terminfo database files to properly respect the `DESTDIR` environment variable. This ensures files are correctly installed under `$DESTDIR/$prefix` when packaging. Fixes #3152 --- build.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index b1b992fe7a..9ee0933c79 100644 --- a/build.zig +++ b/build.zig @@ -481,19 +481,25 @@ pub fn build(b: *std.Build) !void { run_step.step.dependOn(&src_install.step); { + // Use cp -R instead of Step.InstallDir because we need to preserve + // symlinks in the terminfo database. Zig's InstallDir step doesn't + // handle symlinks correctly yet. const copy_step = RunStep.create(b, "copy terminfo db"); copy_step.addArgs(&.{ "cp", "-R" }); copy_step.addFileArg(path); - copy_step.addArg(b.fmt("{s}/share", .{b.install_prefix})); + copy_step.addArg(b.fmt("{s}/share", .{b.install_path})); b.getInstallStep().dependOn(©_step.step); } if (target.result.os.tag == .macos and exe_ != null) { + // Use cp -R instead of Step.InstallDir because we need to preserve + // symlinks in the terminfo database. Zig's InstallDir step doesn't + // handle symlinks correctly yet. const copy_step = RunStep.create(b, "copy terminfo db"); copy_step.addArgs(&.{ "cp", "-R" }); copy_step.addFileArg(path); copy_step.addArg( - b.fmt("{s}/Ghostty.app/Contents/Resources", .{b.install_prefix}), + b.fmt("{s}/Ghostty.app/Contents/Resources", .{b.install_path}), ); b.getInstallStep().dependOn(©_step.step); }