File: rules

package info (click to toggle)
yuzu 0-1734%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 51,220 kB
  • sloc: cpp: 429,254; ansic: 38,370; python: 732; pascal: 179; asm: 137; xml: 86; makefile: 49; sh: 29
file content (83 lines) | stat: -rwxr-xr-x 3,115 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
#!/usr/bin/make -f

# -lto because I use CMake's LTO support
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+all,-lto qa=+all

# -Werror=array-bounds is added by qa=+bug, triggers some false positives
# -O2 is stripped because CMake already passes -O3
export DEB_CXXFLAGS_MAINT_STRIP = -Werror=array-bounds -O2

# yuzu requires CX16 instructions (CMPXCHG16B) to build, and they are
# "only" available on Intel Core 2 or newer CPUs. The only way I know to
# express that a Debian package depends on a set of instructions not
# present in the baseline is to make it depend on an isa-support package.
# Only sse3- and sse4.2-support are available, and there are some CPUs that
# support SSE3 while not supporting CX16, so depending on that wouldn't be
# strict enough. The only safe dependency is then sse4.2-support.
# But depending on sse4.2-support while not making use of the SSE4.2
# extensions would be a waste, and it makes sense to allow GCC to generate
# optimized code that uses SSE4.2 extensions, for performance reasons.
# As both CMPXCHG16B and SSE4_2 are part of the x86-64-v2
# micro-architecture level, I can simply tell GCC to generate code for that
# target.
# Upstream is now building with -march=x86-64-v2 too.
# References:
# https://github.com/yuzu-emu/yuzu/commit/626cc44d7ababf037cbf1f0a6fd1372efc296b64
# https://gitlab.com/x86-psABIs/x86-64-ABI/-/wikis/uploads/01de35b2c8adc7545de52604cc45d942/x86-64-psABI-2021-05-20.pdf#page=16
# https://github.com/yuzu-emu/yuzu/pull/7497
# https://github.com/yuzu-emu/yuzu/pull/9442

ifeq ($(DEB_HOST_ARCH_CPU),amd64)
  export DEB_CFLAGS_MAINT_APPEND   = -march=x86-64-v2
  export DEB_CXXFLAGS_MAINT_APPEND = -march=x86-64-v2
endif

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
  test := true
else
  test := false
endif

ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
  build_type := Release
  lto := true
else
  build_type := None
  lto := false
endif

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

%:
	dh $@ --buildsystem=cmake+ninja

override_dh_auto_configure:
	ln -s ../sirit externals/sirit
	ln -s ../../tzdb-to-nx externals/nx_tzdb/tzdb_to_nx
	dh_auto_configure -- \
		-DGIT_BRANCH=$(DEB_VENDOR) \
		-DGIT_DESC=mainline-$(DEB_VERSION) \
		-DGIT_REV=mainline-$(DEB_VERSION) \
		-DCMAKE_INSTALL_BINDIR=games \
		-DENABLE_QT_TRANSLATION=true \
		-DYUZU_DOWNLOAD_TIME_ZONE_DATA=false \
		-DYUZU_USE_FASTER_LD=false \
		-DENABLE_QT6=true \
		-DYUZU_USE_QT_WEB_ENGINE=true \
		-DYUZU_USE_EXTERNAL_SDL2=false \
		-DYUZU_USE_EXTERNAL_VULKAN_HEADERS=false \
		-DYUZU_USE_EXTERNAL_VULKAN_UTILITY_LIBRARIES=false \
		-DYUZU_USE_BUNDLED_SDL2=false \
		-DYUZU_USE_BUNDLED_QT=false \
		-DYUZU_USE_BUNDLED_FFMPEG=false \
		-DYUZU_TESTS=$(test) \
		-DSIRIT_USE_SYSTEM_SPIRV_HEADERS=true \
		-DTZDB2NX_ZONEINFO_DIR=/usr/share/zoneinfo \
		-DTZDB2NX_VERSION=$$(stat -c '%y' /usr/share/zoneinfo/tzdata.zi | sed 's/\(....-..-..\).*/\1/' | tr -dc '[:digit:]') \
		-DCMAKE_BUILD_TYPE=$(build_type) \
		-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=$(lto) \
		-DCMAKE_POLICY_DEFAULT_CMP0069=NEW

override_dh_auto_test: