summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD50
1 files changed, 50 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..9644c3399339
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,50 @@
+# Maintainer: AlphaJack <alphajack at tuta dot io>
+
+# to create a package for another locale, check the available locales from
+# https://huggingface.co/rhasspy/piper-voices/tree/main
+# then copy this PKGBUILD and adjust $_lang and $_region accordingly
+
+_lang="it"
+_region="IT"
+
+_regionSmall=${_region,,}
+_locale="${_lang}_${_region}"
+pkgname="piper-voices-${_lang}-${_regionSmall}"
+pkgver=1.0.0
+pkgrel=1
+pkgdesc="Voices for Piper text to speech system ($_locale)"
+url="https://huggingface.co/rhasspy/piper-voices"
+license=("MIT")
+arch=("any")
+groups=("piper-voices")
+provides=("piper-voices")
+depends=("piper-voices-common")
+makedepends=("git-lfs")
+
+prepare(){
+ # needed to avoid smudge error
+ rm -rf "piper-voices"
+
+ # download the full repo (~220MB) but keep the lfs pointers
+ GIT_LFS_SKIP_SMUDGE=1 git clone "https://huggingface.co/rhasspy/piper-voices"
+
+ # define specific models to be downloaded
+ cd "piper-voices"
+ mapfile -t _models < <(find . -type f -name "*$_locale*.onnx" -printf "/%P\n")
+ echo 'Downloading the following models:'
+ printf '%s\n' ${_models[*]}
+
+ # convert specific lfs pointers into actual models
+ git lfs pull --include $(IFS=,; echo "${_models[*]}")
+}
+
+package(){
+ # copy only the specific locale
+ cd "piper-voices"
+ install -d "$pkgdir/usr/share/piper-voices/$_lang"
+ cp -r "$_lang/$_locale" "$pkgdir/usr/share/piper-voices/$_lang"
+
+ # remove mp3 samples
+ find "$pkgdir/usr/share/piper-voices" -type d -name 'samples' -exec rm -rf {} +
+}
+