File size: 780 Bytes
f4931e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/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"