%global pypi_name pywhispercpp %global _python_dist_allow_version_zero 0 %global debug_package %{nil} %global whisper_version 1.8.2 Name: %{pypi_name} Version: 1.4.0 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/refs/tags/v%{whisper_version}.tar.gz BuildRequires: gcc-c++ BuildRequires: python3-devel BuildRequires: chrpath BuildRequires: pybind11-devel Provides: bundled(whisper.cpp) = %{whisper_version} %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} # Remove already present pybind11 & whisper.cpp from pywhispercpp rm -rf pybind11 rm -rf whisper.cpp tar -xzf %{SOURCE1} mv whisper.cpp-%{whisper_version} 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 # Enable Native CPU Optimizations for GGML export CMAKE_ARGS=" -DGGML_NATIVE=ON -Dpybind11_DIR=%{_libdir}/cmake/pybind11" export NO_REPAIR=1 export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} _pywhispercpp # Remove rpath from libraries chrpath --replace '$ORIGIN' %{buildroot}%{python3_sitearch}/_pywhispercpp*.so chrpath --replace '$ORIGIN' %{buildroot}%{python3_sitearch}/libggml-cpu.so chrpath --replace '$ORIGIN' %{buildroot}%{python3_sitearch}/libggml.so chrpath --replace '$ORIGIN' %{buildroot}%{python3_sitearch}/libwhisper.so.1 rm -rf %{buildroot}%{python3_sitearch}/libwhisper.so rm -rf %{buildroot}%{python3_sitearch}/libwhisper.so.%{whisper_version} # 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 %changelog * Tue Dec 9 2025 Manish Tiwari - 1.4.0-1 - Initial import