From: Mathieu Baudier Date: Tue, 21 Jan 2025 06:49:29 +0000 (+0100) Subject: Make sure that multiarch is well supported X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=a1328577ac9b25697c96691deea05a11256a2611;p=pkg%2Fggml%2Fsources%2Fggml Make sure that multiarch is well supported --- diff --git a/debian/control b/debian/control index cb373d15..38759801 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: science Priority: optional Maintainer: Mathieu Baudier Build-Depends: debhelper-compat (= 13), pkg-config, cmake-data, cmake, cpio, git, patchelf, - libopenblas-openmp-dev, libopenblas64-openmp-dev, libvulkan-dev, glslc + libopenblas-openmp-dev, libopenblas64-openmp-dev [amd64 arm64], libvulkan-dev, glslc Standards-Version: 4.5.1 Homepage: https://github.com/ggerganov Rules-Requires-Root: binary-targets @@ -52,7 +52,7 @@ Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, libggml, # GGML shows warning that it uses OpenMP if default OpenBLAS (pthread) is used. - libopenblas0-openmp, libopenblas64-0-openmp, + libopenblas0-openmp, libopenblas64-0-openmp [amd64 arm64], Description: Tensor library for machine learning (OpenBLAS backend) GGML Tensor library for machine learning. (OpenBLAS backend) diff --git a/debian/libggml-cpu.install b/debian/libggml-cpu.install index aa9291aa..f2f99f4d 100644 --- a/debian/libggml-cpu.install +++ b/debian/libggml-cpu.install @@ -1 +1 @@ -/usr/lib/*/libggml-cpu-*.so +/usr/lib/*/libggml-cpu*.so diff --git a/debian/rules b/debian/rules index 0c264725..82e2adbf 100755 --- a/debian/rules +++ b/debian/rules @@ -5,13 +5,28 @@ LC_ALL := C.UTF-8 export LC_ALL +# multiarch include /usr/share/dpkg/architecture.mk -DEB_BUILD_OPTIONS ?= parallel=8 - build_multiarch=build/$(DEB_HOST_MULTIARCH) install_lib_multiarch=debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) +# parallelism +DEB_BUILD_OPTIONS ?= parallel=8 + +# ggml specific +ifeq ($(DEB_HOST_ARCH),aarch64) + GGML_CPU_AARCH64 ?= ON +else + GGML_CPU_AARCH64 ?= OFF +endif + +ifneq ($(DEB_HOST_ARCH),i386) + GGML_CPU_ALL_VARIANTS ?= ON +else + GGML_CPU_ALL_VARIANTS ?= OFF +endif + %: # Use build/ for output, so that it is in the .gitignore of upstream dh $@ --buildsystem=cmake --builddirectory=$(build_multiarch) @@ -25,10 +40,11 @@ override_dh_auto_configure: -DGGML_STANDALONE=ON \ -DGGML_BUILD_TESTS=OFF \ -DGGML_BUILD_EXAMPLES=OFF \ - \ + -DGGML_CPU_AARCH64=$(GGML_CPU_AARCH64) \ -DGGML_BACKEND_DL=ON \ - -DGGML_CPU_ALL_VARIANTS=ON \ + -DGGML_CPU_ALL_VARIANTS=$(GGML_CPU_ALL_VARIANTS) \ -DGGML_NATIVE=OFF \ + \ -DGGML_RPC=ON \ -DGGML_BLAS=ON \ -DGGML_BLAS_VENDOR=OpenBLAS \ @@ -44,7 +60,6 @@ override_dh_auto_install: patchelf --set-soname $$(basename "$$file") $$file; \ install -t $(install_lib_multiarch) $$file; \ done - #install -t $(install_lib_multiarch) $(build_multiarch)/bin/libggml-*.so override_dh_dwz: # dwz is failing most probably because of using patchelf in order to set soname