Skip to content

chore(release): prepare OpenCode 2.2.6 for Termux - #1

Merged
Spectra010s merged 7 commits into
native-androidfrom
feat/2.2.6
Nov 11, 2026
Merged

Spectra010s merged 7 commits into
native-androidfrom
feat/2.2.6

Conversation

@Spectra010s

Copy link
Copy Markdown
Owner
  • Pin OpenCode 2.2.6, OpenTUI 0.8.1, and Zig 0.17.0 for the native Android build.
  • Preserve Bionic tagged pointers across OpenTUI's Bun FFI calls and update the Zig Android build hooks.
  • Prepare the 2.2.6 installer, release notes, and build documentation.

The repo had no CONTRIBUTING.md, so nothing stated that pull requests
target native-android, that the lock is the only place versions live, or
that releases come from a CI artifact. Record those, plus the aarch64-only
and guard-before-strip constraints, so a contributor does not have to
reverse-engineer them from the workflows.
Upstream v2.2.6 moves OpenTUI from 0.8.0 to 0.8.1, and 0.8.1 declares
minimum_zig_version 0.17.0 (.zig-version), so the bump is not version-only:
the Zig toolchain pin moves with it.

Verified before pinning:
- source tarball sha256 4dec545d... matches tools/verify-release-input.py
- @opentui/core 0.8.1 gitHead 9a09079c... resolves from the npm registry
- zig-x86_64-linux-0.17.0.tar.xz sha256 1cbe9df9...
- patch-opencode-source.py and patch-opentui-android.py both apply to the
  2.2.6 / 0.8.1 trees (bionic hooks and buffer guards land as expected)
- the OpenTUI FFI shim still exposes toSafeNumberPointer, so the top-byte
  pointer mask still has its anchor

build-libopentui.sh now reads the Zig version from the lock instead of
hardcoding 0.16.0.
Zig 0.17 made the --libc schema strict: every field must appear, the new
darwin_sdk_dir included, and cc_dir may not be empty for linux targets
(Android's os tag). The old file omitted darwin_sdk_dir and sent an empty
gcc_dir, so configurer died with 'missing field: darwin_sdk_dir' before
compiling anything.

Emit cc_dir as gcc_dir, which 0.16 still reads by name and 0.17 accepts as
an alias for cc_dir, and point it at the NDK API lib dir that holds
crtbegin_so.o. Add the empty darwin_sdk_dir field that 0.17 requires.
Zig 0.17's translate-c also puts the host /usr/include on the system
include path; 0.16 did not. Bionic's <limits.h> ends with

    #if __has_include_next(<limits.h>)
    #include_next <limits.h>
    #endif

so on 0.17 that include_next resolved to glibc's limits.h and the three
translate-c steps died on __GLIBC_USE and gnu/stubs-32.h, before the
library compiled at all:

    /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:74:5:
      error: function-like macro '__GLIBC_USE' is not defined

Inject an empty src/bionic-include-next/limits.h as a system include dir
right after the NDK ones, so include_next terminates inside the sysroot.
This reproduces 0.16's behaviour, where nothing followed the NDK dirs.
The shadow dir is only added when the BIONIC_* env vars are set, so a
desktop build still sees the real limits.h.

Also route the context ABI translate-c (include/opentui.h) through the
same helper. It was the third failing step, and it has no NDK paths of
its own, so it fell straight through to the host headers.

Verified locally with Zig 0.17.0 and NDK r28: the exact CI command now
translates yoga-bridge.h, miniaudio.h and opentui.h, and the complete
-Dlibrary-target=aarch64-linux-android.28 build produces an aarch64
libopentui.so with the tlsdesc shim and guard symbols intact.
Both cost a CI cycle: 0.17 rejects an incomplete --libc file, and its
translate-c searches the host /usr/include, which bionic's limits.h
include_next happily follows. Note them next to the pointer-tagging
caveat so the next bump does not rediscover them.
…them

2.2.5 cleared the ARM TBI tag in toSafeNumberPointer so the shim's
safe-integer check would pass. The renderer started, but Scudo re-checks
the tag in free() and aborts at teardown ("Pointer tag for 0x... was
truncated"), i.e. when the user quits.

Bun 1.4's FFI keeps all 64 bits for BigInt `ptr` arguments, so return the
tagged BigInt unchanged (untagged pointers still become Numbers, matching
upstream on every other platform) and stop toBunPointer2 from truncating
through Number(). POINTER_UNSAFE stays for the node:ffi backend.

The patched return is BigInt.asUintN(64, pointer): identity for the range
the checks already enforce, and a rare token the source build greps for in
the compiled ELF, because bytecode:true freezes the shim into the binary.
Trees patched by the old revision are migrated by dropping the mask line.

tests/unit/patch-opentui-ffi.bats covers the patch, idempotency, migration
and the drift guard.
@Spectra010s
Spectra010s marked this pull request as ready for review November 11, 2026 03:21
@Spectra010s
Spectra010s merged commit 6cd7690 into native-android Nov 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant