Termux: build with make, install to $PREFIX, no nl_langinfo on Android
ci / linux (clang) (push) Canceled after 0s
ci / linux (gcc) (push) Canceled after 0s
ci / sanitizers (push) Canceled after 0s
ci / musl (push) Canceled after 0s
ci / macos (push) Canceled after 0s

- bootstrap_termux.sh installs pkg-config/binutils, builds with make,
  runs the tests and installs into Termux's $PREFIX/bin.
- Makefile drops -lpthread on Android (pthreads are in bionic libc).
- TUI assumes UTF-8 on Android: nl_langinfo needs API 26, Termux
  targets 24. All sources compile for aarch64-linux-android24 (NDK 27).
This commit is contained in:
WHC
2026-10-05 01:55:49 +08:00
parent 2fde898da0
commit a77f27ed59
4 changed files with 29 additions and 20 deletions
+10 -15
View File
@@ -1,13 +1,12 @@
#!/data/data/com.termux/files/usr/bin/bash
# One-shot: clone + build CST-Agent on Android Termux.
# One-shot: clone, build and install CST-Agent on Android Termux.
set -euo pipefail
REPO_URL="${CST_AGENT_REPO:-https://git.whcself.xyz/WHC/CST-agent.git}"
DIR="${1:-CST-agent}"
echo "==> Termux packages"
pkg install -y git clang make cmake libcurl ncurses-ui-libs 2>/dev/null \
|| pkg install -y git clang make cmake curl ncurses
pkg install -y git clang make pkg-config binutils libcurl ncurses
if [[ ! -f "$DIR/Makefile" ]]; then
echo "==> git clone $REPO_URL -> $DIR"
@@ -15,17 +14,13 @@ if [[ ! -f "$DIR/Makefile" ]]; then
fi
cd "$DIR"
echo "==> cmake build (TUI)"
cmake -B build -DCMAKE_C_COMPILER=clang -DCST_BUILD_TUI=ON
cmake --build build -j"$(nproc 2>/dev/null || echo 4)"
# Also keep Makefile binary path convenience
cp -f build/cst-agent ./cst-agent 2>/dev/null || true
echo "==> build"
make -j"$(nproc 2>/dev/null || echo 4)"
make check || echo "warning: some tests failed (see above)"
echo "==> install to $PREFIX/bin"
make install
echo
echo "OK: ./cst-agent (or ./build/cst-agent)"
echo "OpenAI-compatible:"
echo " export OPENAI_API_KEY=sk-..."
echo " export OPENAI_BASE_URL=https://api.openai.com/v1"
echo " export OPENAI_MODEL=gpt-4.1-mini"
echo " ./cst-agent --workspace \$HOME"
echo "Docs: docs/env_openai.md"
echo "OK: run 'cst-agent' inside a project directory."
echo "The first start asks for the provider and its API key and saves them."