File: rules

package info (click to toggle)
ggml 0.9.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 22,736 kB
  • sloc: cpp: 147,875; ansic: 49,184; lisp: 12,885; python: 1,617; objc: 1,398; sh: 1,112; makefile: 101
file content (88 lines) | stat: -rwxr-xr-x 2,392 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/make -f
#export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# For DEB_VERSION
include /usr/share/dpkg/pkg-info.mk


# GGML_NATIVE:ON corresponds to -march=native
CMAKE_OPTS  = -DGGML_NATIVE=OFF \
              -DCMAKE_BUILD_TYPE=RelWithDebInfo \
              -DGGML_BUILD_NUMBER=$(DEB_VERSION) \
              -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
#

## 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),loong64)
CMAKE_OPTS += -DGGML_LASX=OFF
else ifeq ($(DEB_HOST_ARCH),riscv64)
# Until this is fixed: https://github.com/ggml-org/llama.cpp/issues/21064
CMAKE_OPTS += -DGGML_RVV=OFF \
              -DGGML_RV_ZFH=OFF \
              -DGGML_RV_ZVFH=OFF \
              -DGGML_RV_ZICBOP=OFF \
              -DGGML_ZIHINTPAUSE=OFF \
              -DGGML_XTHEADVECTOR=OFF
else ifeq ($(DEB_HOST_ARCH),s390x)
CMAKE_OPTS += -DGGML_VXE=OFF \
              -DGGML_NNPA=OFF
endif ## CPU ##


## BLAS ##
ifeq ($(filter pkg.ggml.noblas,$(DEB_BUILD_PROFILES)),)
CMAKE_OPTS += -DGGML_BLAS=ON
endif ## BLAS ##


## Vulkan ##
ifeq ($(filter pkg.ggml.novulkan,$(DEB_BUILD_PROFILES)),)
CMAKE_OPTS += -DGGML_VULKAN=ON
endif ## Vulkan ##


## HIP ##
ifneq ($(filter $(DEB_HOST_ARCH),amd64 arm64),)
ifeq ($(filter pkg.ggml.nohip,$(DEB_BUILD_PROFILES)),)
BACKEND_HIP_ACTIVATED = 1

# 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

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_gencontrol:
ifdef BACKEND_HIP_ACTIVATED
	dh_gencontrol -- -Vrocm:GPU-Architecture="$(shell rocm-target-arch)"
else
	dh_gencontrol
endif