-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPKGBUILD.template
47 lines (35 loc) · 1.23 KB
/
PKGBUILD.template
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
# Maintainer: Hauke Rehfeld <[email protected]>
pkgname="${_pkgbase}-${_model}"
# our own artificial version number, but per model
pkgver=4
pkgrel=4
pkgdesc="This is an autogenerated file, please see https://github.com/hrehfeld/archlinux-whisper.cpp-model"
arch=("i686" "x86_64")
url="${_baseurl}/tree/master/models"
license=("MIT")
makedepends=()
depends=()
conflicts=()
provides=()
_model_file="ggml-${_model}.bin"
_model_path="/usr/share/$pkgname/${_model_file}"
__model_url() {
local model=$1
# copied from https://github.com/ggerganov/whisper.cpp/raw/master/models/download-ggml-model.sh
local src="https://huggingface.co/ggerganov/whisper.cpp"
local pfx="resolve/main/ggml"
if echo "$model" | grep -q "tdrz"; then
local src="https://huggingface.co/akashmjn/tinydiarize-whisper.cpp"
local pfx="resolve/main/ggml"
fi
echo $src/$pfx-"$model".bin
}
source=("$_model_file::$(__model_url $_model)")
sha256sums=("$_model_sha256sum")
package() {
install -Dm644 "${srcdir}/${_model_file}" "$pkgdir$_model_path"
wrapper="whisper.cpp-${_model}"
echo "#!/bin/sh
/usr/bin/whisper.cpp --model ${_model_path} "\"'$@'\" > "$srcdir/$wrapper"
install -Dm755 "${srcdir}/$wrapper" "$pkgdir/usr/bin/$wrapper"
}