Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 3.88 KB

native-v2-build.md

File metadata and controls

14 lines (11 loc) · 3.88 KB

Native v2 build

Target: OpenCode native Android/aarch64 Bionic, no proot or glibc. The current stable release is v2.3.2. The previous OpenCode 2.3.0, 2.2.7, 2.2.5, 2.2.2, 2.2.0, and 2.1.4 releases and both 2.1.3 builds (Bun 1.4.4 and the original Bun 1.4.0) remain available for rollback. Release tags from 2.3.2 onward are the plain upstream version; Bun/OpenTUI details stay in the asset name and build metadata.

Two supported paths:

  • CI release path: .github/workflows/build-native-android.yml fetches pinned OpenCode source, builds its source-mode graph with Bun 1.4.4, cross-compiles the pinned OpenTUI with the NDK sysroot and Zig, and transplants the graph onto the hash-verified Android/Bionic Bun 1.4.4 runtime. The Bionic safety guards and release patches are checked against the pinned OpenTUI source. The transplant fix preserves zero-filled .bss when ELF metadata is relocated. Inputs are locked in tools/supply-chain-lock.json. The workflow builds OpenCode 2.3.2 / OpenTUI 0.8.4 (v2.3.2).
  • OpenTUI 0.8.4 port: OpenCode 2.3.0 pins @opentui/core and @opentui/solid at 0.8.4, so the native renderer must match. 0.8.4 requires Zig 0.17.0; Zig 0.17.1 has the same translate-c target parsing and does not fix the host include-path issue. The 0.8.4 build.zig and buffer.zig are unchanged from 0.8.1, and the clipboard host's Linux pthread_tryjoin_np call is unchanged, so tools/patch-opentui-0.8.4.py keeps the build.zig, buffer.zig, and clipboard/host.zig guards. 0.8.4 keeps the i64 viewport clamp, routes text draws through drawTextFitted, and adds ot_scene_reaches_hooks for culled streaming text. The build also adds an empty limits.h shim after the NDK sysroot so Bionic's #include_next cannot reach the host glibc headers that Zig 0.17 translate-c appends for cross builds. patches/opentui/v0.8.4-file-prefix-map.patch and patches/opentui/v0.8.4-tlsdesc-self-resolver.patch are re-verified against the 0.8.4 tag. OpenCode 2.2.0 also replaced the --target build flag with OPENCODE_TARGET; the source build sets it and asserts that exactly one target was emitted.
  • Release gate: candidate run 44289708544 built v2.3.2 and passed the artifact checks: 701-module graph, embedded OpenTUI 0.8.4 libopentui.so (4,620,328 bytes, 270 exported ot_* symbols, Bionic-only NEEDED entries), and the FFI negative-coordinate guard. The exact CI binary passed checksum/version verification, interactive TUI startup, and a clean exit on one Android device. .github/workflows/publish-native-android.yml publishes only that CI artifact after rechecking its hashes, metadata, and transplant report; a phone-built binary is never uploaded. The publish job installs a hash-pinned cosign binary from tools/supply-chain-lock.json and signs SHA256SUMS plus the archive with keyless Sigstore signing; install.sh verifies both bundles when cosign is available and fails closed with OPENCODE_REQUIRE_SIGNATURE=1. CI's Linux runner cannot execute the Android ELF, so its runtime TUI probe is skipped. The v2.3.0-bun144.1, v2.2.7-bun144.1, v2.2.5-bun144.1, v2.2.2-bun144.1, v2.2.0-bun144.1, v2.1.4-bun144.2, v2.1.3-bun144.1, and original v2.1.3 Bun 1.4.0 releases remain available for rollback.
  • On-device (older transplant path): Termux itself is Bionic, so this path needs no NDK. The full guide is in docs/transplant.md. Deps: pkg install python3 nodejs clang make zig (zig only to rebuild OpenTUI; upx optional), plus network for npm pack and the Android Bun download. The currently documented local target is 2.0.26:
    make transplant VER=2.0.26
    Output: artifacts/transplant/2.0.26/opencode-native-revived. Then test: opencode --version, TUI smoke, auth, prompt, clean exit. The 2.2.x releases use the CI source-build path above; the older on-device command does not reproduce it.