%global pypi_name pywhispercpp %global _python_dist_allow_version_zero 0 %global debug_package %{nil} %global whisper_commit 4979e04f5dcaccb36057e059bbaed8a2f5288315 Name: %{pypi_name} Version: 1.3.3 Release: 1%{?dist} Summary: Python bindings for whisper.cpp with a simple Pythonic API # Architecture-specific due to C/C++ extensions ExcludeArch: %{ix86} License: MIT URL: https://github.com/absadiki/pywhispercpp Source0: %{pypi_source} Source1: https://github.com/ggml-org/whisper.cpp/archive/%{whisper_commit}/whisper.cpp-%{whisper_commit}.tar.gz BuildRequires: gcc-c++ BuildRequires: python3-devel BuildRequires: patchelf Provides: bundled(whisper.cpp) = 0~git%{whisper_commit} %description pywhispercpp provides Python bindings for whisper.cpp with a simple Pythonic API on top of it. %package -n python3-%{pypi_name} Summary: %{summary} Requires: python3-qt5 Provides: pywhispercpp = %{version}-%{release} %description -n python3-%{pypi_name} pywhispercpp provides Python bindings for whisper.cpp with a simple Pythonic API on top of it. %prep %autosetup -p1 -n %{pypi_name}-%{version} rm -rf whisper.cpp #tar -xzf %{SOURCE1} \ tar -xf %{SOURCE1} \ --exclude='*/ci' \ --exclude='*/bindings' \ --exclude='*/tests' \ --exclude='*/models' \ --exclude='*/samples' \ --exclude='*/scripts' \ --exclude='*/Makefile' \ --exclude='*/close-issue.yml' \ --exclude='*/build-xcframework.sh' \ --exclude='*/extra' mv whisper.cpp-%{whisper_commit} whisper.cpp # Remove shebang find pywhispercpp -name "*.py" -exec sed -i '/^#!/d' {} \; # Remove repairwheel from build dependencies as it is not available in fedora sed -i 's/"repairwheel",//g' pyproject.toml %generate_buildrequires %pyproject_buildrequires %build #export CFLAGS="$CFLAGS -O3 -march=native" #export CXXFLAGS="$CXXFLAGS -O3 -march=native" export CMAKE_ARGS="-DGGML_NATIVE=ON" export NO_REPAIR=1 export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} _pywhispercpp # Sets RPATH for shared libs to the site-packages directory so they can be found at runtime find %{buildroot}%{python3_sitearch} -type f -name "*.so*" -o -name "*.so" | while read lib; do patchelf --remove-rpath "$lib" 2>/dev/null patchelf --set-rpath "%{python3_sitearch}" "$lib" done # Removed below binaries as these require python-sounddevice & python-ffmpeg packages (missing in fedora) rm -rf %{buildroot}%{_bindir}/pwcpp-assistant rm -rf %{buildroot}%{_bindir}/pwcpp-recording rm -rf %{buildroot}%{_bindir}/pwcpp-livestream %check export LD_LIBRARY_PATH=%{buildroot}%{python3_sitearch}/%{pypi_name}:%{buildroot}%{python3_sitearch}:$LD_LIBRARY_PATH %pyproject_check_import -e "pywhispercpp.examples*" %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %{_bindir}/pwcpp* %{python3_sitearch}/libggml*.so %{python3_sitearch}/libwhisper.so.1 %exclude %{python3_sitearch}/libwhisper.so.1.8.2 %exclude %{python3_sitearch}/libwhisper.so %changelog * Tue Dec 9 2025 Manish Tiwari - 1.4.0-1 - Initial import