File: rules

package info (click to toggle)
ares 147%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,260 kB
  • sloc: cpp: 334,263; ansic: 98,696; sh: 131; makefile: 67
file content (91 lines) | stat: -rwxr-xr-x 3,266 bytes parent folder | download
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
89
90
91
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all qa=+all

DEB_BUILD_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)

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

CMAKE_OPTIONS := \
	-DARES_BUILD_LOCAL=OFF \
	-DARES_ENABLE_MINIMUM_CPU=OFF \
	-DARES_SKIP_DEPS=ON \
	-DARES_VERSION_OVERRIDE="v$(DEB_VERSION)" \
	-DWITH_SYSTEM_ZLIB=ON

cores := a26;fc;sfc;sg;ms;ps1;pce;ng;msx;cv;myvision;gb;gba;ws;ngp;spec;n64
# Reimplementation of older disable-md-on-32bit.patch
ifneq ($(shell $(CXX) -E -dM - < /dev/null | grep INT128),)
	cores += ;md
endif

ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
    BUILDOPT=RelWithDebInfo
else
    BUILDOPT=Debug
endif

# Enforce Debian microarchitecture baseline on amd64
# Reimplementation of no-optional-extensions.patch
ifeq ($(DEB_HOST_ARCH_CPU),amd64)
	export DEB_CFLAGS_MAINT_APPEND=-march=x86-64
	export DEB_CXXFLAGS_MAINT_APPEND=-march=x86-64
endif

%:
	dh $@

# amd64: x64-64-v2 support is required to run ares-simd. We also include ares-no-simd to conform with debian baselines
# 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
# all other architectures: SIMD is not supported, so only ares-no-simd is built
ifeq ($(DEB_HOST_ARCH_CPU),amd64)
override_dh_auto_configure:
	dh_auto_configure --builddirectory=build/no-simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
	DEB_CFLAGS_MAINT_APPEND=-march=x86-64-v2 DEB_CXXFLAGS_MAINT_APPEND=-march=x86-64-v2 dh_auto_configure \
		--reload-all-buildenv-variables --builddirectory=build/simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
else ifeq ($(DEB_HOST_ARCH_CPU),arm64)
override_dh_auto_configure:
	dh_auto_configure --builddirectory=build/simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
else
override_dh_auto_configure:
	dh_auto_configure --builddirectory=build/no-simd -- $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=$(BUILDOPT) -DARES_CORES="$(cores)"
endif

override_dh_auto_build:
ifneq ($(DEB_HOST_ARCH_CPU),arm64)
	dh_auto_build --builddirectory=build/no-simd
endif
ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 arm64))
	dh_auto_build --builddirectory=build/simd
endif

override_dh_auto_install:
ifneq ($(DEB_HOST_ARCH_CPU),arm64)
	dh_auto_install --builddirectory=build/no-simd --destdir=debian/tmp/no-simd
endif
ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 arm64))
	dh_auto_install --builddirectory=build/simd --destdir=debian/tmp/simd
endif

# We need to change the names of the binaries and install them to debian/tmp manually.
execute_before_dh_install:
	mkdir -p debian/tmp/usr/libexec/ares
	mkdir -p debian/tmp/usr/bin
ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 arm64))
	mv -n debian/tmp/simd/usr/bin/ares debian/tmp/usr/libexec/ares/ares-simd
	mv -n debian/tmp/simd/usr/share debian/tmp/usr
endif
ifneq ($(DEB_HOST_ARCH_CPU),arm64)
	mv -n debian/tmp/no-simd/usr/bin/ares debian/tmp/usr/libexec/ares/ares-no-simd
	mv -n debian/tmp/no-simd/usr/share debian/tmp/usr
endif
ifeq ($(DEB_HOST_ARCH_CPU),amd64)
	cp debian/ares-launcher-amd64.sh debian/tmp/usr/bin/ares
endif

ifeq ($(DEB_HOST_ARCH_CPU),amd64)
# Don't run dh_link on amd64
override_dh_link:

endif