From: Mathieu Baudier Date: Fri, 15 Aug 2025 15:31:35 +0000 (+0200) Subject: Make diff with official Debian packages easier X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=b6bfde39f7b4777c2b24e4deb6ac597883e798dc;p=pkg%2Fggml%2Fsources%2Fggml Make diff with official Debian packages easier --- diff --git a/debian/control b/debian/control index 7f9b8fa4..9fdf9ff7 100644 --- a/debian/control +++ b/debian/control @@ -1,65 +1,56 @@ Source: ggml -Section: science +Section: libs Priority: optional Maintainer: Mathieu Baudier -Build-Depends: debhelper-compat (= 13), pkgconf, - cmake-data, cmake, - libopenblas-openmp-dev, libopenblas64-openmp-dev [amd64 arm64], - libvulkan-dev, glslc, -Standards-Version: 4.7.0 -Vcs-Git: https://git.djapps.eu/pkg/ggml/sources/ggml +Standards-Version: 4.7.2 Vcs-Browser: https://git.djapps.eu/?p=pkg/ggml/sources/ggml;a=summary -Homepage: https://github.com/ggml-org/ -Rules-Requires-Root: binary-targets - -Package: ggml -Architecture: any -Depends: ${misc:Depends}, - libggml0, libggml-backend-cpu -Description: Tensor library for machine learning (metapackage) - ggml is a pure C/C++ library implementing tensor computations - used by neural networks. It is the basis for llama.cpp (large language models) - and whisper.cpp (speech recognition) but can be used indepedently. - This metapackage provides the minimal set of dependencies - so that the library can actually be usable, since the dynamically-loaded - CPU backend is required for most usages. Additional backends can be - installed additionally, typically to support specific computing hardware - such as GPUs. +Vcs-Git: https://git.djapps.eu/pkg/ggml/sources/ggml +Homepage: https://github.com/ggml-org/ggml +Build-Depends: cmake, + debhelper-compat (= 13), + libblas-dev, + pkgconf, + libvulkan-dev, + glslc, +Rules-Requires-Root: no Package: libggml-base0 -Section: libs Architecture: any Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} -Depends: ${misc:Depends}, ${shlibs:Depends} -# Explicitly conflict with Debian official -Conflicts: libggml-base +Depends: ${misc:Depends}, + ${shlibs:Depends} Description: Tensor library for machine learning (base) The ggml base library provides the backend-independent API upon which specialized libraries or applications can be built. Package: libggml0 -Section: libs Architecture: any Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} -Depends: ${misc:Depends}, ${shlibs:Depends}, - libggml-base0 -# Explicitly conflict with Debian official -Conflicts: libggml +Depends: libggml-base0, + ${misc:Depends}, + ${shlibs:Depends}, Description: Tensor library for machine learning (loader) The ggml library is a thin high-level layer mostly responsible for loading the various ggml backends, and connect them to the API provided by the ggml base library. +Package: libggml-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: libggml0 (= ${binary:Version}), + libggml-base0 (= ${binary:Version}), + ${misc:Depends}, +Description: Tensor library for machine learning (development files) + This developments package provides the files required to build + software based on ggml. + Package: libggml-backend-cpu Architecture: any Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} -Depends: ${misc:Depends}, ${shlibs:Depends}, - libggml0 -# Explicitly conflict with Debian official -Conflicts: libggml-cpu +Depends: libggml-base0, + ${misc:Depends}, + ${shlibs:Depends} Description: Tensor library for machine learning (CPU backend) The ggml CPU backend provides computations based solely on plain CPU, without software or hardware acceleration. @@ -72,13 +63,10 @@ Description: Tensor library for machine learning (CPU backend) Package: libggml-backend-blas Architecture: any Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} -Depends: ${misc:Depends}, ${shlibs:Depends}, - libggml0, -# GGML shows warning that it uses OpenMP if default OpenBLAS (pthread) is used. - libopenblas0-openmp, libopenblas64-0-openmp [amd64 arm64], -# Explicitly conflict with Debian official -Conflicts: libggml-blas +Depends: libggml-base0, + ${misc:Depends}, + ${shlibs:Depends} +Recommends: libopenblas0 | libblis4 | libmkl-rt | libblas3 Description: Tensor library for machine learning (OpenBLAS backend) The ggml BLAS backend provides software acceleration of the computations based on OpenBLAS. @@ -86,9 +74,9 @@ Description: Tensor library for machine learning (OpenBLAS backend) Package: libggml-backend-rpc Architecture: any Multi-Arch: same -Pre-Depends: ${misc:Depends}, ${misc:Pre-Depends} -Depends: ${shlibs:Depends}, - libggml0 +Depends: libggml-base0, + ${misc:Depends}, + ${shlibs:Depends} Description: Tensor library for machine learning (RPC backend) The ggml RPC backend allows one to distribute computations over the network on remote ggml backends. @@ -96,28 +84,10 @@ Description: Tensor library for machine learning (RPC backend) Package: libggml-backend-vulkan Architecture: any Multi-Arch: same -Pre-Depends: ${misc:Pre-Depends} -# Explicitly conflict with Debian official -Conflicts: libggml-vulkan -Depends: ${misc:Depends}, ${shlibs:Depends}, - libggml0, - libvulkan1 +Depends: libggml-base0, + ${misc:Depends}, + ${shlibs:Depends} Description: Tensor library for machine learning (Vulkan backend) The ggml Vulkan backend provides hardware acceleration of the computations based on the Vulkan API. This is typically used to leverage GPU parallel computations capabilities. - -Package: ggml-dev -Architecture: any -Section: libdevel -Depends: ${misc:Depends}, - libggml0 (= ${binary:Version}), libggml-base0 (= ${binary:Version}), -# The generated cmake config then requires to find all backends -# TODO check with upstream - libggml-backend-cpu (= ${binary:Version}), - libggml-backend-blas (= ${binary:Version}), - libggml-backend-rpc (= ${binary:Version}), - libggml-backend-vulkan (= ${binary:Version}), -Description: Tensor library for machine learning (development files) - This developments package provides the files required to build - software based on ggml. diff --git a/debian/ggml-dev.examples b/debian/ggml-dev.examples deleted file mode 100644 index e39721e2..00000000 --- a/debian/ggml-dev.examples +++ /dev/null @@ -1 +0,0 @@ -examples/* diff --git a/debian/ggml-dev.install b/debian/ggml-dev.install deleted file mode 100644 index 4e97f18b..00000000 --- a/debian/ggml-dev.install +++ /dev/null @@ -1,9 +0,0 @@ -/usr/include/* -/usr/share/pkgconfig/*.pc -/usr/lib/*/cmake/ggml/*.cmake - -# Symbolic links -/usr/lib/*/libggml.so -/usr/lib/*/libggml-base.so - -include/ggml-cpp.h usr/include/ diff --git a/debian/libggml-dev.examples b/debian/libggml-dev.examples new file mode 100644 index 00000000..e39721e2 --- /dev/null +++ b/debian/libggml-dev.examples @@ -0,0 +1 @@ +examples/* diff --git a/debian/libggml-dev.install b/debian/libggml-dev.install new file mode 100644 index 00000000..4e97f18b --- /dev/null +++ b/debian/libggml-dev.install @@ -0,0 +1,9 @@ +/usr/include/* +/usr/share/pkgconfig/*.pc +/usr/lib/*/cmake/ggml/*.cmake + +# Symbolic links +/usr/lib/*/libggml.so +/usr/lib/*/libggml-base.so + +include/ggml-cpp.h usr/include/ diff --git a/debian/rules b/debian/rules index c9a36db4..ef3dc9d7 100755 --- a/debian/rules +++ b/debian/rules @@ -1,70 +1,34 @@ #!/usr/bin/make -f -# See debhelper(7) (uncomment to enable) #export DH_VERBOSE = 1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all -LC_ALL := C.UTF-8 -export LC_ALL - -# For multiarch -include /usr/share/dpkg/architecture.mk -# For DEB_VERSION_UPSTREAM include /usr/share/dpkg/pkg-info.mk +GGML_BUILD_NUMBER=$(subst 0.0.,,$(DEB_VERSION_UPSTREAM)) -install_bin=debian/tmp/usr/bin -install_lib_multiarch=debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) -install_libexec_multiarch=debian/tmp/usr/libexec/$(DEB_HOST_MULTIARCH) - -# parallelism -DEB_BUILD_OPTIONS ?= parallel=8 - -# hardening -export DEB_BUILD_MAINT_OPTIONS = hardening=+all - -# ggml specific -ifeq ($(DEB_HOST_ARCH),aarch64) - GGML_CPU_AARCH64 ?= ON -else - GGML_CPU_AARCH64 ?= OFF -endif +# GGML_NATIVE:ON corresponds to -march=native +CMAKE_OPTS = -DGGML_NATIVE=OFF \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DGGML_BUILD_NUMBER=$(GGML_BUILD_NUMBER) \ + -DGGML_BUILD_TESTS=OFF \ + -DGGML_BUILD_EXAMPLES=OFF \ + -DGGML_BACKEND_DL=ON \ -ifeq ($(DEB_HOST_ARCH),amd64) - GGML_CPU_ALL_VARIANTS ?= ON -else - GGML_CPU_ALL_VARIANTS ?= OFF -endif +CMAKE_OPTS += -DGGML_CPU_ALL_VARIANTS=ON \ + -DGGML_BLAS=ON \ + -DGGML_VULKAN=ON \ + -DGGML_RPC=ON \ %: -# Use build/ for output, so that it is in the .gitignore of upstream dh $@ --buildsystem=cmake override_dh_auto_configure: - dh_auto_configure -- \ - -DGGML_BUILD_NUMBER=$(subst 0.0.,,$(DEB_VERSION_UPSTREAM)) \ - -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DBUILD_SHARED_LIBS=ON \ - -DGGML_CCACHE=OFF \ - -DGGML_STANDALONE=ON \ - -DGGML_BUILD_TESTS=ON \ - -DGGML_BUILD_EXAMPLES=OFF \ - -DGGML_CPU_AARCH64=$(GGML_CPU_AARCH64) \ - -DGGML_BACKEND_DL=ON \ - -DGGML_CPU_ALL_VARIANTS=$(GGML_CPU_ALL_VARIANTS) \ - -DGGML_NATIVE=OFF \ - \ - -DGGML_RPC=ON \ - -DGGML_BLAS=ON \ - -DGGML_BLAS_VENDOR=OpenBLAS \ - -DGGML_VULKAN=ON \ - -DGGML_CUDA=OFF \ + dh_auto_configure -- $(CMAKE_OPTS) -override_dh_auto_install: - dh_auto_install - +execute_after_dh_auto_install-arch: # Move backends *.so to libexec, as we don't want them lurking in /usr/bin - mkdir -p $(install_libexec_multiarch)/ggml - for file in $(install_bin)/libggml-*.so; do \ - mv $$file $(install_libexec_multiarch)/ggml; \ + mkdir -p debian/tmp/usr/libexec/$(DEB_HOST_MULTIARCH)/ggml + for file in debian/tmp/usr/bin/libggml-*.so; do \ + mv $$file debian/tmp/usr/libexec/$(DEB_HOST_MULTIARCH)/ggml; \ done override_dh_installexamples: