mirror-ghostty/src
Mitchell Hashimoto bc90a51282
build: fat static archive and ubsan fix for external linkers (#12217)
## Summary

> [!IMPORTANT]
> Stacked on #12214. Review that first. (i am targeting `main` so here
you will see the full changeset, including 12214

Two changes that make the static libghostty archive consumable by
external linkers (MSVC link.exe, .NET NativeAOT, Rust, Go, etc.):

**Fat static archive on all platforms**

The static archive previously only bundled vendored deps on macOS (via
libtool). On Windows and Linux the archive contained only the
Zig-compiled code, requiring consumers to find and link freetype,
harfbuzz, glslang, spirv-cross, simdutf, oniguruma, etc. separately.

Now all platforms produce a single fat archive:
- macOS: libtool (unchanged)
- Windows: zig ar qcL --format=coff (MSVC's lib.exe can't read
Zig-produced GNU-format archives, so we use the bundled LLVM archiver)
- Linux: ar -M with MRI scripts (same approach as libghostty-vt)

**MSVC ubsan suppression for C deps**

Zig's ubsan runtime can't be bundled on Windows (LNK4229), leaving
__ubsan_handle_* symbols unresolved. freetype, glslang, spirv-cross, and
highway already suppress ubsan. This adds MSVC-conditional suppression
to seven more: harfbuzz, libpng, dcimgui, wuffs, oniguruma, zlib, and
stb.

Gated on abi == .msvc so ubsan coverage is preserved on Linux/macOS.

## Test plan

- [x] zig build produces a fat ghostty-static.lib (~230MB) with ~200
object files
- [x] MSVC's lib /LIST can read the archive
- [x] .NET NativeAOT consumer resolves all symbols (0 unresolved)
- [x] Linux/macOS builds unaffected (ubsan remains enabled)
2026-04-23 09:33:05 -07:00
..
apprt macos: add pid and tty properties to AppleScript terminal class 2026-04-20 15:16:03 +02:00
benchmark libghostty: Remove all libc++ and libc++ ABI dependencies 2026-04-15 10:27:05 -07:00
build build: share combineArchives and fix internal archive names 2026-04-23 05:47:28 +02:00
cli cli: also recognize $GHOSTTY_PAGER 2026-03-30 10:53:53 -04:00
config macos: add pid and tty properties to AppleScript terminal class 2026-04-20 15:16:03 +02:00
crash Zig 0.15: zig build test macOS 2025-10-03 07:10:43 -07:00
datastruct split_tree: wrap spatial goto around edges 2026-02-17 20:35:25 -08:00
extra cli: add +explain-config 2026-03-15 20:58:43 -04:00
font font: handle CRLF line endings in octants.txt parsing 2026-03-27 06:11:20 -07:00
input decbkm: use if statements instead of named blocks 2026-04-12 15:40:55 -05:00
inspector terminal: make stream processing infallible 2026-03-13 13:56:14 -07:00
lib build: refactor checkGhosttyHEnum to use @hasDecl instead of nested inline for 2026-03-24 20:12:57 +01:00
os os: trim trailing path separators from tmpdir (#12397) 2026-04-23 12:03:36 -04:00
renderer libghostty: add placement pixel_size and grid_size, rename calculatedSize 2026-04-06 10:03:34 -07:00
shell-integration zsh: fix trailing '%' in PS1/PS2 combining with marks 2026-03-25 10:58:06 -04:00
simd libghostty: Remove all libc++ and libc++ ABI dependencies 2026-04-15 10:27:05 -07:00
stb Fix typos 2025-10-03 18:52:26 +02:00
synthetic benchmark: add AGENTS, improve UTF-8 synthetic data 2026-04-15 08:28:36 -07:00
terminal libghostty: expose the APC max byte limits 2026-04-20 08:57:51 -07:00
terminfo terminfo: add support for SGR dim 2026-03-03 09:48:48 +01:00
termio address review: add unit tests for Windows execCommand paths 2026-04-23 23:08:58 +09:00
unicode Merge remote-tracking branch 'upstream/main' into grapheme-width-changes 2026-01-27 09:44:55 -05:00
App.zig core: add 64 bit unique ID to every core surface 2026-03-31 13:13:05 -05:00
Command.zig Command: let CreateProcessW resolve the program via PATH 2026-04-23 14:40:13 +09:00
Surface.zig core/gtk: ensure that first surface gets marked as focused surface by app 2026-03-31 14:57:41 -05:00
apprt.zig Remove unused imports 2025-11-27 13:37:53 -08:00
build_config.zig Remove unused imports 2025-11-27 13:37:53 -08:00
cli.zig cli: make the action parser (+foo) generic and reusable 2025-07-09 15:06:24 -07:00
config.zig config: move file formatter to dedicated file to prevent import bloat 2026-03-23 09:11:23 -07:00
fastmem.zig perf: replace `std.debug.assert` with inlined version 2025-11-17 12:13:56 -07:00
file_type.zig
global.zig logging: document GHOSTTY_LOG and make it more flexible 2025-12-15 11:54:36 -08:00
helpgen.zig build: fix Windows build failures in helpgen and framegen 2026-03-24 08:07:31 +01:00
input.zig input: extract mouse encoding to a pure, testable file 2026-03-15 15:37:54 -07:00
lib_vt.zig libghostty: add _get_multi to all _get APIs 2026-04-11 12:51:36 -07:00
main.zig remove src/bench 2025-07-09 15:06:24 -07:00
main_bench.zig Remove unused imports 2025-11-27 13:37:53 -08:00
main_build_data.zig build: fix Windows build failures in helpgen and framegen 2026-03-24 08:07:31 +01:00
main_c.zig address review: collapse DllMain into a single struct 2026-04-23 02:17:04 +09:00
main_gen.zig Remove unused imports 2025-11-27 13:37:53 -08:00
main_ghostty.zig tripwire: a module for injecting failures to test errdefer 2026-01-21 09:39:02 -08:00
main_wasm.zig
math.zig
pty.c core: simplify pty.c macro usage 2026-03-20 10:37:42 -05:00
pty.zig core: address getProcessInfo feedback 2026-03-19 22:01:16 -05:00
quirks.zig quirks: remove type signature for inlineAssert 2025-12-08 13:19:16 +08:00
renderer.zig testing: use std.Build.TranslateC instead of @cImport 2026-02-27 10:13:03 -06:00
surface_mouse.zig terminal: consolidate mouse types into mouse.zig 2026-03-15 15:48:36 -07:00
termio.zig search thread needs to take an allocated needle 2025-11-26 08:50:04 -08:00
tripwire.zig tripwire: change backing store from ArrayHashMap to EnumMap 2026-01-21 15:30:49 -08:00