Skip to main content

Building tea CLI for Termux

###

Building tea CLI for Termux

######

Overview

Overview

This documents the process of building the [tea CLI](https://gitea.com/gitea/tea)CLI (official Gitea CLI tool) as a Termux package for aarch64 Android devices.

######

Prerequisites

Prerequisites
- Docker installed with user in docker group - [termux-packages](https://github.com/termux/termux-packages)packages repository cloned - Android NDK is handled automatically by the Docker builder image ######

Phase 1 -- Local Build

#########

1. Clone termux-packages

```
git clone https://github.com/termux/termux-packages
```
#########

2. Create package directory and build.sh

File: `packages/tea/build.sh`sh

**

Key fields:**

|
Field |Value Value | |-------|-------|| TERMUX_PKG_VERSION | 0.14.0 | | TERMUX_PKG_SRCURL | https://gitea.com/gitea/tea/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz | | TERMUX_PKG_SHA256 |f509de217ac0e57491ffdab2750516e8c505780881529ee703b9d0c86cc652a3 f509de217ac0e57491ffdab2750516e8c505780881529ee703b9d0c86cc652a3 ||TERMUX_PKG_LICENSE TERMUX_PKG_LICENSEMIT | MIT|TERMUX_PKG_BUILD_DEPENDS |golang TERMUX_PKG_BUILD_DEPENDS |golangTERMUX_PKG_BUILD_IN_SRC |true | TERMUX_PKG_BUILD_IN_SRC | true | **

Critical notes:**

-
  • Do NOT set TERMUX_PKG_DEPENDS= (empty value is parsed as a dependency on an empty string -- caused the first build failure)
- Use termux_setup_golang in termux_step_pre_configure() - Build with CGO_ENABLED=0 for pure Go compilation #########

3. Build via Docker

```
cd termux-packages
bash scripts/run-docker.sh
#### Inside container:
./build-package.sh -f -I tea
```

The -f flag forces rebuild, -I downloads dependencies from Termux repos instead of building them locally.

#########

4. Result

-
  • Output: output/tea_0.14.0_aarch64.deb (6.2MB)
- Install on device: pkg install ./output/tea_0.14.0_aarch64.deb ######

Phase 2 -- Contribute Upstream

#########

Submitting to termux-packages

1.
  1. Fork https://github.com/termux/termux-packages
2. Add packages/tea/build.sh to your fork 3. Create PR with commit message: addpkg(main/tea): add tea CLI for Gitea servers #########

Packaging Policy Compliance

-
  • MIT licensed
- Active project (233+ stars on Gitea) - Pure Go (no CGO issues, no native deps) - Not installable via language-specific package manager - Package size under 100MB ######

Known Issues Encountered

1.
**Empty TERMUX_PKG_DEPENDS**TERMUX_PKG_DEPENDS -- Setting TERMUX_PKG_DEPENDS= causes parse error: "depends on non-existing package". Fix: omit the line entirely. 2. **NDK not installed**installed -- Local build fails without Android NDK. Fix: use Docker builder image instead. 3. **SSH sudo**sudo -- run-docker.sh requires TERMUX_DOCKER_USE_SUDO=1 unless user has sorted sudo permissions. ######

Build Time

Approximately 5-15 minutes for first build (downloading Go toolchain, fetching all Go module dependencies, cross-compilation). Subsequent builds are faster due to caching.