#!/usr/bin/env bash set -euo pipefail echo ">>> build_llama.sh starting at $(date)" if [ ! -d "llama.cpp" ]; then git clone https://github.com/ggml-org/llama.cpp fi cd llama.cpp git fetch --all --prune git checkout master || true git pull --ff-only || true BUILD_DIR="build" mkdir -p "${BUILD_DIR}" echo "Running cmake..." cmake -S . -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE=Release -DLLAMA_CURL=ON || { echo "cmake configuration failed" exit 2 } echo "Building (this can take many minutes)..." cmake --build "${BUILD_DIR}" --config Release --parallel $(nproc) || { echo "cmake build failed" exit 3 } echo "Build finished. Binaries should be in ${BUILD_DIR}/bin" ls -la "${BUILD_DIR}/bin" || true echo ">>> build_llama.sh finished at $(date)"