#!/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 # # Build BLAS and Vulkan everywhere CMAKE_OPTS += -DGGML_BLAS=ON \ -DGGML_VULKAN=ON ## CPU ## # 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 \ -DGGML_RV_ZICBOP=OFF \ -DGGML_RV_ZFH=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 ## CPU ## ## HIP ## ifneq ($(filter $(DEB_HOST_ARCH),amd64 arm64),) ifeq ($(filter pkg.ggml.nohip,$(DEB_BUILD_PROFILES)),) # Salsa currently does not allow passing in arbitrary envvars to the build, so # we must activate this via a build profile ifneq ($(filter pkg.ggml.minhip,$(DEB_BUILD_PROFILES)),) export ROCM_TARGET_ARCH_FIXED=gfx1030 endif BACKEND_HIP_ACTIVATED = 1 CMAKE_OPTS += -DGGML_HIP=ON -DCMAKE_HIP_ARCHITECTURES="$(shell rocm-target-arch --sep ';')" endif endif ## HIP ## %: dh $@ --buildsystem=cmake override_dh_auto_configure: dh_auto_configure -- $(CMAKE_OPTS) # dwz doesn't fully support DWARF-5 yet, see #1016936 # The HIP build produces DWARF-5 stuff override_dh_dwz: : override_dh_makeshlibs: # Libraries are private dh_makeshlibs --no-scripts override_dh_gencontrol: ifdef BACKEND_HIP_ACTIVATED dh_gencontrol -- -Vrocm:GPU-Architecture="$(shell rocm-target-arch)" else dh_gencontrol endif