npm package: @mmmbuto/llama-cpp-termux-snapdragon
Description: Prebuilt llama.cpp for Android Termux (arm64), Snapdragon-friendly build with bundled ggml/llama shared libs.
Latest version: 0.8012.8-termux.338085c6-snapdragon

# llama.cpp - Termux (Snapdragon)

> Upstream `llama.cpp`, built for Android Termux (arm64) with bundled `.so`, tuned for Qualcomm Snapdragon devices.

[![npm](https://img.shields.io/npm/v/@mmmbuto/llama-cpp-termux-snapdragon?style=flat-square&logo=npm)](https://www.npmjs.com/package/@mmmbuto/llama-cpp-termux-snapdragon)
[![downloads](https://img.shields.io/npm/dt/@mmmbuto/llama-cpp-termux-snapdragon?style=flat-square)](https://www.npmjs.com/package/@mmmbuto/llama-cpp-termux-snapdragon)

Prebuilt `llama.cpp` binaries for **Android Termux (arm64)** with **bundled shared libraries** for maximum CPU performance on **Snapdragon**.

## What This Is

- Prebuilt `llama.cpp` binaries for **Termux on Android (arm64)**.
- Optimized build profile intended for **Qualcomm Snapdragon** devices.
- This is intended as the "safe default" profile (no Pixel/Tensor-specific assumptions).

Exact upstream commit + build flags for this specific release are recorded in `docs/build_meta.txt`.

This is intended as the "safe default" build (DOTPROD-first; no Pixel/Tensor-specific assumptions).

### Commands (No Clobbering Termux PKG)

This package intentionally installs **namespaced** commands so you can keep the Termux package `llama-cpp` installed for benchmarks:

- `llama-cli-snapdragon`
- `llama-bench-snapdragon`
- `llama-server-snapdragon`

## Installation

```sh
pkg update && pkg upgrade -y
pkg install -y nodejs-lts openssl
npm install -g @mmmbuto/llama-cpp-termux-snapdragon
```

### Automatic Runtime Deps (postinstall)

On Termux, the npm `postinstall` step will attempt to install missing runtime packages automatically via `pkg`:

- `openssl` (for `libssl.so.3` / `libcrypto.so.3`)
- `libc++` (for `libc++_shared.so`)

To skip (CI/dry runs):

```sh
export LLAMA_CPP_TERMUX_SKIP_PKG_INSTALL=1
```

## Verify

```sh
llama-cli-snapdragon --version
llama-bench-snapdragon -h
```

## Benchmarks

This package is designed to be installed **alongside** the Termux `llama-cpp` package so you can compare:

- Termux PKG: `llama-bench`
- Snapdragon build: `llama-bench-snapdragon`

## Build (Repro)

See `docs/build_meta.txt` for the exact build metadata.

High-level build steps:

```sh
pkg install -y git cmake ninja clang make openssl

git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
git checkout 338085c69e486b7155e5b03d7b5087e02c0e2528

cmake -S . -B build-android-snap -DCMAKE_BUILD_TYPE=Release \
  -DGGML_OPENMP=ON -DLLAMA_OPENSSL=ON \
  -DLLAMA_BUILD_SERVER=ON -DLLAMA_BUILD_TOOLS=OFF -DLLAMA_BUILD_TESTS=OFF \
  -DGGML_BACKEND_DL=OFF \
  -DGGML_NATIVE=OFF -DGGML_CPU_ARM_ARCH=armv8.2-a+dotprod

cmake --build build-android-snap -j"$(nproc)"
```

## Packaging Details (.so)

This package bundles these libraries under `lib/`:

- `libggml*.so*`, `libllama*.so*`, `libmtmd*.so*`

The wrappers in `bin/` set `LD_LIBRARY_PATH` so the binaries use the packaged `.so`.

## License

Upstream `llama.cpp` is MIT licensed. This package redistributes compiled binaries from upstream and includes the upstream LICENSE.