summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d2b7a48144a4878a6cb23e58b98262af075cb09d (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
# Maintainer: txtsd <aur.archlinux@ihavea.quest>

pkgname=llama.cpp-opencl
_pkgname=${pkgname%%-opencl}
pkgver=b4033
pkgrel=1
pkgdesc="Port of Facebook's LLaMA model in C/C++ (with OpenCL optimizations)"
arch=('x86_64' 'armv7h' 'aarch64')
url='https://github.com/ggerganov/llama.cpp'
license=('MIT')
depends=(
  'curl'
  'gcc-libs'
  'glibc'
  'python'
  'python-numpy'
  'python-sentencepiece'
  'blas-openblas'
  'blas64-openblas'
  'openmp'
)
makedepends=(
  'clblast'
  'cmake'
  'git'
  'opencl-headers'
  'opencl-clhpp'
  'ocl-icd'
  'pkgconf'
)
provides=(${_pkgname})
conflicts=(${_pkgname})
options=(lto)
source=(
  "git+${url}#tag=${pkgver}"
  "git+https://github.com/nomic-ai/kompute.git"
  'llama.cpp.conf'
  'llama.cpp.service'
)
sha256sums=('3299f2b01218723720e42f9bd035d14ec06eb1df86d1e77ce3ff1b9f2c96bc40'
            'SKIP'
            '53fa70cfe40cb8a3ca432590e4f76561df0f129a31b121c9b4b34af0da7c4d87'
            '065f69ccd7ac40d189fae723b58d6de2a24966e9b526e0dbfa3035a4c46a7669')

prepare() {
  cd "${_pkgname}"

  git submodule init
  git config submodule.kompute.url "${srcdir}/kompute"
  git -c protocol.file.allow=always submodule update
}

build() {
  cd "${_pkgname}"
  cmake -S . -B build \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=ON \
    -DGGML_ALL_WARNINGS_3RD_PARTY=ON \
    -DGGML_BLAS=ON \
    -DGGML_LTO=ON \
    -DGGML_RPC=ON \
    -DLLAMA_CURL=ON \
    -DLLAMA_FATAL_WARNINGS=ON \
    -DGGML_CLBLAST=ON
  cmake --build build --config Release
}

package() {
  cd "${_pkgname}"

  DESTDIR="${pkgdir}" cmake --install build
  install -Dm644 'LICENSE' "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  install -Dm644 "${srcdir}/llama.cpp.conf" "${pkgdir}/etc/conf.d/llama.cpp"
  install -Dm644 "${srcdir}/llama.cpp.service" "${pkgdir}/usr/lib/systemd/system/llama.cpp.service"
}