whisper.cpp: install the script for downloading models as well

And adjust it to download them to where the executables expect
them to be by default.

whisper.cpp isn't really meant to be installed, so we make up our
own workflow here...
This commit is contained in:
Christoph Reiter
2023-12-01 11:23:14 +01:00
parent 1526aa92b7
commit 47bb18fab4
2 changed files with 24 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
--- whisper.cpp-1.5.1/models/download-ggml-model.sh.orig 2023-12-01 11:17:20.703388700 +0100
+++ whisper.cpp-1.5.1/models/download-ggml-model.sh 2023-12-01 11:17:38.547029400 +0100
@@ -19,7 +19,8 @@
fi
}
-models_path="$(get_script_path)"
+models_path="$(pwd)/models"
+mkdir -p "$models_path"
# Whisper models
models=(

View File

@@ -24,10 +24,13 @@ makedepends=(
source=("https://github.com/ggerganov/whisper.cpp/archive/refs/tags/v${pkgver}.tar.gz"
"0001-fix-importlib-location.patch"
"0002-fix-openblas-lookup.patch"
"0003-server-fix-missing-lib.patch")
"0003-server-fix-missing-lib.patch"
"0004-download-models-pwd.patch")
sha256sums=('ccf17e3283bcde3d09d333889528f3494e196f8a173d5023fec068a0dfae8f76'
'30765001468dbc40893a2a63e675b2b40f290e27c3314e82dd7f72404d2d1ccf'
'0314546c2ab5810ba84d4b2e14a84f992a282fc57698bd7a678756f8f6d13171')
'0314546c2ab5810ba84d4b2e14a84f992a282fc57698bd7a678756f8f6d13171'
'0d29b3df33df73683c2f3c3c02e3e522d9a1dbd3eaf8ac5fd6c920d81364fdd2'
'5d2290937b6407f97d60f8fb0bf0f270a95820611c951464a217e86a3a0f35e4')
noextract=("v${pkgver}.tar.gz")
prepare() {
@@ -37,6 +40,10 @@ prepare() {
patch -p1 -i "${srcdir}/0001-fix-importlib-location.patch"
patch -p1 -i "${srcdir}/0002-fix-openblas-lookup.patch"
patch -p1 -i "${srcdir}/0003-server-fix-missing-lib.patch"
# So that "whisper.cpp-download-ggml-model.sh base.en"
# is all that's needed to get started
patch -p1 -i "${srcdir}/0004-download-models-pwd.patch"
}
build() {
@@ -82,5 +89,8 @@ package() {
mv "${pkgdir}${MINGW_PREFIX}/bin/${_realname}-main.exe" \
"${pkgdir}${MINGW_PREFIX}/bin/${_realname}.exe"
install -Dm755 "${srcdir}/${_realname}-${pkgver}/models/download-ggml-model.sh" \
"${pkgdir}${MINGW_PREFIX}/bin/${_realname}-download-ggml-model.sh"
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}