Repository navigation
Add Android ARM64 platform support #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,9 +78,22 @@ if [ -n "$binary_path" ]; then | |
| else | ||
| raw_os=$(uname -s) | ||
| os=$(echo "$raw_os" | tr '[:upper:]' '[:lower:]') | ||
|
|
||
| # Check if running on Android (e.g., Termux) | ||
| is_android=false | ||
| if [ -d /system/app ] && [ -d /system/priv-app ]; then | ||
| is_android=true | ||
| fi | ||
|
|
||
| case "$raw_os" in | ||
| Darwin*) os="darwin" ;; | ||
| Linux*) os="linux" ;; | ||
| Linux*) | ||
| if [ "$is_android" = "true" ]; then | ||
| os="android" | ||
| else | ||
| os="linux" | ||
| fi | ||
| ;; | ||
| MINGW*|MSYS*|CYGWIN*) os="windows" ;; | ||
| esac | ||
|
|
||
|
|
@@ -101,16 +114,19 @@ else | |
|
|
||
| combo="$os-$arch" | ||
| case "$combo" in | ||
| linux-x64|linux-arm64|darwin-x64|darwin-arm64|windows-x64) | ||
| linux-x64|linux-arm64|darwin-x64|darwin-arm64|windows-x64|android-arm64) | ||
| ;; | ||
| *) | ||
| echo -e "${RED}Unsupported OS/Arch: $os/$arch${NC}" | ||
| if [ "$is_android" = "true" ] && [ "$arch" != "arm64" ]; then | ||
| echo -e "${MUTED}Note: OpenCode on Android/Termux currently only supports ARM64 architecture.${NC}" | ||
| fi | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| archive_ext=".zip" | ||
| if [ "$os" = "linux" ]; then | ||
| if [ "$os" = "linux" ] || [ "$os" = "android" ]; then | ||
| archive_ext=".tar.gz" | ||
| fi | ||
|
Comment on lines
128
to
131
|
||
|
|
||
|
|
@@ -158,17 +174,20 @@ else | |
| fi | ||
|
|
||
| target="$os-$arch" | ||
| if [ "$needs_baseline" = "true" ]; then | ||
| target="$target-baseline" | ||
| fi | ||
| if [ "$is_musl" = "true" ]; then | ||
| target="$target-musl" | ||
| # Android doesn't need baseline or musl variants | ||
| if [ "$os" != "android" ]; then | ||
| if [ "$needs_baseline" = "true" ]; then | ||
| target="$target-baseline" | ||
| fi | ||
| if [ "$is_musl" = "true" ]; then | ||
| target="$target-musl" | ||
| fi | ||
| fi | ||
|
|
||
| filename="$APP-$target$archive_ext" | ||
|
|
||
|
|
||
| if [ "$os" = "linux" ]; then | ||
| if [ "$os" = "linux" ] || [ "$os" = "android" ]; then | ||
| if ! command -v tar >/dev/null 2>&1; then | ||
| echo -e "${RED}Error: 'tar' is required but not installed.${NC}" | ||
| exit 1 | ||
|
|
@@ -334,7 +353,7 @@ download_and_install() { | |
| curl -# -L -o "$tmp_dir/$filename" "$url" | ||
| fi | ||
|
|
||
| if [ "$os" = "linux" ]; then | ||
| if [ "$os" = "linux" ] || [ "$os" = "android" ]; then | ||
| tar -xzf "$tmp_dir/$filename" -C "$tmp_dir" | ||
| else | ||
| unzip -q "$tmp_dir/$filename" -d "$tmp_dir" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -60,11 +60,17 @@ const allTargets: { | |||||
| arch: "arm64" | "x64" | ||||||
| abi?: "musl" | ||||||
| avx2?: false | ||||||
| android?: boolean | ||||||
| }[] = [ | ||||||
| { | ||||||
| os: "linux", | ||||||
| arch: "arm64", | ||||||
| }, | ||||||
| { | ||||||
| os: "linux", | ||||||
|
||||||
| os: "linux", | |
| os: "android", |
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.