diff --git a/.gitignore b/.gitignore index 54ad0d1..c6ce3e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1 @@ /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/0001-libwhisper.so-should-be-position-independent.patch b/0001-libwhisper.so-should-be-position-independent.patch new file mode 100644 index 0000000..a26f2dc --- /dev/null +++ b/0001-libwhisper.so-should-be-position-independent.patch @@ -0,0 +1,27 @@ +From 37bd815bdf19522e50fd00478cbc962d05715db8 Mon Sep 17 00:00:00 2001 +From: Tom Rix +Date: Sat, 20 Jan 2024 08:38:15 -0500 +Subject: [PATCH] libwhisper.so should be position independent + +This is similar to how libllama.so is built. + +Signed-off-by: Tom Rix +--- + CMakeLists.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 01e64c4..a97f9c9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -504,6 +504,7 @@ else() + endif() + + if (BUILD_SHARED_LIBS) ++ set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) + target_link_libraries(${TARGET} PUBLIC + ${CMAKE_DL_LIBS} + ) +-- +2.43.0 + diff --git a/sources b/sources index 22e1739..f06b5fa 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (whisper.cpp-1.9.3.tar.gz) = 5e01ca94a49438b71e38c3cab710cf75a7aa76a1ae03fe8f81b1a5beb794becb1ae1c6e078e3eea5526e4ad89ae4cc0306d17974541050afb3a7ac1d09f94768 +SHA512 (whisper.cpp-1.5.4.tar.gz) = 0375c32bc5a590e6152e1a37059554371ceab99b3c93a733c084cec356c477ab2bc2d78fc0b661104153be0becb41f0edeff68ab762cb51c528309055c141455 diff --git a/whisper-cpp.spec b/whisper-cpp.spec index 2530b24..927c834 100644 --- a/whisper-cpp.spec +++ b/whisper-cpp.spec @@ -8,63 +8,21 @@ License: MIT # examples/whisper.android/gradlew* # These are not distributed -Version: 1.9.3 +Version: 1.5.4 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 +# https://github.com/ggerganov/whisper.cpp/pull/1792 +Patch1: 0001-libwhisper.so-should-be-position-independent.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,77 +67,35 @@ recognition (ASR) model: %prep %autosetup -p1 -n whisper.cpp-%{version} +# verson the *.so +sed -i -e 's/POSITION_INDEPENDENT_CODE ON/POSITION_INDEPENDENT_CODE ON SOVERSION %{version}/' 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} \ - -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 + -DWHISPER_BUILD_TESTS=ON \ + -DWHISPER_NO_AVX=ON \ + -DWHISPER_NO_AVX2=ON \ + -DWHISPER_NO_FMA=ON \ + -DWHISPER_NO_F16C=ON %cmake_build %install %cmake_install -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 +%{_libdir}/libwhisper.so.%{version} %files devel %doc README.md -%{_includedir}/*.h -%{_libdir}/libggml.so -%{_libdir}/libggml-base.so -%{_libdir}/libggml-cpu.so -%{_libdir}/libparakeet.so +%{_includedir}/ggml.h +%{_includedir}/whisper.h %{_libdir}/libwhisper.so -%{_libdir}/cmake/ggml/ -%{_libdir}/cmake/parakeet/ -%{_libdir}/cmake/whisper/ -%{_libdir}/pkgconfig/parakeet.pc - -%if %{with rocm} -%{_libdir}/libggml-hip.so -%endif %changelog %autochangelog