Repository navigation
Add Android ARM64 platform support - #2
Conversation
Co-authored-by: grand151 <86811297+grand151@users.noreply.github.com>
Co-authored-by: grand151 <86811297+grand151@users.noreply.github.com>
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Pull request overview
Adds an Android ARM64 distribution path so Termux users can install OpenCode via the standard installer, despite Bun lacking a native Android compile target (using the Linux ARM64 target as a substitute).
Changes:
- Added an
android?: booleanflag and anopencode-android-arm64target name in the build script, mapping Android builds tobun-linux-arm64. - Updated the
installscript to detect Android/Termux, supportandroid-arm64, and use.tar.gzfor Android downloads. - Updated docs to mention Android/Termux installation and the new
android-arm64platform string.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/opencode/script/build.ts | Introduces an Android target name and maps its Bun compile target to bun-linux-arm64. |
| install | Detects Android and selects android-arm64 artifacts (tarball-based) while skipping baseline/musl variants. |
| README.md | Adds Termux install snippet and compatibility notes for Android. |
| CONTRIBUTING.md | Updates <platform> examples to include android-arm64. |
Comments suppressed due to low confidence (1)
install:364
- The
download_and_installfunction downloads a release artifact from a remote URL withcurland immediately extracts and installs it without any checksum, signature, or other integrity verification. If the GitHub release asset or the network path to it is compromised, an attacker could supply a malicious tar/zip that this script would transparently install, leading to arbitrary code execution under the installing user. Add strong integrity checks (for example, verifying a pinned hash or signature for$filenamebefore extraction and installation) so that tampering with the remote artifact is detected and the install is aborted.
download_and_install() {
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
mkdir -p "$tmp_dir"
if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
# Fallback to standard curl on Windows, non-TTY environments, or if custom progress fails
curl -# -L -o "$tmp_dir/$filename" "$url"
fi
if [ "$os" = "linux" ] || [ "$os" = "android" ]; then
tar -xzf "$tmp_dir/$filename" -C "$tmp_dir"
else
unzip -q "$tmp_dir/$filename" -d "$tmp_dir"
fi
mv "$tmp_dir/opencode" "$INSTALL_DIR"
chmod 755 "${INSTALL_DIR}/opencode"
rm -rf "$tmp_dir"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const name = [ | ||
| pkg.name, | ||
| // changing to win32 flags npm for some reason | ||
| item.os === "win32" ? "windows" : item.os, | ||
| item.os === "win32" ? "windows" : item.android ? "android" : item.os, | ||
| item.arch, |
There was a problem hiding this comment.
The new android naming (opencode-android-arm64) will no longer match the release packaging condition later in this script that tars only keys containing "linux". As a result, the Android artifact will be produced as a .zip, but the installer/docs expect opencode-android-arm64.tar.gz, which will break installs. Update the packaging logic to treat the Android target like Linux for archive format (or otherwise keep the artifact extension consistent with the installer).
| arch: "arm64", | ||
| }, | ||
| { | ||
| os: "linux", |
There was a problem hiding this comment.
Adding the Android target as { os: "linux", arch: "arm64", android: true } means --single builds on a Linux ARM64 host will now match both the regular linux-arm64 target and this Android target (same os/arch/abi/avx2), which conflicts with the intent of producing a single native binary. Consider excluding android: true targets from the --single selection unless an explicit flag is provided, or treat Android as its own os value in the selection logic.
| os: "linux", | |
| os: "android", |
| archive_ext=".zip" | ||
| if [ "$os" = "linux" ]; then | ||
| if [ "$os" = "linux" ] || [ "$os" = "android" ]; then | ||
| archive_ext=".tar.gz" | ||
| fi |
There was a problem hiding this comment.
The installer treats os=android as a .tar.gz download and extracts it with tar -xzf. Currently, the build script will generate a .zip for opencode-android-arm64 unless the packaging logic is also updated (it only tars artifacts whose name contains "linux"). Ensure the build artifact extension matches this installer behavior, otherwise Android installs will fail at extraction time.
| ``` | ||
|
|
||
| > [!NOTE] | ||
| > The Android build is based on the Linux ARM64 binary and may require proot-distro for full compatibility. Direct execution in Termux may have limitations due to Android's security model. For best results, consider using proot-distro with Alpine Linux. |
There was a problem hiding this comment.
This note recommends proot-distro with Alpine Linux, but the Android build is described as using the Linux ARM64 (glibc) binary. Alpine is musl-based, so the glibc binary likely won't run there without additional compatibility layers. Consider recommending a glibc-based proot distro (e.g., Debian/Ubuntu) or explicitly calling out the libc requirement.
| > The Android build is based on the Linux ARM64 binary and may require proot-distro for full compatibility. Direct execution in Termux may have limitations due to Android's security model. For best results, consider using proot-distro with Alpine Linux. | |
| > The Android build is based on the Linux ARM64 (glibc) binary and may require proot-distro for full compatibility. Direct execution in Termux may have limitations due to Android's security model. For best results, use proot-distro with a glibc-based Linux distribution (for example, Debian or Ubuntu). Musl-based distributions such as Alpine Linux are not supported without additional compatibility layers. |
User description
What does this PR do?
Adds
opencode-android-arm64build target for Termux users. Since Bun lacks native Android support, the build usesbun-linux-arm64target (glibc binary). Users may need proot-distro for full compatibility due to Android's bionic libc and PIE requirements.Build system (
packages/opencode/script/build.ts):android?: booleanflag to target configurationbun-linux-arm64, packages asopencode-android-arm64.tar.gzInstall script (
install):/system/appand/system/priv-appdirectoriesandroid-arm64to supported platformsDocumentation (
README.md,CONTRIBUTING.md):How did you verify your code works?
androidflag correctly maps tobun-linux-arm64)Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/graphql/usr/bin/gh gh issue view 10504(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
PR Type
Enhancement
Description
Add Android ARM64 platform support via
opencode-android-arm64build targetImplement Android detection in install script using system directories
Configure build system to use Linux ARM64 binary for Android compilation
Add Termux installation instructions and platform documentation
File Walkthrough
build.ts
Add Android ARM64 build target configurationpackages/opencode/script/build.ts
android?: booleanflag to target configurationbun-linux-arm64binaryopencode-android-arm64package nameinstall
Implement Android detection and installation logicinstall
/system/appand/system/priv-appdirectories
android-arm64to supported platform combinations.tar.gzarchive format for Android like LinuxREADME.md
Add Android/Termux installation documentationREADME.md
CONTRIBUTING.md
Update platform examples with Android supportCONTRIBUTING.md
android-arm64