%global pypi_name pywhispercpp %global _python_dist_allow_version_zero 0 Name: python-%{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} #Patch1: w.patch BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-wheel BuildRequires: python3-pip BuildRequires: auditwheel BuildRequires: chrpath BuildRequires: patchelf BuildRequires: git-core %global _description %{expand: pywhispercpp provides Python bindings for whisper.cpp with a simple Pythonic API on top of it. It allows you to use OpenAI's Whisper speech recognition model with the performance benefits of the C++ implementation. The package supports various acceleration backends including CUDA, CoreML, Vulkan, OpenBLAS, and OpenVINO.} %description %{_description} %package -n python3-%{pypi_name} Summary: %{summary} Requires: python3-qt5 # ffmpeg is needed for transcribing files other than wav #Recommends: ffmpeg %description -n python3-%{pypi_name} %{_description} #%package -n python3-%{pypi_name}-devel #Summary: Development headers for %{name} #Requires: python3-%{pypi_name} = %{version}-%{release} #%description -n python3-%{pypi_name}+examples #This package installs extra dependencies needed to run the examples #included with pywhispercpp. #%package -n python3-%{pypi_name}+gui #Summary: GUI support for %{name} #Requires: python3-%{pypi_name} = %{version}-%{release} #Requires: python3-qt5 #%description -n python3-%{pypi_name}+gui #This package provides GUI support for pywhispercpp using PyQt5. #It provides the pwcpp-gui command for a graphical interface. %prep %autosetup -p1 -n %{pypi_name}-%{version} %build export NO_REPAIR=1 export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} export CMAKE_ARGS=" -DBUILD_SHARED_LIBS=ON -DWHISPER_BUILD_SHARED_LIBS=ON" %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} _pywhispercpp #cd /builddir/build/BUILD/python-pywhispercpp-1.3.3-build/pywhispercpp-1.3.3 #find . -name "libwhisper.so*" -exec file {} \; #find . -name "libwhisper.so*" -exec readelf -d {} \; | grep -E "(NEEDED|STATIC)" # Find all shared libraries and the Python extension #find %{buildroot}%{python3_sitearch} -type f -name "*.so" -o -name "*.so.*" | while read lib; do # # Remove any existing RPATH/RUNPATH that points to the build directory # patchelf --remove-rpath "$lib" 2>/dev/null || : # # Set a new RPATH to '$ORIGIN' (look in the same directory) # patchelf --set-rpath '$ORIGIN' "$lib" #done # Find the main Python extension and set its RPATH to the site-packages directory find %{buildroot}%{python3_sitearch} -name "_pywhispercpp*.so" -type f | while read lib; do echo "Setting RPATH for: $lib" patchelf --remove-rpath "$lib" 2>/dev/null # Set RPATH to the absolute install path patchelf --set-rpath "%{python3_sitearch}" "$lib" done # Optional: Do the same for libwhisper.so and libggml.so if they depend on each other find %{buildroot}%{python3_sitearch} -name "libwhisper*.so*" -o -name "libggml*.so*" | while read lib; do patchelf --set-rpath "%{python3_sitearch}" "$lib" 2>/dev/null done #find %{buildroot}%{python3_sitearch} -type f \( -name "*.so" -o -name "*.so.*" \) -exec chrpath --delete {} \; || : #mv %{buildroot}%{python3_sitearch}/libwhisper*.so* %{buildroot}%{_libdir}/ || : #mv %{buildroot}%{python3_sitearch}/libggml*.so* %{buildroot}%{_libdir}/ || : # Removed below binaries as these require python3-sounddevice & python3-ffmpeg packages (missing in fedora) rm -rf %{buildroot}%{_bindir}/pwcpp-assistant rm -rf %{buildroot}%{_bindir}/pwcpp-recording rm -rf %{buildroot}%{_bindir}/pwcpp-livestream %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %{_bindir}/pwcpp* %{python3_sitearch}/libggml*.so* %{python3_sitearch}/libwhisper*.so* #%files -n python3-%{pypi_name}-devel #%{_libdir}/libwhisper*.so* #%{_libdir}/libggml*.so* %changelog * Mon Nov 17 2025 Package Maintainer - 1.3.3-1 - Initial import