build: fix libghostty shared lib install for Windows

On Windows, install as ghostty.dll + ghostty-static.lib instead of
libghostty.so + libghostty.a, following Windows naming conventions.
Guard ubsan_rt bundling in initStatic for MSVC compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alessandro De Blasis
2026-03-25 06:21:15 +01:00
parent 26ba9bf579
commit c5bb97bcbd
2 changed files with 13 additions and 2 deletions

View File

@@ -152,8 +152,13 @@ pub fn build(b: *std.Build) !void {
// build on macOS this way ironically so we need to fix that.
if (!config.target.result.os.tag.isDarwin()) {
lib_shared.installHeader(); // Only need one header
lib_shared.install("libghostty.so");
lib_static.install("libghostty.a");
if (config.target.result.os.tag == .windows) {
lib_shared.install("ghostty.dll");
lib_static.install("ghostty-static.lib");
} else {
lib_shared.install("libghostty.so");
lib_static.install("libghostty.a");
}
}
}

View File

@@ -39,6 +39,12 @@ pub fn initStatic(
lib.bundle_compiler_rt = true;
lib.bundle_ubsan_rt = true;
if (deps.config.target.result.os.tag == .windows) {
// Zig's ubsan emits /exclude-symbols linker directives that
// are incompatible with the MSVC linker (LNK4229).
lib.bundle_ubsan_rt = false;
}
// Add our dependencies. Get the list of all static deps so we can
// build a combined archive if necessary.
var lib_list = try deps.add(lib);