refactor: move the canonical libghostty-vt vendor to the repository root (#5102)

Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
Wout StiensandClaude Fable 5 authored and GitHub committed 2026-07-31 14:20:27 +02:00
1 parent acf761b2f5
commit 964cc27901
40 files changed
+13 -13

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ fails, run `xcodebuild -downloadComponent MetalToolchain`.
## Rebuilding libghostty-vt for Android
The checked-in Android shared libraries and headers are pinned to the revision recorded in
`Vendor/libghostty-vt/VERSION`. Set `ANDROID_NDK_HOME` and run:
`native/libghostty-vt/VERSION` at the repository root. Set `ANDROID_NDK_HOME` and run:
```bash
apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh
@@ -25,7 +25,7 @@ The web terminal vendors a WebAssembly build from the same revision and uses the
- License: MIT
Ghostty's MIT license applies to the vendored Android and web libraries. Keep this notice and both
artifacts in sync when updating `Vendor/libghostty-vt`.
artifacts in sync when updating the repository-root `native/libghostty-vt`.
## MesloLGS NF (Android terminal font)
@@ -13,7 +13,7 @@ add_library(t3terminal SHARED t3_terminal_jni.cpp)
target_include_directories(
t3terminal
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../Vendor/libghostty-vt/include"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../../../native/libghostty-vt/include"
)
target_link_options(
@@ -4,7 +4,7 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODULE_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
VENDOR_DIR="${MODULE_DIR}/Vendor/libghostty-vt"
VENDOR_DIR="${MODULE_DIR}/../../../../native/libghostty-vt"
PATCH_DIR="${SCRIPT_DIR}/libghostty-android-patches"
GHOSTTY_REVISION="${GHOSTTY_REVISION:-9f62873bf195e4d8a762d768a1405a5f2f7b1697}"
+2 -2
View File
@@ -5,10 +5,10 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WEB_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
REPO_DIR="$(cd "${WEB_DIR}/../.." && pwd)"
MOBILE_VENDOR_DIR="${REPO_DIR}/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt"
CANONICAL_VENDOR_DIR="${REPO_DIR}/native/libghostty-vt"
VENDOR_DIR="${WEB_DIR}/src/terminal/ghostty/vendor"
GHOSTTY_REVISION="$(tr -d '[:space:]' < "${MOBILE_VENDOR_DIR}/VERSION")"
GHOSTTY_REVISION="$(tr -d '[:space:]' < "${CANONICAL_VENDOR_DIR}/VERSION")"
GHOSTTY_SOURCE_DIR="${GHOSTTY_SOURCE_DIR:-${HOME}/.cache/t3code/ghostty-${GHOSTTY_REVISION:0:8}}"
GHOSTTY_ZIG_VERSION="${GHOSTTY_ZIG_VERSION:-0.15.2}"
GHOSTTY_ZIG="${GHOSTTY_ZIG:-}"
+1 -1
View File
@@ -12,7 +12,7 @@ It is intentionally not an xterm compatibility layer.
prompt glyphs render without a locally installed Nerd Font.
- `vendor/` holds only the artifacts, reproducibly generated by
`apps/web/scripts/build-libghostty-wasm.sh`. The upstream pin and license live once, at
`apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/`; the wasm embeds the pinned revision
`native/libghostty-vt/` at the repository root; the wasm embeds the pinned revision
in its build info and the ABI test verifies it against mobile's `VERSION`.
Keep browser behavior here and terminal transport in the existing client runtime. Do not add React
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vite-plus/test";
import wasmDataUrl from "./vendor/ghostty-vt.wasm?inline";
import writePtyWasmDataUrl from "./vendor/ghostty-write-pty.wasm?inline";
import mobileVersion from "../../../../mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION?raw";
import pinnedVersion from "../../../../../native/libghostty-vt/VERSION?raw";
import { ghosttyKeyForCode } from "./keyCodes";
type WasmFunction = (...args: number[]) => number;
@@ -14,13 +14,13 @@ function decodeWasmDataUrl(dataUrl: string): Uint8Array {
}
describe("vendored libghostty-vt WebAssembly", () => {
it("stays pinned to mobile's canonical revision and size budget", async () => {
it("stays pinned to the canonical revision and size budget", async () => {
const wasm = decodeWasmDataUrl(wasmDataUrl);
expect(wasm.byteLength).toBeLessThan(750_000);
// The artifact carries its own provenance: the build embeds the pinned
// revision as semver build metadata, so mobile's VERSION file is the
// single source of truth and drift is caught here without a copy.
// revision as semver build metadata, so the repository's canonical VERSION
// file is the single source of truth and drift is caught here without a copy.
const result = await WebAssembly.instantiate(wasm.buffer as ArrayBuffer, {
env: { log: () => {} },
});
@@ -35,7 +35,7 @@ describe("vendored libghostty-vt WebAssembly", () => {
new Uint8Array(memory.buffer, view.getUint32(0, true), view.getUint32(4, true)),
);
call("ghostty_wasm_free_u8_array", out, 8);
expect(embeddedRevision).toBe(mobileVersion.trim());
expect(embeddedRevision).toBe(pinnedVersion.trim());
});
it("creates, writes multi-codepoint graphemes, and frees repeated terminals", async () => {
+1 -1
View File
@@ -12,7 +12,7 @@ boundaries, keyboard encoding, selection, and scrollback:
- Android links the native shared library and converts render state into a compact JNI snapshot.
- Web loads a separately cached WebAssembly build and reads render state into a Canvas 2D surface.
- Both artifacts are built from the revision in
`apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION`.
`native/libghostty-vt/VERSION`.
The platform adapters deliberately own only platform behavior. Android owns its Kotlin Canvas and
touch integration. Web owns browser font shaping, the hidden IME textarea, clipboard and DOM input,