Skip to content

Commit fb6d5a6

Browse files
StiensWoutclaude
andcommitted
refactor: move the canonical libghostty-vt vendor to the repository root
The shared upstream pin, license, and C API headers lived inside the mobile terminal module, so the web adapter's build script, ABI regression test, and docs reached across into apps/mobile. The canonical vendor now lives at native/libghostty-vt/ beside the other top-level native code, and both platforms reference it there: - Android's CMake include path and the Android build script follow - the web WASM build script and the ABI test read the root pin - docs and third-party notices point at the new location Platform build outputs stay with their apps (Android jniLibs and the iOS xcframework in the mobile module, the wasm artifacts in the web adapter). The web WASM build was re-run from the relocated pin to verify the script end to end; the artifact is byte-identical. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent acf761b commit fb6d5a6

40 files changed

Lines changed: 13 additions & 13 deletions

‎apps/mobile/modules/t3-terminal/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fails, run `xcodebuild -downloadComponent MetalToolchain`.
4040
## Rebuilding libghostty-vt for Android
4141

4242
The checked-in Android shared libraries and headers are pinned to the revision recorded in
43-
`Vendor/libghostty-vt/VERSION`. Set `ANDROID_NDK_HOME` and run:
43+
`native/libghostty-vt/VERSION` at the repository root. Set `ANDROID_NDK_HOME` and run:
4444

4545
```bash
4646
apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh

‎apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The web terminal vendors a WebAssembly build from the same revision and uses the
2525
- License: MIT
2626

2727
Ghostty's MIT license applies to the vendored Android and web libraries. Keep this notice and both
28-
artifacts in sync when updating `Vendor/libghostty-vt`.
28+
artifacts in sync when updating the repository-root `native/libghostty-vt`.
2929

3030
## MesloLGS NF (Android terminal font)
3131

‎apps/mobile/modules/t3-terminal/android/src/main/cpp/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ add_library(t3terminal SHARED t3_terminal_jni.cpp)
1313

1414
target_include_directories(
1515
t3terminal
16-
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../Vendor/libghostty-vt/include"
16+
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../../../native/libghostty-vt/include"
1717
)
1818

1919
target_link_options(

‎apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44

55
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66
MODULE_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
7-
VENDOR_DIR="${MODULE_DIR}/Vendor/libghostty-vt"
7+
VENDOR_DIR="${MODULE_DIR}/../../../../native/libghostty-vt"
88
PATCH_DIR="${SCRIPT_DIR}/libghostty-android-patches"
99

1010
GHOSTTY_REVISION="${GHOSTTY_REVISION:-9f62873bf195e4d8a762d768a1405a5f2f7b1697}"

‎apps/web/scripts/build-libghostty-wasm.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ set -euo pipefail
55
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66
WEB_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
77
REPO_DIR="$(cd "${WEB_DIR}/../.." && pwd)"
8-
MOBILE_VENDOR_DIR="${REPO_DIR}/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt"
8+
CANONICAL_VENDOR_DIR="${REPO_DIR}/native/libghostty-vt"
99
VENDOR_DIR="${WEB_DIR}/src/terminal/ghostty/vendor"
1010

11-
GHOSTTY_REVISION="$(tr -d '[:space:]' < "${MOBILE_VENDOR_DIR}/VERSION")"
11+
GHOSTTY_REVISION="$(tr -d '[:space:]' < "${CANONICAL_VENDOR_DIR}/VERSION")"
1212
GHOSTTY_SOURCE_DIR="${GHOSTTY_SOURCE_DIR:-${HOME}/.cache/t3code/ghostty-${GHOSTTY_REVISION:0:8}}"
1313
GHOSTTY_ZIG_VERSION="${GHOSTTY_ZIG_VERSION:-0.15.2}"
1414
GHOSTTY_ZIG="${GHOSTTY_ZIG:-}"

‎apps/web/src/terminal/ghostty/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ It is intentionally not an xterm compatibility layer.
1212
prompt glyphs render without a locally installed Nerd Font.
1313
- `vendor/` holds only the artifacts, reproducibly generated by
1414
`apps/web/scripts/build-libghostty-wasm.sh`. The upstream pin and license live once, at
15-
`apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/`; the wasm embeds the pinned revision
15+
`native/libghostty-vt/` at the repository root; the wasm embeds the pinned revision
1616
in its build info and the ABI test verifies it against mobile's `VERSION`.
1717

1818
Keep browser behavior here and terminal transport in the existing client runtime. Do not add React

‎apps/web/src/terminal/ghostty/runtimeAbi.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vite-plus/test";
22

33
import wasmDataUrl from "./vendor/ghostty-vt.wasm?inline";
44
import writePtyWasmDataUrl from "./vendor/ghostty-write-pty.wasm?inline";
5-
import mobileVersion from "../../../../mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION?raw";
5+
import pinnedVersion from "../../../../../native/libghostty-vt/VERSION?raw";
66
import { ghosttyKeyForCode } from "./keyCodes";
77

88
type WasmFunction = (...args: number[]) => number;
@@ -14,13 +14,13 @@ function decodeWasmDataUrl(dataUrl: string): Uint8Array {
1414
}
1515

1616
describe("vendored libghostty-vt WebAssembly", () => {
17-
it("stays pinned to mobile's canonical revision and size budget", async () => {
17+
it("stays pinned to the canonical revision and size budget", async () => {
1818
const wasm = decodeWasmDataUrl(wasmDataUrl);
1919
expect(wasm.byteLength).toBeLessThan(750_000);
2020

2121
// The artifact carries its own provenance: the build embeds the pinned
22-
// revision as semver build metadata, so mobile's VERSION file is the
23-
// single source of truth and drift is caught here without a copy.
22+
// revision as semver build metadata, so the repository's canonical VERSION
23+
// file is the single source of truth and drift is caught here without a copy.
2424
const result = await WebAssembly.instantiate(wasm.buffer as ArrayBuffer, {
2525
env: { log: () => {} },
2626
});
@@ -35,7 +35,7 @@ describe("vendored libghostty-vt WebAssembly", () => {
3535
new Uint8Array(memory.buffer, view.getUint32(0, true), view.getUint32(4, true)),
3636
);
3737
call("ghostty_wasm_free_u8_array", out, 8);
38-
expect(embeddedRevision).toBe(mobileVersion.trim());
38+
expect(embeddedRevision).toBe(pinnedVersion.trim());
3939
});
4040

4141
it("creates, writes multi-codepoint graphemes, and frees repeated terminals", async () => {

‎docs/architecture/terminal-renderers.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ boundaries, keyboard encoding, selection, and scrollback:
1212
- Android links the native shared library and converts render state into a compact JNI snapshot.
1313
- Web loads a separately cached WebAssembly build and reads render state into a Canvas 2D surface.
1414
- Both artifacts are built from the revision in
15-
`apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION`.
15+
`native/libghostty-vt/VERSION`.
1616

1717
The platform adapters deliberately own only platform behavior. Android owns its Kotlin Canvas and
1818
touch integration. Web owns browser font shaping, the hidden IME textarea, clipboard and DOM input,

apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/LICENSE renamed to native/libghostty-vt/LICENSE

File renamed without changes.

apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION renamed to native/libghostty-vt/VERSION

File renamed without changes.

0 commit comments

Comments
 (0)