From: Mathieu Baudier Date: Tue, 21 Jan 2025 14:12:54 +0000 (+0100) Subject: Initial debian packaging X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=4e155effe60bad4e28b7b7e33a7964d94c11b0dd;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp Initial debian packaging --- diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 00000000..59bfabbf --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,10 @@ +# dpkg-buildpackage -b -us -uc +*.log +*.substvars +.debhelper +debhelper-build-stamp +files +tmp/ + +whisper-cpp*/ +libwhisper*/ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..85bdae96 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +whisper-cpp (1.7.4-1) unstable; urgency=medium + + * Based on whisper.cpp version 1.7.4 + + -- Mathieu Baudier Tue, 21 Jan 2025 14:02:39 +0000 diff --git a/debian/cmake/debian-whisper.cpp.cmake b/debian/cmake/debian-whisper.cpp.cmake new file mode 100644 index 00000000..e72f2778 --- /dev/null +++ b/debian/cmake/debian-whisper.cpp.cmake @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.14) # for add_link_options and implicit target directories. + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) + +# GGML dependencies +if (NOT TARGET ggml) +# libggml-base as external library +find_library(GGML_BASE_LOCATION ggml-base) +message (STATUS "Found GGML base library: ${GGML_BASE_LOCATION}") +add_library(ggml-base SHARED IMPORTED GLOBAL) +set_target_properties(ggml-base PROPERTIES IMPORTED_LOCATION ${GGML_BASE_LOCATION}) + +# libggml as external library +# defines GGML as target so that it is disabled in whisper.cpp build +find_library(GGML_LOCATION ggml) +message (STATUS "Found GGML library: ${GGML_LOCATION}") +add_library(ggml SHARED IMPORTED GLOBAL) +set_target_properties(ggml PROPERTIES IMPORTED_LOCATION ${GGML_LOCATION}) +# transitive dependency +target_link_libraries(ggml INTERFACE ${GGML_BASE_LOCATION}) + +# quite a few examples require direct reference to ggml-cpu +#find_library(GGML_CPU_LOCATION ggml-cpu-sandybridge) +#message (STATUS "Found GGML CPU library: ${GGML_CPU_LOCATION}") +#link_libraries("/usr/libexec/${CMAKE_LIBRARY_ARCHITECTURE}/ggml/libggml-cpu-sandybridge.so") +endif() + +add_compile_definitions(NDEBUG) + + +# install common +install(DIRECTORY ${CMAKE_BINARY_DIR}/examples/ DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/whisper.cpp/common FILES_MATCHING PATTERN "libcommon*.a" ) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples/ DESTINATION include/whisper.cpp/common FILES_MATCHING PATTERN "common*.h" ) + diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..4bb7428c --- /dev/null +++ b/debian/control @@ -0,0 +1,56 @@ +Source: whisper-cpp +Section: science +Priority: optional +Maintainer: Mathieu Baudier +Build-Depends: debhelper-compat (= 13), pkg-config, cmake-data, cmake, cpio, file, git, + libsdl2-dev, + libswresample-dev, libavcodec-dev, libavformat-dev, libavdevice-dev, libavutil-dev, libavfilter-dev, + ggml-dev, libllama-dev +Standards-Version: 4.5.1 +Homepage: https://github.com/ggerganov/whisper.cpp +Rules-Requires-Root: binary-targets + +Package: libwhisper +Priority: optional +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends}, + libggml +Description: Inference of Whisper in pure C/C++ (shared library) + Whisper.cpp inference of Whisper in pure C/C++ (shared library). + +Package: libwhisper-dev +Priority: optional +Architecture: any +Multi-Arch: same +Depends: ${misc:Depends}, + ggml-dev, libwhisper +Description: Inference of Whisper in pure C/C++ (development files) + Whisper.cpp inference of Whisper in pure C/C++ (development files). + +#Package: whisper-cpp-cli +#Architecture: any +#Priority: optional +#Depends: ${shlibs:Depends}, +# libwhisper, +# libswresample4, libavcodec59, libavformat59, +#Description: Inference of Whisper in pure C/C++ (CLI) +# Whisper.cpp inference of Whisper in pure C/C++ (CLI). + +#Package: whisper-cpp-talk-llama +#Architecture: any +#Priority: optional +#Depends: ${shlibs:Depends}, +# libwhisper, libllama, +# espeak-ng, +# libsdl2-2.0-0, libswresample4, libavcodec59, libavformat59, +#Description: Inference of Whisper in pure C/C++ (talk-llama) +# Whisper.cpp inference of Whisper in pure C/C++ (talk-llama). + +Package: whisper-cpp-dev +Architecture: any +Priority: optional +Depends: libwhisper-dev +Description: Inference of Whisper in pure C/C++ (common static library) + Whisper.cpp inference of Whisper in pure C/C++ (common static library). diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..7754d047 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,44 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: whisper.cpp +Upstream-Contact: https://github.com/ggerganov/whisper.cpp/issues +Source: https://github.com/ggerganov/whisper.cpp + +Files: * +Copyright: Copyright (c) 2023-2025 The whisper.cpp authors +License: MIT + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +Files: debian/* +Copyright: 2024 Mathieu Baudier +License: GPL-2+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/libwhisper-dev.install b/debian/libwhisper-dev.install new file mode 100644 index 00000000..ec8c4599 --- /dev/null +++ b/debian/libwhisper-dev.install @@ -0,0 +1,4 @@ +/usr/include/whisper*.h + +/usr/lib/pkgconfig/*.pc +/usr/lib/*/cmake/whisper/whisper-*.cmake diff --git a/debian/libwhisper.install b/debian/libwhisper.install new file mode 100644 index 00000000..c9a9ccb7 --- /dev/null +++ b/debian/libwhisper.install @@ -0,0 +1 @@ +/usr/lib/*/libwhisper* \ No newline at end of file diff --git a/debian/not-installed b/debian/not-installed new file mode 100644 index 00000000..95ef126f --- /dev/null +++ b/debian/not-installed @@ -0,0 +1,2 @@ +/usr/bin/whisper-* +/usr/libexec/*/ggml/whisper-* diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..e16810bb --- /dev/null +++ b/debian/rules @@ -0,0 +1,40 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +#export DH_VERBOSE = 1 + +# multiarch +include /usr/share/dpkg/architecture.mk + +build_multiarch=build/$(DEB_HOST_MULTIARCH) +install_bin=debian/tmp/usr/bin +install_libexec_multiarch=debian/tmp/usr/libexec/$(DEB_HOST_MULTIARCH) + +%: +# Use build/ for output, so that it is in the .gitignore of upstream + dh $@ --buildsystem=cmake --builddirectory=$(build_multiarch) + +override_dh_auto_configure: + dh_auto_configure -- \ + -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \ + -DCMAKE_PROJECT_whisper.cpp_INCLUDE=debian/cmake/debian-whisper.cpp.cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DWHISPER_BUILD_TESTS=OFF \ + -DWHISPER_BUILD_EXAMPLES=OFF \ + -DWHISPER_FFMPEG=ON \ + -DWHISPER_SDL2=ON \ + +override_dh_auto_install: + dh_auto_install + + # Move executables to libexec, so that they can load the GGML backends + # and link them to bin + #mkdir -p $(install_libexec_multiarch)/ggml + #for file in $(install_bin)/whisper-*; do \ + # mv $$file $(install_libexec_multiarch)/ggml/$$(basename "$$file"); \ + # ln -s --relative -t $(install_bin) $(install_libexec_multiarch)/ggml/$$(basename "$$file"); \ + #done + +override_dh_auto_test: + # tests which depends on remote location are failing + dh_auto_test || true diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 00000000..55bd626e --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,3 @@ +whisper-cpp source: source-is-missing [bindings/javascript/libwhisper.worker.js] +whisper-cpp source: source-is-missing [bindings/javascript/whisper.js] +whisper-cpp source: source-is-missing [examples/wchess/wchess.wasm/jquery-3.7.1.min.js] diff --git a/debian/whisper-cpp-cli.install b/debian/whisper-cpp-cli.install new file mode 100644 index 00000000..1ea0ba21 --- /dev/null +++ b/debian/whisper-cpp-cli.install @@ -0,0 +1,4 @@ +/usr/bin/whisper-cli +/usr/libexec/*/ggml/whisper-cli +#/usr/bin/whisper-stream +#/usr/bin/whisper-command diff --git a/debian/whisper-cpp-dev.install b/debian/whisper-cpp-dev.install new file mode 100644 index 00000000..57f40580 --- /dev/null +++ b/debian/whisper-cpp-dev.install @@ -0,0 +1,2 @@ +/usr/include/whisper.cpp/common +#/usr/lib/*/whisper.cpp/* diff --git a/debian/whisper-cpp-talk-llama.install b/debian/whisper-cpp-talk-llama.install new file mode 100644 index 00000000..02dde825 --- /dev/null +++ b/debian/whisper-cpp-talk-llama.install @@ -0,0 +1,2 @@ +/usr/bin/whisper-talk-llama +debian/whisper-speak /usr/bin diff --git a/debian/whisper-speak b/debian/whisper-speak new file mode 100644 index 00000000..41025603 --- /dev/null +++ b/debian/whisper-speak @@ -0,0 +1,2 @@ +#!/bin/sh +espeak-ng -v en-gb+m$1 -s 225 -p 50 -a 200 -g 5 -k 5 -f $2