Files
xavierk 0c48db5b5e
CI / security (push) Successful in 1m9s
CI / lint (push) Successful in 23s
CI / ai-review (push) Skipped
fix(void): report pywhispercpp 1.5.0 and load CPU variants at runtime (#49)
Fixes #43
Fixes #44
2026-11-06 18:51:30 +00:00

64 lines
2.9 KiB
Plaintext

# Template file for 'python3-pywhispercpp'
pkgname=python3-pywhispercpp
version=1.5.0
revision=1
build_style=python3-module
hostmakedepends="cmake pkg-config python3-setuptools python3-setuptools_scm python3-wheel $(vopt_if vulkan shaderc)"
makedepends="python3-devel $(vopt_if vulkan vulkan-loader-devel)"
depends="python3-numpy python3-requests python3-tqdm python3-platformdirs $(vopt_if vulkan vulkan-loader)"
short_desc="Python bindings for whisper.cpp speech recognition"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://github.com/absadiki/pywhispercpp"
distfiles="${PYPI_SITE}/p/pywhispercpp/pywhispercpp-${version}.tar.gz"
checksum=5aa54c73ec96617d97aa519dbbf817e44255eddd9bd52ee1243be61028dbd018
# The sdist ships no test suite, so there is nothing to check.
make_check=no
# Package build options
build_options="vulkan"
build_options_default="vulkan"
pre_build() {
# Version (#43). setup.py passes no version to setup(); the version comes
# from setuptools-scm, which the sdist declares as a build requirement and
# which hostmakedepends provides. The xbps build root has no git metadata,
# so pin the version through setuptools-scm. Without it setuptools falls
# back to 0.0.0. The sdist's PYWHISPERCPP_VERSION hook is never called.
export SETUPTOOLS_SCM_PRETEND_VERSION=${version}
# CPU (#44). GGML_BACKEND_DL builds each CPU variant (x64 baseline,
# sandybridge, haswell, icelake, zen4, ...) as its own library. The
# extension, through patches/, loads the variants that sit beside it, and
# ggml picks the best one the host CPU supports. The x64 baseline always
# ships, so the package still runs on any x86-64 CPU, and hosts with AVX2
# use it. GGML_NATIVE must stay OFF: ggml refuses it with GGML_BACKEND_DL,
# and it keeps -march=native out of every variant (#938).
# Shared libraries with an $ORIGIN rpath let each variant resolve
# libggml-base beside it, with no LD_LIBRARY_PATH at runtime. (setup.py
# install never builds a wheel, so NO_REPAIR is meaningless here.)
export CMAKE_ARGS='-DCMAKE_INSTALL_RPATH=$ORIGIN -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DBUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON'
if [ -n "$build_option_vulkan" ]; then
# Vulkan acceleration for every GPU vendor. There is no CUDA
# build: Void ships no CUDA toolkit package.
export GGML_VULKAN=1
fi
}
pre_install() {
# The backend modules (libggml-cpu-*.so, libggml-vulkan.so) are written to
# build/bin, a CMake directory whose whisper.cpp setup fixes, and setup.py
# installs only the build/lib tree that holds the extension. Copy them
# beside the extension, where patches/ loads them from.
local backend found=""
for backend in build/temp.*/_pywhispercpp/bin/libggml-*.so; do
[ -f "$backend" ] || continue
cp "$backend" build/lib.*/
found=1
done
[ -n "$found" ] || msg_error "no ggml backend modules were built; the CPU variants are missing\n"
}
post_install() {
vlicense LICENSE
}