From: Mathieu Baudier Date: Tue, 21 Jan 2025 08:13:15 +0000 (+0100) Subject: Initial Debian packaging X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=76e5d4911b414a0bad8bf8b2d2877004b493b2bc;p=pkg%2Fggml%2Fsources%2Fllama.cpp Initial Debian packaging --- diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 00000000..91196067 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,9 @@ +# dpkg-buildpackage -b -us -uc +*.log +*.substvars +.debhelper +debhelper-build-stamp +llama-cpp*/ +libllama*/ +libllava*/ +files diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..3598b3a7 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +llama-cpp (0.0.4488-1) unstable; urgency=medium + + * Based on llama.cpp build b4488 + + -- Mathieu Baudier Tue, 21 Jan 2025 07:57:54 +0000 diff --git a/debian/cmake/debian-llama.cpp.cmake b/debian/cmake/debian-llama.cpp.cmake new file mode 100644 index 00000000..0d776ec7 --- /dev/null +++ b/debian/cmake/debian-llama.cpp.cmake @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.14) # for add_link_options and implicit target directories. + +# GGML dependencies +find_library(GGML_BASE_LOCATION ggml-base) + +# define GGML as target so that it is disabled in llama.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}) + +# quite a few examples require direct reference to ggml-cpu +# search for oldest one +find_library(GGML_CPU_LOCATION ggml-cpu-sandybridge) +find_library(GGML_RPC_LOCATION ggml-rpc) + +# make sure all libraries are available since we cannot refine per target +link_libraries(${GGML_LOCATION} ${GGML_BASE_LOCATION} ${GGML_CPU_LOCATION} ${GGML_RPC_LOCATION}) + +#add_compile_definitions(NDEBUG) + +install(DIRECTORY ${CMAKE_BINARY_DIR}/common/ DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/llama.cpp/common FILES_MATCHING PATTERN "*.a" ) +install(DIRECTORY ${CMAKE_SOURCE_DIR}/common/ DESTINATION include/llama.cpp/common FILES_MATCHING PATTERN "*.h" ) + diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..5af1c562 --- /dev/null +++ b/debian/control @@ -0,0 +1,57 @@ +Source: llama-cpp +Section: science +Priority: optional +Maintainer: Mathieu Baudier +Build-Depends: debhelper-compat (= 13), pkg-config, cmake-data, cmake, cpio, curl, libcurl4-openssl-dev, file, git, + ggml-dev +Standards-Version: 4.5.1 +Homepage: https://github.com/ggerganov/llama.cpp +Rules-Requires-Root: binary-targets + +Package: libllama +Priority: optional +Architecture: any +Depends: ${shlibs:Depends}, + libggml +Recommends: curl +Description: Inference of LLMs in pure C/C++ (shared library) + Llama.cpp inference of LLMs in pure C/C++ (shared library). + +Package: libllava-shared +Architecture: any +Priority: optional +Depends: ${shlibs:Depends}, + libggml +Description: Llava (shared library) + Llama.cpp llava (shared library). + +Package: llama-cpp-cli +Architecture: any +Priority: optional +Depends: ${shlibs:Depends}, + libllama +Description: Inference of LLMs in pure C/C++ (CLI) + Llama.cpp inference of LLMs in pure C/C++ (CLI). + +Package: llama-cpp-server +Architecture: any +Priority: optional +Depends: ${shlibs:Depends}, + libllama, curl, openssl +Description: Inference of LLMs in pure C/C++ (CLI) + Llama.cpp inference of LLMs in pure C/C++ (CLI). + +Package: libllama-dev +Architecture: any +Priority: optional +Depends: ggml-dev, libllama +Description: Inference of LLMs in pure C/C++ (development files) + Llama.cpp inference of LLMs in pure C/C++ (development files). + +Package: llama-cpp-dev +Architecture: any +Priority: optional +Depends: libllama-dev +Description: Inference of LLMs in pure C/C++ (common development files) + Llama.cpp inference of LLMs in pure C/C++ (common development files). + \ No newline at end of file diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..7c923453 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,44 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: llama.cpp +Upstream-Contact: https://github.com/ggerganov/llama.cpp/issues +Source: https://github.com/ggerganov/llama.cpp + +Files: * +Copyright: Copyright (c) 2023-2024 The llama.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/libllama-dev.install b/debian/libllama-dev.install new file mode 100644 index 00000000..248d5cc4 --- /dev/null +++ b/debian/libllama-dev.install @@ -0,0 +1,5 @@ +/usr/include/llama*.h +include/llama-cpp.h /usr/include/ + +/usr/lib/pkgconfig/*.pc +/usr/lib/*/cmake/llama/llama-*.cmake diff --git a/debian/libllama.install b/debian/libllama.install new file mode 100644 index 00000000..54c30f17 --- /dev/null +++ b/debian/libllama.install @@ -0,0 +1 @@ +/usr/lib/*/libllama* \ No newline at end of file diff --git a/debian/libllama.triggers b/debian/libllama.triggers new file mode 100644 index 00000000..dd866036 --- /dev/null +++ b/debian/libllama.triggers @@ -0,0 +1 @@ +activate-noawait ldconfig diff --git a/debian/libllava-shared.install b/debian/libllava-shared.install new file mode 100644 index 00000000..002166e3 --- /dev/null +++ b/debian/libllava-shared.install @@ -0,0 +1 @@ +/usr/lib/*/libllava_shared*.so diff --git a/debian/libllava-shared.triggers b/debian/libllava-shared.triggers new file mode 100644 index 00000000..dd866036 --- /dev/null +++ b/debian/libllava-shared.triggers @@ -0,0 +1 @@ +activate-noawait ldconfig diff --git a/debian/llama-cpp-cli.install b/debian/llama-cpp-cli.install new file mode 100644 index 00000000..c327606c --- /dev/null +++ b/debian/llama-cpp-cli.install @@ -0,0 +1 @@ +/usr/bin/llama-cli diff --git a/debian/llama-cpp-dev.install b/debian/llama-cpp-dev.install new file mode 100644 index 00000000..bec882ac --- /dev/null +++ b/debian/llama-cpp-dev.install @@ -0,0 +1,2 @@ +/usr/include/llama.cpp/common +/usr/lib/*/llama.cpp/* diff --git a/debian/llama-cpp-server.install b/debian/llama-cpp-server.install new file mode 100644 index 00000000..313c4e16 --- /dev/null +++ b/debian/llama-cpp-server.install @@ -0,0 +1 @@ +/usr/bin/llama-server diff --git a/debian/missing-sources b/debian/missing-sources new file mode 100644 index 00000000..4ca2c895 --- /dev/null +++ b/debian/missing-sources @@ -0,0 +1,4 @@ +examples/server/public_legacy/index-new.html +examples/server/public_legacy/index.js +examples/server/public_legacy/system-prompts.js +examples/server/webui/index.html diff --git a/debian/not-installed b/debian/not-installed new file mode 100644 index 00000000..ff0d08da --- /dev/null +++ b/debian/not-installed @@ -0,0 +1,3 @@ +/usr/bin/test-* +/usr/bin/llama-* +/usr/bin/*.py diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..9fa14ce0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,39 @@ +#!/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_lib_multiarch=debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) + +# parallelism +DEB_BUILD_OPTIONS ?= parallel=8 + +%: +# 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_llama.cpp_INCLUDE=debian/cmake/debian-llama.cpp.cmake \ + -DBUILD_SHARED_LIBS=ON \ + -DGGML_RPC=ON \ + -DLLAMA_ALL_WARNINGS=OFF \ + -DLLAMA_BUILD_TESTS=OFF \ + -DLLAMA_BUILD_SERVER=ON \ + -DLLAMA_SERVER_SSL=ON \ + + +# FIXME we disable LLAMA_ALL_WARNINGS so that ggml_get_flags() CMake function do not get called +# as it is available deep in GGML and not properly published + +override_dh_install: + dh_install + find $(DEBIAN_BASE_DIR) -type d -empty -delete + +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..3cf26c03 --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,4 @@ +llama-cpp source: source-is-missing [examples/server/public_legacy/index-new.html] +llama-cpp source: source-is-missing [examples/server/public_legacy/index.js] +llama-cpp source: source-is-missing [examples/server/public_legacy/system-prompts.js] +llama-cpp source: source-is-missing [examples/server/webui/index.html]