Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 3.22 KB

native-v2-build.md

File metadata and controls

14 lines (11 loc) · 3.22 KB

Native v2 build

Target: OpenCode native Android/aarch64 Bionic, no proot or glibc. The current stable release is v2.2.5-bun144.1. The previous OpenCode 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.

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.2.5 / OpenTUI 0.8.0 (v2.2.5-bun144.1).
  • OpenTUI 0.8.0 port: OpenCode 2.2.3+ pins @opentui/core and @opentui/solid at 0.8.0, so the native renderer must match. tools/patch-opentui-0.8.0.py keeps the build.zig, buffer.zig, and clipboard/host.zig guards; 0.8.0 clamps viewport origins in i64, so the 0.7.0 extreme-origin short-circuits are dropped. patches/opentui/v0.8.0-file-prefix-map.patch and patches/opentui/v0.8.0-tlsdesc-self-resolver.patch are re-verified against the 0.8.0 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 41193063342 built v2.2.5-bun144.1 and passed the artifact checks: 669-module graph, embedded OpenTUI 0.8.0 libopentui.so (4,522,624 bytes, 244 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.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.