diff --git a/.gitignore b/.gitignore index 54ad0d1..08700e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,3 @@ /whisper.cpp-1.5.4.tar.gz /whisper.cpp-1.6.2.tar.gz /whisper.cpp-1.7.1.tar.gz -/whisper.cpp-1.7.6.tar.gz -/whisper.cpp-1.8.1.tar.gz -/whisper.cpp-1.8.3.tar.gz -/whisper.cpp-1.9.2.tar.gz -/whisper.cpp-1.9.3.tar.gz diff --git a/0001-Generalize-install-locations.patch b/0001-Generalize-install-locations.patch new file mode 100644 index 0000000..e5f6444 --- /dev/null +++ b/0001-Generalize-install-locations.patch @@ -0,0 +1,62 @@ +From 62ce17eb08b838fd4ac78d7fc3ece57694aad32a Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Sat, 20 Jan 2024 08:00:46 -0500 +Subject: [PATCH] Generalize install locations + +On Fedora the install location is dependent on the arch +ex/ for x86_64 libraries install to /usr/lib64 + +So copy how llama-cpp does its install, replacing 'llama' with 'whisper' +in the cmake variables. + +Signed-off-by: Tom Rix +--- + CMakeLists.txt | 17 ++++++++++++----- + cmake/DefaultTargetOptions.cmake | 4 ++-- + 2 files changed, 14 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 567a58d..01e64c4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -549,12 +549,19 @@ set_target_properties(${TARGET} PROPERTIES PUBLIC_HEADER "ggml.h;whisper.h") + + include(GNUInstallDirs) + ++set(WHISPER_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} ++ CACHE PATH "Location of header files") ++set(WHISPER_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} ++ CACHE PATH "Location of library files") ++set(WHISPER_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} ++ CACHE PATH "Location of binary files") ++ + install(TARGETS ${TARGET} +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib/static +- RUNTIME DESTINATION bin +- RESOURCE DESTINATION bin +- PUBLIC_HEADER DESTINATION include ++ LIBRARY DESTINATION "${WHISPER_LIB_INSTALL_DIR}" ++ ARCHIVE DESTINATION "${WHISPER_LIB_INSTALL_DIR}/static" ++ RUNTIME DESTINATION "${WHISPER_BIN_INSTALL_DIR}" ++ RESOURCE DESTINATION "${WHISPER_BIN_INSTALL_DIR}" ++ PUBLIC_HEADER DESTINATION "${WHISPER_INCLUDE_INSTALL_DIR}" + ) + + # +diff --git a/cmake/DefaultTargetOptions.cmake b/cmake/DefaultTargetOptions.cmake +index b4e93e3..277b99e 100644 +--- a/cmake/DefaultTargetOptions.cmake ++++ b/cmake/DefaultTargetOptions.cmake +@@ -12,6 +12,6 @@ target_compile_features(${TARGET} + set_target_properties(${TARGET} + PROPERTIES + EXPORT_COMPILE_COMMANDS ON +- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" +- INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" ++ RUNTIME_OUTPUT_DIRECTORY "${WHISPER_BIN_INSTALL_DIR}" ++ INSTALL_RPATH "${WHISPER_LIB_INSTALL_DIR}" + ) +-- +2.43.0 + diff --git a/sources b/sources index 22e1739..05cdd43 100644 --- a/sources +++ b/sources @@ -1 +1,3 @@ -SHA512 (whisper.cpp-1.9.3.tar.gz) = 5e01ca94a49438b71e38c3cab710cf75a7aa76a1ae03fe8f81b1a5beb794becb1ae1c6e078e3eea5526e4ad89ae4cc0306d17974541050afb3a7ac1d09f94768 +SHA512 (whisper.cpp-1.5.4.tar.gz) = 0375c32bc5a590e6152e1a37059554371ceab99b3c93a733c084cec356c477ab2bc2d78fc0b661104153be0becb41f0edeff68ab762cb51c528309055c141455 +SHA512 (whisper.cpp-1.6.2.tar.gz) = 17e0485fb93fdea1a89f584a64db35f05371e0b8710a539f0dffca30bd3a2fff44c72ea754556566ca3cc55415b1e8f2bb868665437f5c93b9ce666b4fe53fb3 +SHA512 (whisper.cpp-1.7.1.tar.gz) = 944d8a6e4a770462e77139d918fd1d5b93efca377051d83a584d91164ec73fa50b5bfbc7d85014151b3b5c80fa59cfd386e456960401f8b3c66a9788585cac46 diff --git a/whisper-cpp.spec b/whisper-cpp.spec index 2530b24..9bbb207 100644 --- a/whisper-cpp.spec +++ b/whisper-cpp.spec @@ -8,63 +8,19 @@ License: MIT # examples/whisper.android/gradlew* # These are not distributed -Version: 1.9.3 +Version: 1.7.1 Release: %autorelease URL: https://github.com/ggerganov/whisper.cpp Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/whisper.cpp-%{version}.tar.gz +# https://github.com/ggerganov/whisper.cpp/pull/1791 +# Patch0: 0001-Generalize-install-locations.patch ExclusiveArch: x86_64 aarch64 ppc64le -%global toolchain gcc - -# OpenVINO only supports x86_64 and aarch64 -# Presently, Fedora only packages it on x86_64 -%ifarch x86_64 -# FTBFS 7/27/26 openvino needs rebuilding at least -%bcond_with openvino -%bcond_without rocm -%else -%bcond_with openvino -%bcond_with rocm -%endif - -%if %{with openvino} -%global build_openvino ON -%else -%global build_openvino OFF -%endif - -%if %{with rocm} -%global build_rocm ON -# need our own gpu list, without gfx1250 -%global rocm_gpu_list "gfx9-generic;gfx942;gfx950;gfx10-1-generic;gfx10-3-generic;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1152;gfx1153;gfx1200;gfx1201" -%else -%global build_rocm OFF -%global rocm_gpu_list %{nil} -%endif - -%bcond_with test -%if %{with test} -%global build_test ON -%else -%global build_test OFF -%endif - -%global sover %{version} +%global toolchain clang BuildRequires: cmake -BuildRequires: gcc-c++ -BuildRequires: git - -%if %{with openvino} -BuildRequires: openvino-devel -%endif - -%if %{with rocm} -BuildRequires: hipblas-devel -BuildRequires: rocblas-devel -BuildRequires: rocm-rpm-macros -%endif +BuildRequires: clang %description High-performance inference of OpenAI's Whisper automatic speech @@ -109,35 +65,22 @@ recognition (ASR) model: %prep %autosetup -p1 -n whisper.cpp-%{version} +# verson the ggml *.so +sed -i -e 's@POSITION_INDEPENDENT_CODE ON@POSITION_INDEPENDENT_CODE ON SOVERSION ${SOVERSION}@' ggml/src/CMakeLists.txt + %build + %cmake \ - -DCMAKE_HIP_ARCHITECTURES=%{rocm_gpu_list} \ - -DWHISPER_BUILD_EXAMPLES=%{build_test} \ - -DWHISPER_BUILD_SERVER=%{build_test} \ - -DWHISPER_BUILD_TESTS=%{build_test} \ - -DWHISPER_OPENVINO=%{build_openvino} \ - -DGGML_HIP=%{build_rocm} \ + -DWHISPER_BUILD_TESTS=ON \ -DGGML_NATIVE=OFF \ - -DGGML_AMX_TILE=OFF \ - -DGGML_AMX_INT8=OFF \ - -DGGML_AMX_BF16=OFF \ -DGGML_AVX=OFF \ - -DGGML_AVX_VNNI=OFF \ -DGGML_AVX2=OFF \ -DGGML_AVX512=OFF \ -DGGML_AVX512_VBMI=OFF \ -DGGML_AVX512_VNNI=OFF \ -DGGML_AVX512_BF16=OFF \ - -DGGML_BMI2=OFF \ -DGGML_FMA=OFF \ - -DGGML_F16C=OFF \ - -DGGML_LASX=OFF \ - -DGGML_LSX=OFF \ - -DGGML_RVV=OFF \ - -DGGML_RV_ZFH=OFF \ - -DGGML_SSE42=OFF \ - -DGGML_XTHEADVECTOR=OFF \ - -DGGML_VXE=OFF + -DGGML_F16C=OFF %cmake_build @@ -147,39 +90,21 @@ recognition (ASR) model: find %{buildroot} -name 'whisper.pc' -delete %check -%if %{with test} # FIXME: Tests have been disabled in upstream sources since v1.7.0 %ctest -%endif %files %license LICENSE %{_libdir}/libggml.so.* -%{_libdir}/libggml-base.so.* -%{_libdir}/libggml-cpu.so.* %{_libdir}/libwhisper.so.* -%{_libdir}/libparakeet.so.* - -%if %{with rocm} -%{_libdir}/libggml-hip.so.* -%endif %files devel %doc README.md -%{_includedir}/*.h +%{_includedir}/ggml*.h +%{_includedir}/whisper.h %{_libdir}/libggml.so -%{_libdir}/libggml-base.so -%{_libdir}/libggml-cpu.so -%{_libdir}/libparakeet.so %{_libdir}/libwhisper.so -%{_libdir}/cmake/ggml/ -%{_libdir}/cmake/parakeet/ -%{_libdir}/cmake/whisper/ -%{_libdir}/pkgconfig/parakeet.pc - -%if %{with rocm} -%{_libdir}/libggml-hip.so -%endif +%{_libdir}/cmake/whisper/*.cmake %changelog %autochangelog