#!/usr/bin/env bash set -euo pipefail if [[ $# -ne 1 ]]; then echo "usage: $0 /explicit/new/path/for/whisper.cpp" >&2 exit 2 fi target_path="$1" runtime_ref="${WHISPER_CPP_REF:-v1.9.2}" if [[ "$target_path" != /* || "$target_path" == "/" ]]; then echo "error: target must be an explicit absolute path other than /" >&2 exit 2 fi if [[ -e "$target_path" ]]; then echo "error: target already exists; refusing to alter it: $target_path" >&2 exit 2 fi git clone --branch "$runtime_ref" --depth 1 \ https://github.com/ggml-org/whisper.cpp.git "$target_path" cmake -S "$target_path" -B "$target_path/build" \ -DCMAKE_BUILD_TYPE=Release \ -DGGML_BLAS=1 cmake --build "$target_path/build" -j 4 --config Release echo "built whisper.cpp $runtime_ref at $target_path"