summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorMitchell Hashimoto <m@mitchellh.com>2024-12-27 12:09:37 -0800
committerGitHub <noreply@github.com>2024-12-27 12:09:37 -0800
commit8111f5b9958c21e0157f63cc4ce2dfc2329c67ac (patch)
tree63fd821d802c9b1b71120112014477859604e8c1 /build.zig
parent590c2929e71977e4b2f2d0c4bf81fc0d0fdd6347 (diff)
parent2114e0a613a2e786f82430804e9d2ad0d05a6a45 (diff)
Fix `DESTDIR` handling for terminfo installation (#3426)
## Description: Fix `DESTDIR` handling when installing terminfo database files by using `install_path` instead of `install_prefix`. This ensures files are correctly installed under `$DESTDIR/$prefix` during packaging. ## Changes: - Replace `b.install_prefix` with `b.install_path` for terminfo database installation paths - This change properly respects the `DESTDIR` environment variable during installation ## Testing: I've verified this fix by: 1. Setting `DESTDIR=/tmp/ghostty` 2. Building with: ```bash DESTDIR=/tmp/ghostty \ zig build \ --prefix /usr \ --system /tmp/offline-cache/p \ -Doptimize=ReleaseFast \ -Dcpu=baseline ``` 3. Confirming files are correctly installed to: ``` /tmp/ghostty/usr/share/terminfo/ghostty.terminfo /tmp/ghostty/usr/share/terminfo/ghostty.termcap ``` The files are now properly installed under `$DESTDIR/$prefix` path structure as expected. cc @BratishkaErik - Since you suggested this fix in #3152, would you mind reviewing this implementation? Fixes #3152
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index 73a961b10..0e183efd1 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(&copy_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(&copy_step.step);
}