summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2cfec9f71c99e87b18b55368998dcd7867cce8c4 (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
# Maintainer: TheBill2001 <tuantran1632001 at gmail dot com>
# Contributer: Alpin <alpin 'at' alpindale 'dot' dev>
# Author: LostRuins (concedo), YellowRoseCx

# Build configuration could be change with environment variables.
# Or via `${XDG_CONFIG_HOME}/koboldcpp_build.conf` (default is `~/.config/koboldcpp_build.conf`).
#
# Disabling portable build
# KOBOLDCPP_NO_PORTABLE:
#   '0' - Keep portable build enabled (default)
#   '1' or any other value that isn't '0' - Disable portable build.

: ${KOBOLDCPP_BUILD_CONF:=${XDG_CONFIG_HOME:-~/.config}/koboldcpp_build.conf}
: ${KOBOLDCPP_NO_PORTABLE:=0}

pkgname=koboldcpp-hipblas
_pkgver=1.79.1
pkgver=$_pkgver.yr1
_git_pkgver=$pkgver-ROCm
pkgrel=1
pkgdesc="An easy-to-use AI text-generation software for GGML and GGUF models (with HIPBLAS, for ROCM)"
arch=('x86_64')
url="https://github.com/YellowRoseCx/koboldcpp-rocm"
license=('AGPL-3.0-only')
depends=(
  'python'
  'cblas'
  'clblast'
  'vulkan-icd-loader'
  'hipblas'
)
optdepends=(
  'python-customtkinter: for GUI launcher'
  'python-psutil: increasing the process CPU priority'
)
provides=("koboldcpp=$_pkgver" "koboldcpp-rocm=$_pkgver")
conflicts=('koboldcpp')
source=(
  "$pkgname-${_git_pkgver}.tar.gz::https://github.com/YellowRoseCx/koboldcpp-rocm/archive/refs/tags/v${_git_pkgver}.tar.gz"
  'koboldcpp.desktop'
  'koboldcpp.png'
)
sha256sums=(
  'c09d4803b861ca5b6a7e9cee37378eca085028580199cf4c1f7c689f0fb3add1'
  'fcec7b843b908e1c03496fdc0605e6509f52526a855c43db16e287ef646503ef'
  'd244788c74a693a383bea7db6ab2bb2f762e6020de900be977b16e18dcd20f54'
)

build() {
  if [ -f "${KOBOLDCPP_BUILD_CONF}" ]; then
    echo "Using config from ${KOBOLDCPP_BUILD_CONF}"
    source "${KOBOLDCPP_BUILD_CONF}"
  fi

  if [ "${KOBOLDCPP_NO_PORTABLE}" == "0" ]; then
    export LLAMA_PORTABLE=1
  fi

  export LLAMA_VULKAN=1
  export LLAMA_CLBLAST=1
  export LLAMA_HIPBLAS=1

  cd "$srcdir/koboldcpp-rocm-${_git_pkgver}"

  make clean && make
}

package() {
  cd "$srcdir/koboldcpp-rocm-${_git_pkgver}"

  install -d "$pkgdir/usr/share/koboldcpp"

  install -Dm644 ./*.so "$pkgdir/usr/share/koboldcpp/"
  install -Dm644 ./*.embd "$pkgdir/usr/share/koboldcpp/"

  install -d "$pkgdir/usr/share/koboldcpp/kcpp_adapters"
  install -m644 "kcpp_adapters"/* "$pkgdir/usr/share/koboldcpp/kcpp_adapters/"

  install -Dm644 "koboldcpp.py" "$pkgdir/usr/share/koboldcpp/koboldcpp.py"

  echo '#!/bin/sh' > koboldcpp
  echo 'python /usr/share/koboldcpp/koboldcpp.py "$@"' >> koboldcpp

  install -Dm755 koboldcpp "$pkgdir/usr/bin/koboldcpp"

  install -Dm644 "$srcdir/koboldcpp.desktop" "$pkgdir/usr/share/applications/koboldcpp.desktop"
  install -Dm644 "$srcdir/koboldcpp.png" "$pkgdir/usr/share/icons/hicolor/512x512/apps/koboldcpp.png"
}