blob: deafc91c3d1247072491fe39bd0e877b4cc406bd (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# Maintainer: envolution
# Contributor: txtsd <aur.archlinux@ihavea.quest>
# shellcheck shell=bash disable=SC2034,SC2154
# ci|prebuild=setcommitid.sh,envset_aur_llamacpp_build_universal=true| https://github.com/envolution/aur/blob/main/maintain/build/llama.cpp-cuda/setcommitid.sh
: ${aur_llamacpp_build_universal:=false}
pkgname=llama.cpp-cuda
_pkgname="${pkgname%-cuda}"
pkgver=b6490
pkgrel=1
_build_number=6490
_commit_id=8ff2060
pkgdesc="Port of Facebook's LLaMA model in C/C++ (with NVIDIA CUDA optimizations)"
arch=(x86_64 armv7h aarch64)
url='https://github.com/ggerganov/llama.cpp'
license=('MIT')
depends=(
cuda
curl
gcc-libs
glibc
nvidia-utils
)
makedepends=(
cmake
)
optdepends=(
'python-numpy: needed for convert_hf_to_gguf.py'
'python-safetensors: needed for convert_hf_to_gguf.py'
'python-sentencepiece: needed for convert_hf_to_gguf.py'
'python-pytorch: needed for convert_hf_to_gguf.py'
'python-transformers: needed for convert_hf_to_gguf.py'
)
provides=(${_pkgname})
conflicts=(${_pkgname} libggml ggml)
replaces=(llama.cpp-cuda-f16)
source=(
"${pkgname}-${pkgver}.tar.gz::https://github.com/ggml-org/llama.cpp/archive/refs/tags/${pkgver}.tar.gz"
llama.cpp.conf
llama.cpp.service
)
sha256sums=('aef4fa45eb7ebc1f3e04744b465670dd006ad8db86de68234a6928de15050298'
'53fa70cfe40cb8a3ca432590e4f76561df0f129a31b121c9b4b34af0da7c4d87'
'0377d08a07bda056785981d3352ccd2dbc0387c4836f91fb73e6b790d836620d')
prepare() {
ln -sf "${_pkgname}-${pkgver}" llama.cpp
}
build() {
# This may not be set if the user's session
# has not restarted on a new 'cuda' install
if [[ -z "${NVCC_CCBIN}" ]]; then
source /etc/profile
fi
local _cmake_options=(
-B build
-S "${_pkgname}"
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX='/usr'
-DBUILD_SHARED_LIBS=ON
-DLLAMA_CURL=ON
-DLLAMA_BUILD_TESTS=OFF
-DLLAMA_USE_SYSTEM_GGML=OFF
-DGGML_ALL_WARNINGS=OFF
-DGGML_ALL_WARNINGS_3RD_PARTY=OFF
-DGGML_BUILD_EXAMPLES=OFF
-DGGML_BUILD_TESTS=OFF
-DGGML_LTO=ON
-DGGML_RPC=ON
-DGGML_CUDA=ON
-DGGML_BUILD_SERVER=ON
-DLLAMA_BUILD_NUMBER="${_build_number}"
-DLLAMA_BUILD_COMMIT="${_commit_id}"
-Wno-dev
)
if [[ ${aur_llamacpp_build_universal} == true ]]; then
echo "Building universal binary [aur_llamacpp_build_universal == true]"
_cmake_options+=(
-DGGML_BACKEND_DL=ON
-DGGML_NATIVE=OFF
-DGGML_CPU_ALL_VARIANTS=ON
)
else
# we lose GGML_NATIVE_DEFAULT due to how makepkg includes
# $SOURCE_DATE_EPOCH in ENV
_cmake_options+=(
-DGGML_NATIVE=ON
)
fi
# Allow user-specified additional flags
if [[ -n "${aur_llamacpp_cmakeopts:-}" ]]; then
echo "Applying custom CMake options: ${aur_llamacpp_cmakeopts}"
# shellcheck disable=SC2206 # intentional word splitting
_cmake_options+=(${aur_llamacpp_cmakeopts})
fi
cmake "${_cmake_options[@]}"
cmake --build build
}
package() {
DESTDIR="${pkgdir}" cmake --install build
install -Dm644 "${_pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
install -Dm644 "llama.cpp.conf" "${pkgdir}/etc/conf.d/llama.cpp"
install -Dm644 "llama.cpp.service" "${pkgdir}/usr/lib/systemd/system/llama.cpp.service"
}
# vim:set ts=2 sw=2 et:
|