# Maintainer: opencode (test build) # Contributor: Bink (original design) # Difference from upstream: blobless partial clone + shared persistent source # cache, so the ~418 MiB full history is never downloaded. Commits and tags # are kept, so `git describe` still works. pkgname=ggml-cuda-git _srcname=llama.cpp _srccache="${LLAMACPP_SRC_CACHE:-${XDG_CACHE_HOME:-${HOME}/.cache}/llama.cpp-git}" pkgver=b10268.r3.2f56fc34 pkgrel=1 epoch=1 pkgdesc="Tensor library for machine learning (with NVIDIA CUDA optimizations)" arch=(x86_64 aarch64) url='https://github.com/ggml-org/ggml' license=('MIT') : "${aur_ggml_build_universal:=false}" depends=( cuda gcc-libs glibc nvidia-utils ) makedepends=( cmake gcc15 # CUDA does not yet support GCC 16 git ninja ) optdepends=( 'nccl: needed for multi-GPU parallelism (rebuild required)' 'rdma-core: RDMA transport for RPC backend (rebuild required)' ) provides=( ggml-cuda-git libggml libggml.so ggml ) conflicts=( libggml ggml ) # No git source here: the clone happens in prepare() from a shared blobless # cache, so ggml-cuda-git and llama.cpp-cuda-git never download the history twice. source=() sha256sums=() pkgver() { cd "${_srcname}" || return 1 if git describe --long --tags >/dev/null 2>&1; then git describe --long --tags | sed 's/\([^-]*-\)g/r\1/;s/-/./g' else printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" fi } prepare() { # Shared blobless source cache (dedup across packages + persistent across builds). if [[ ! -d "${_srccache}/.git" ]]; then git clone --filter=blob:none --no-checkout --single-branch \ https://github.com/ggml-org/llama.cpp.git "${_srccache}" else git -C "${_srccache}" fetch --prune origin fi git -C "${_srccache}" checkout --force --detach origin/master # Clone from the shared cache (copy across filesystems). The network download # happens only once, into the cache; this is fast local disk I/O. git clone --local --no-hardlinks --no-checkout "${_srccache}" "${srcdir}/${_srcname}" git -C "${srcdir}/${_srcname}" checkout --detach origin/master } build() { if ! type -P nvcc &>/dev/null && [[ -d /opt/cuda/bin ]]; then export PATH="/opt/cuda/bin:$PATH" fi # Wrap ggml/ in a tiny standalone project; see upstream comment: # building ggml/ directly trips llama.cpp's "standalone" detection. local _wrapper="${srcdir}/_ggml_wrapper" mkdir -p "${_wrapper}" cat > "${_wrapper}/CMakeLists.txt" <