Debian Codegraph @

debian/rules

raw symbols SCIP
1 #!/usr/bin/make -f
2
3 export DEB_BUILD_MAINT_OPTIONS=hardening=+all qa=+all
4
5 DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
6
7 # DEB_VERSION
8 include /usr/share/dpkg/pkg-info.mk
9
10 CMAKE_OPTIONS := \
11 -DARES_BUILD_LOCAL=OFF \
12 -DARES_ENABLE_MINIMUM_CPU=OFF \
13 -DARES_SKIP_DEPS=ON \
14 -DARES_VERSION_OVERRIDE="v$(DEB_VERSION)" \
15 -DWITH_SYSTEM_LIBCHDR=ON \
16 -DWITH_SYSTEM_ZLIB=ON
17
18 cores := a26;fc;sfc;sg;ms;ps1;pce;ng;msx;cv;myvision;gb;gba;ws;ngp;spec
19 # Reimplementation of older disable-md-on-32bit.patch
20 ifneq ($(shell $(CXX) -E -dM - < /dev/null | grep INT128),)
21 cores += ;md
22 endif
23
24 # Upstream only supports n64 on amd64 and arm64
25 ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 arm64))
26 cores += ;n64
27 endif
28
29 ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
30 BUILDOPT=RelWithDebInfo
31 else
32 BUILDOPT=Debug
33 endif
34
35 # Enforce Debian microarchitecture baseline on amd64
36 # Reimplementation of no-optional-extensions.patch
37 ifeq ($(DEB_HOST_ARCH_CPU),amd64)
38 export DEB_CFLAGS_MAINT_APPEND=-march=x86-64
39 export DEB_CXXFLAGS_MAINT_APPEND=-march=x86-64
40 endif
41
42 %:
43 dh $@
44
45 # amd64: x64-64-v2 support is required to run ares-simd. We also include ares-no-simd to conform with debian baselines
46 # arm64: NEON is required for SIMD. The debian baseline for arm64 is "ahead" of this point, so NEON is guaranteed and only ares-simd is built
47 # all other architectures: SIMD is not supported, so only ares-no-simd is built
48 ifeq ($(DEB_HOST_ARCH_CPU),amd64)
49 override_dh_auto_configure:
50 dh_auto_configure --builddirectory=build/no-simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
51 DEB_CFLAGS_MAINT_APPEND=-march=x86-64-v2 DEB_CXXFLAGS_MAINT_APPEND=-march=x86-64-v2 dh_auto_configure \
52 --reload-all-buildenv-variables --builddirectory=build/simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
53 else ifeq ($(DEB_HOST_ARCH_CPU),arm64)
54 override_dh_auto_configure:
55 dh_auto_configure --builddirectory=build/simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
56 else
57 override_dh_auto_configure:
58 dh_auto_configure --builddirectory=build/no-simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
59 endif
60
61 override_dh_auto_build:
62 ifneq ($(DEB_HOST_ARCH_CPU),arm64)
63 dh_auto_build --builddirectory=build/no-simd
64 endif
65 ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 arm64))
66 dh_auto_build --builddirectory=build/simd
67 endif
68
69 override_dh_auto_install:
70 ifneq ($(DEB_HOST_ARCH_CPU),arm64)
71 dh_auto_install --builddirectory=build/no-simd --destdir=debian/tmp/no-simd
72 endif
73 ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 arm64))
74 dh_auto_install --builddirectory=build/simd --destdir=debian/tmp/simd
75 endif
76
77 # We need to change the names of the binaries and install them to debian/tmp manually.
78 execute_before_dh_install:
79 mkdir -p debian/tmp/usr/libexec/ares
80 mkdir -p debian/tmp/usr/bin
81 ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 arm64))
82 mv -n debian/tmp/simd/usr/bin/ares debian/tmp/usr/libexec/ares/ares-simd
83 mv -n debian/tmp/simd/usr/share debian/tmp/usr
84 endif
85 ifneq ($(DEB_HOST_ARCH_CPU),arm64)
86 mv -n debian/tmp/no-simd/usr/bin/ares debian/tmp/usr/libexec/ares/ares-no-simd
87 mv -n debian/tmp/no-simd/usr/share debian/tmp/usr
88 endif
89 ifeq ($(DEB_HOST_ARCH_CPU),amd64)
90 cp debian/ares-launcher-amd64.sh debian/tmp/usr/bin/ares
91 endif
92
93 ifeq ($(DEB_HOST_ARCH_CPU),amd64)
94 # Don't run dh_link on amd64
95 override_dh_link:
96
97 endif