#!/usr/bin/make -f #export DH_VERBOSE = 1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all # Generate pseudo-build-number using the date of the upstream version include /usr/share/dpkg/pkg-info.mk GGML_BUILD_NUMBER = $(basename $(subst 0.0~git,,$(DEB_VERSION_UPSTREAM))) # GGML_NATIVE:ON corresponds to -march=native CMAKE_OPTS = -DGGML_NATIVE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_RPATH=/usr/lib/${DEB_HOST_MULTIARCH}/ggml \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF \ -DGGML_BUILD_NUMBER=$(GGML_BUILD_NUMBER) \ -DGGML_BUILD_TESTS=ON \ -DGGML_BUILD_EXAMPLES=OFF \ -DGGML_INSTALL_TESTS=ON \ -DGGML_BACKEND_DL=ON \ -DGGML_BACKEND_DIR=/usr/lib/${DEB_HOST_MULTIARCH}/ggml/backends0 # # See debian/README.Source # # CUDA profile builds CUDA backend exclusively ifneq ($(filter pkg.ggml.cuda,$(DEB_BUILD_PROFILES)),) CMAKE_OPTS += -DGGML_CPU=OFF \ -DGGML_CUDA=ON else # Build BLAS and Vulkan everywhere CMAKE_OPTS += -DGGML_BLAS=ON \ -DGGML_VULKAN=ON # Build all CPU variants where supported ifneq ($(filter $(DEB_HOST_ARCH),amd64 arm64 ppc64el),) CMAKE_OPTS += -DGGML_CPU_ALL_VARIANTS=ON # Disable all features where all CPU variants are not supported else ifeq ($(DEB_HOST_ARCH),riscv64) CMAKE_OPTS += -DGGML_RVV=OFF else ifeq ($(DEB_HOST_ARCH),loong64) CMAKE_OPTS += -DGGML_LASX=OFF else ifeq ($(DEB_HOST_ARCH),s390x) CMAKE_OPTS += -DGGML_VXE=OFF \ -DGGML_NNPA=OFF endif # Build HIP backends where supported ifneq ($(filter $(DEB_HOST_ARCH),amd64 arm64 ppc64el),) ifeq ($(filter pkg.ggml.nohip,$(DEB_BUILD_PROFILES)),) export HIPCXX=clang-17 CMAKE_OPTS += -DGGML_HIP=ON -DCMAKE_HIP_ARCHITECTURES="$(shell rocm-target-arch --sep ';')" endif endif endif # pkg.ggml.cuda %: dh $@ --buildsystem=cmake execute_after_dh_clean: rm -f shlibs.local override_dh_auto_configure: dh_auto_configure -- $(CMAKE_OPTS) # No tests for now, as many need some kind of model we don't have override_dh_auto_test: : # dwz doesn't fully support DWARF-5 yet, see #1016936 # The HIP build produces DWARF-5 stuff override_dh_dwz: : override_dh_makeshlibs: ifneq ($(filter pkg.ggml.cuda,$(DEB_BUILD_PROFILES)),) # When building only CUDA, we don't have bin:libggml0 echo 'libggml-base 0 libggml0 (>= $(DEB_VERSION_UPSTREAM))' > debian/shlibs.local endif # Libraries are private dh_makeshlibs --no-scripts override_dh_shlibdeps: ifneq ($(filter pkg.ggml.cuda,$(DEB_BUILD_PROFILES)),) # When building only CUDA, we don't have bin:libggml0 dh_shlibdeps -l$(CURDIR)/debian/tmp/usr/lib/x86_64-linux-gnu/ggml else dh_shlibdeps endif override_dh_gencontrol: dh_gencontrol -- -Vrocm:GPU-Architecture="$(shell rocm-target-arch)"