Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.
feat(ci): add native android arm64 build target and termux support
Samir Hossainsae8032bd63bc
diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.ymlnew file mode 100644index 0000000..b5f28ec--- /dev/null+++ b/.github/workflows/build-android.yml@@ -0,0 +1,71 @@+name: Build and Upload Android Binary++on:+ workflow_dispatch:+ inputs:+ release_tag:+ description: "Release tag to attach the Android binary to"+ required: true+ default: "v0.1.16"++permissions:+ contents: write++jobs:+ build-and-upload:+ name: Build and Upload Android arm64+ runs-on: ubuntu-latest+ timeout-minutes: 30+ steps:+ - uses: actions/checkout@v7+ with:+ ref: ${{ github.event.inputs.release_tag }}++ - name: Install Rust+ uses: dtolnay/rust-toolchain@stable+ with:+ toolchain: 1.90.0+ targets: aarch64-linux-android++ - uses: Swatinem/rust-cache@v2+ with:+ prefix-key: "android-arm64-backfill"++ - name: Setup Android NDK+ uses: nttld/setup-ndk@v1+ with:+ ndk-version: r26d+ add-to-path: true++ - name: Build Android binary+ env:+ CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: aarch64-linux-android24-clang+ CC_aarch64_linux_android: aarch64-linux-android24-clang+ run: cargo build --release --all-features --locked --target aarch64-linux-android++ - name: Validate Android ELF headers+ run: |+ BIN="target/aarch64-linux-android/release/moviebox-tui"+ readelf -lW "$BIN" | grep -F "PHDR" || { echo "::error::Missing PT_PHDR"; exit 1; }+ readelf -lW "$BIN" | grep -F "/system/bin/linker64" || { echo "::error::Missing Android PT_INTERP"; exit 1; }++ - name: Package Archive+ run: |+ mkdir dist+ cp target/aarch64-linux-android/release/moviebox-tui dist/+ cp README.md dist/+ cp LICENSE-* dist/ || true+ tar -czvf MovieBox_Android_arm64.tar.gz -C dist .++ - name: Update SHA256SUMS and Upload to Release+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ TAG: ${{ github.event.inputs.release_tag }}+ run: |+ gh release download "$TAG" -p "SHA256SUMS" || touch SHA256SUMS+ sed -i '/MovieBox_Android_arm64.tar.gz/d' SHA256SUMS+ sha256sum MovieBox_Android_arm64.tar.gz >> SHA256SUMS++ gh release upload "$TAG" MovieBox_Android_arm64.tar.gz --clobber+ gh release upload "$TAG" SHA256SUMS --clobber+ echo "✔ Successfully attached MovieBox_Android_arm64.tar.gz to $TAG"diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 2fbec66..0e8eab1 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -239,9 +239,60 @@ jobs:name: binary-universal-apple-darwinpath: MovieBox_macOS_Universal.tar.gz+ build-android:+ name: Build Android (aarch64-linux-android)+ needs: [check-version, preflight]+ if: needs.check-version.outputs.is_new == 'true'+ runs-on: ubuntu-latest+ timeout-minutes: 30+ steps:+ - uses: actions/checkout@v7++ - name: Install Rust+ uses: dtolnay/rust-toolchain@stable+ with:+ toolchain: 1.90.0+ targets: aarch64-linux-android++ - uses: Swatinem/rust-cache@v2+ with:+ prefix-key: "release-build-android-aarch64"++ - name: Setup Android NDK+ uses: nttld/setup-ndk@v1+ with:+ ndk-version: r26d+ add-to-path: true++ - name: Build Android binary+ env:+ CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: aarch64-linux-android24-clang+ CC_aarch64_linux_android: aarch64-linux-android24-clang+ run: cargo build --release --all-features --locked --target aarch64-linux-android++ - name: Validate Android ELF headers+ run: |+ BIN="target/aarch64-linux-android/release/moviebox-tui"+ readelf -lW "$BIN" | grep -F "PHDR" || { echo "::error::Missing PT_PHDR"; exit 1; }+ readelf -lW "$BIN" | grep -F "/system/bin/linker64" || { echo "::error::Missing Android PT_INTERP"; exit 1; }++ - name: Archive Android+ run: |+ mkdir dist+ cp target/aarch64-linux-android/release/moviebox-tui dist/+ cp README.md dist/+ cp LICENSE-* dist/ || true+ tar -czvf MovieBox_Android_arm64.tar.gz -C dist .++ - name: Upload Artifact+ uses: actions/upload-artifact@v7+ with:+ name: binary-aarch64-linux-android+ path: MovieBox_Android_arm64.tar.gz+release:name: Create Release- needs: [check-version, build, build-macos-universal]+ needs: [check-version, build, build-macos-universal, build-android]if: needs.check-version.outputs.is_new == 'true'runs-on: ubuntu-latesttimeout-minutes: 15@@ -289,6 +340,7 @@ jobs:EXPECTED=("MovieBox_Linux_x64.tar.gz""MovieBox_Linux_arm64.tar.gz"+ "MovieBox_Android_arm64.tar.gz""MovieBox_macOS_Universal.tar.gz""MovieBox_Windows_x64.zip""MovieBox_Windows_arm64.zip"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 69e0d37..4f1d07a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,11 @@## [Unreleased]### Added+- **Native Android ARM64 Release Target & Pipeline**:+ - Added native `aarch64-linux-android` build target to the release workflow (`.github/workflows/release.yml`) using Android NDK r26d and Clang (API 24+).+ - Configured automated packaging of `MovieBox_Android_arm64.tar.gz` with native Bionic dynamic linking (`libc.so`), valid ELF `PT_PHDR` program header table, and `/system/bin/linker64` dynamic loader.+ - Added Android ELF header validation in CI to verify `PT_PHDR` and `/system/bin/linker64` presence, preventing `Could not find a PHDR: broken executable?` aborts on Android devices.+ - Updated universal installer script (`install.sh`) to detect Android Termux on 64-bit ARM and automatically fetch `MovieBox_Android_arm64.tar.gz` with verified SHA256 checksums, enabling 1-second native installation without on-device compilation.- **Native mdBook & GitHub Pages Documentation Architecture**:- Integrated `mdBook` documentation engine reading directly from canonical `docs/*.md` guides with zero duplicated markdown files and zero third-party web frameworks.- Added `docs/SUMMARY.md` defining table-of-contents chapter navigation across all guides, architecture diagrams, and operational workflows.diff --git a/README.md b/README.mdindex 02d0def..f4066ad 100644--- a/README.md+++ b/README.md@@ -52,10 +52,10 @@ irm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | i### Android (Termux)-Install Termux tools, run the installer, and grant storage permissions:+Install Termux tools, download the native precompiled Android ARM64 binary via the installer, and grant storage permissions:```bash-pkg update && pkg install termux-tools-curl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh | bash+pkg update && pkg install -y curl tar termux-tools+curl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh -o install.sh && bash install.shtermux-setup-storage```diff --git a/docs/cross-platform.md b/docs/cross-platform.mdindex 14f4a5f..34ef92d 100644--- a/docs/cross-platform.md+++ b/docs/cross-platform.md@@ -15,7 +15,7 @@ the release checks in [`release-checklist.md`](release-checklist.md).| macOS | IINA preferred player (via the installed IINA `iina-cli`); VLC/mpv `.app` paths detected. `process_group(0)` on spawn. || Windows | mpv/VLC detected via Program Files + `%LOCALAPPDATA%`; path-safe file stems; static MSVC CRT linking (`+crt-static`) for zero-dependency standalone binaries; handle-safe atomic download replacement (dropping file handles before renames); background update helper spawned with `CREATE_NO_WINDOW` (`0x08000000`). || Linux | Flatpak mpv/VLC supported (`flatpak run …`); xdg data/cache dirs. |-| Android (Termux) | Uses the Linux ARM64 binary compiled as static-PIE (`ET_DYN`) with 64-byte `PT_TLS` alignment to satisfy Android Bionic (`/system/bin/linker64`) and kernel W^X execution rules without `unexpected e_type: 2` errors. Includes a pure-Rust DNS resolver that reads system configuration and falls back to public resolvers (Cloudflare, Google, Quad9) for zero-config name resolution, and dynamically checks for `termux-open`, `termux-open-url`, `termux-am`, or in-terminal `mpv`; playback strips `LD_LIBRARY_PATH` and `LD_PRELOAD` before launching the chooser. Android intent playback cannot forward stream headers or attach subtitles. Real-device chooser behavior is a release prerequisite; Proot/Termux X11 behavior is unsupported unless separately tested. |+| Android (Termux) | Targets `aarch64-linux-android` linked against the Android NDK (Clang API 24+) and system Bionic `libc.so`, producing a native ELF executable with a valid `PT_PHDR` program header table and `/system/bin/linker64` dynamic loader. This eliminates `Could not find a PHDR: broken executable?` crashes and executes natively without on-device compilation. Includes a pure-Rust DNS resolver that reads system configuration and falls back to public resolvers (Cloudflare, Google, Quad9) for zero-config name resolution, and dynamically checks for `termux-open`, `termux-open-url`, `termux-am`, or in-terminal `mpv`; playback strips `LD_LIBRARY_PATH` and `LD_PRELOAD` before launching the chooser. Android intent playback cannot forward stream headers or attach subtitles. Real-device chooser behavior is a release prerequisite; Proot/Termux X11 behavior is unsupported unless separately tested. |## Terminal capabilitiesdiff --git a/docs/installation.md b/docs/installation.mdindex 786451b..7a30ae2 100644--- a/docs/installation.md+++ b/docs/installation.md@@ -34,14 +34,23 @@ irm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | i## Android (Termux)-Install Termux tools, run the installer script, and grant storage permissions:+Install Termux tools, run the installer script to fetch the precompiled native Android ARM64 binary, and grant storage permissions:```bash-pkg update && pkg install termux-tools-curl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh | bash+pkg update && pkg install -y curl tar termux-tools+curl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh -o install.sh && bash install.shtermux-setup-storage```+The installer automatically downloads the native Android ARM64 release package (`MovieBox_Android_arm64.tar.gz`) built against the Android NDK and Bionic libc, requiring zero on-device compilation.++To compile from source on Termux:++```bash+pkg install -y rust clang+cargo install moviebox-tui --locked+```+---## Cargo (Crates.io)diff --git a/install.sh b/install.shindex 671403f..c73ff45 100755--- a/install.sh+++ b/install.sh@@ -382,7 +382,7 @@ fiif [ "$IS_TERMUX" -eq 1 ]; thenif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then- FILE="MovieBox_Linux_arm64.tar.gz"+ FILE="MovieBox_Android_arm64.tar.gz"PLATFORM_NAME="Android Termux (arm64)"elselog_error "Unsupported Termux architecture ($ARCH). Only arm64/aarch64 is hosted. Use 'cargo install moviebox-tui'."@@ -499,7 +499,16 @@ URL="https://github.com/$REPO/releases/download/$TARGET_VERSION/$FILE"CHECKSUM_URL="https://github.com/$REPO/releases/download/$TARGET_VERSION/SHA256SUMS"download_files() {- curl -fsSL "$URL" -o "$TMP_DIR/$FILE" && \+ if ! curl -fsSL "$URL" -o "$TMP_DIR/$FILE"; then+ if [ "$IS_TERMUX" -eq 1 ]; then+ printf "\n" >&2+ log_error "Failed to download $FILE."+ printf " %bℹ%b Precompiled native Android binaries are hosted starting from v0.1.17+.\n" "$C_SAPPHIRE" "$C_RESET" >&2+ printf " To install from source on Termux:\n" >&2+ printf " %bpkg install -y rust clang && cargo install moviebox-tui --locked%b\n\n" "$C_BOLD" "$C_RESET" >&2+ fi+ return 1+ ficurl -fsSL "$CHECKSUM_URL" -o "$TMP_DIR/SHA256SUMS"}@@ -555,6 +564,10 @@ if [ "$DRY_RUN" -eq 0 ]; thenif ! smoke_output=$("$APP_PATH" --version 2>&1); thenlog_error "Installed binary failed execution smoke test ($APP_PATH):"printf " %s\n" "$smoke_output" >&2+ if [ "$IS_TERMUX" -eq 1 ]; then+ printf "\n %bℹ%b If Termux rejects the binary, install via cargo:\n" "$C_SAPPHIRE" "$C_RESET" >&2+ printf " %bpkg install -y rust clang && cargo install moviebox-tui --locked%b\n\n" "$C_BOLD" "$C_RESET" >&2+ fiexit 1fifi