Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 BUILD_HOME=$(CURDIR)/debian/home
4 BUILD_XDG_RUNTIME_DIR=$(CURDIR)/debian/run
5
6 include /usr/share/dpkg/default.mk
7 include debian/opts.mk
8
9 # Needed for ccache to work in case the build directory changed
10 # (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810871)
11 export CCACHE_BASEDIR = $(shell pwd)
12
13 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
14
15 # see FEATURE AREAS in dpkg-buildflags(1)
16 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
17 export DPKG_EXPORT_BUILDFLAGS = 1
18 include /usr/share/dpkg/buildflags.mk
19
20 %:
21 dh $@ -Bbuild-$(DEB_HOST_ARCH)
22
23 # Enable verbose debugging output from the testsuite
24 export MIR_SERVER_LOGGING = on
25 override_dh_auto_test-arch:
26 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
27 ifeq ($(filter mipsel riscv64,$(DEB_HOST_ARCH)),)
28 ifeq ($(DEB_HOST_ARCH_ENDIAN),little)
29 mkdir -p $(BUILD_HOME)
30 mkdir -p $(BUILD_XDG_RUNTIME_DIR)
31 dh_auto_build -- HOME="$(BUILD_HOME)" XDG_RUNTIME_DIR="$(BUILD_XDG_RUNTIME_DIR)" GTEST_OUTPUT=xml:./ ARGS="-V" ptest
32 else
33 echo "Testsuite disabled on $(DEB_HOST_ARCH) due to lack of big-endian support."
34 endif
35 else
36 echo "Testsuite disabled on $(DEB_HOST_ARCH) due to timeouts / slow CPU processing."
37 endif
38 else
39 echo "Testsuite disabled due to DEB_BUILD_OPTIONS=\"$(DEB_BUILD_OPTIONS)\""
40 endif
41
42 override_dh_auto_test-indep:
43 echo "Testsuite not run during arch:all builds."
44
45 COMMON_CONFIGURE_OPTIONS = \
46 -DCMAKE_INSTALL_LIBEXECDIR="lib/$(DEB_HOST_MULTIARCH)/mir" \
47 -DMIR_BUILD_INTERPROCESS_TESTS=OFF \
48 -DMIR_ENABLE_RUST=OFF \
49 -DMIR_FATAL_COMPILE_WARNINGS=OFF
50
51 # Disable LTO on broken binutils
52 # https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/2070302
53 ifeq ($(filter arm64,$(DEB_HOST_ARCH)),arm64)
54 ifneq ($(shell ld --version | grep -E '(2.43.1|2.44|2.44.50.20250707)$$'),)
55 DEB_BUILD_MAINT_OPTIONS += optimize=-lto
56 endif
57 endif
58
59 # Disable tests on Launchpad riscv64 (canonical/mir#3443, canonical/mir#3470)
60 ifeq ($(USER) $(DEB_HOST_ARCH),buildd riscv64)
61 COMMON_CONFIGURE_OPTIONS += -DMIR_RUN_MIRAL_TESTS=OFF
62 COMMON_CONFIGURE_OPTIONS += -DMIR_RUN_WINDOW_MANAGEMENT_TESTS=OFF
63 COMMON_CONFIGURE_OPTIONS += -DMIR_RUN_WLCS_TESTS=OFF
64 endif
65
66 # Disable pre-compiled headers on GCC>=12
67 ifneq ($(shell gcc --version | grep '1[234].[[:digit:]]\+.[[:digit:]]\+$$'),)
68 COMMON_CONFIGURE_OPTIONS += -DMIR_USE_PRECOMPILED_HEADERS=OFF
69 endif
70
71 export DEB_BUILD_MAINT_OPTIONS
72
73 $(info COMMON_CONFIGURE_OPTIONS: ${COMMON_CONFIGURE_OPTIONS})
74 $(info DEB_BUILD_MAINT_OPTIONS: ${DEB_BUILD_MAINT_OPTIONS})
75
76 ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH)),)
77 AVAILABLE_PLATFORMS=atomic-kms\;gbm-kms\;x11\;wayland\;eglstream-kms
78 else
79 AVAILABLE_PLATFORMS=atomic-kms\;gbm-kms\;x11\;wayland
80 endif
81
82
83 override_dh_auto_configure:
84 ifneq ($(filter armhf,$(DEB_HOST_ARCH)),)
85 dh_auto_configure -- \
86 $(COMMON_CONFIGURE_OPTIONS) \
87 -DMIR_RUN_ACCEPTANCE_TESTS=OFF \
88 -DMIR_RUN_INTEGRATION_TESTS=OFF \
89 -DMIR_PLATFORM=$(AVAILABLE_PLATFORMS) \
90 $(OVERRIDE_CONFIGURE_OPTIONS)
91 else
92 ifneq ($(filter arm64,$(DEB_HOST_ARCH)),)
93 dh_auto_configure -- \
94 $(COMMON_CONFIGURE_OPTIONS) \
95 -DMIR_RUN_ACCEPTANCE_TESTS=OFF \
96 -DMIR_PLATFORM=$(AVAILABLE_PLATFORMS) \
97 $(OVERRIDE_CONFIGURE_OPTIONS)
98 else
99 dh_auto_configure -- \
100 $(COMMON_CONFIGURE_OPTIONS) \
101 -DMIR_PLATFORM=$(AVAILABLE_PLATFORMS) \
102 $(OVERRIDE_CONFIGURE_OPTIONS)
103 endif
104 endif
105 # Run cmake again to pick up wlcs tests, because reasons?
106 cmake build-$(DEB_HOST_ARCH)
107
108 # Reconstruct the MirAL version
109 MIRAL_VERSION_MAJOR = $(shell perl -n -e '/^set\(MIRAL_VERSION_MAJOR ([0-9]*)\)$$/ && print $$1' src/CMakeLists.txt)
110 MIRAL_VERSION_MINOR = $(shell perl -n -e '/^set\(MIRAL_VERSION_MINOR ([0-9]*)\)$$/ && print $$1' src/CMakeLists.txt)
111 MIRAL_VERSION_PATCH = $(shell perl -n -e '/^set\(MIRAL_VERSION_PATCH ([0-9]*)\)$$/ && print $$1' src/CMakeLists.txt)
112 MIRAL_RELEASE=$(MIRAL_VERSION_MAJOR).$(MIRAL_VERSION_MINOR).$(MIRAL_VERSION_PATCH)
113 MIRAL_VERSION=$(MIRAL_RELEASE).$(DEB_VERSION)
114
115 # TODO: we'll use a symbol file once mir is abi stable
116 override_dh_makeshlibs:
117 dh_makeshlibs -Nlibmiral7 -V -Nmir-test-tools
118 dh_makeshlibs -plibmiral7 -V -- -v$(MIRAL_RELEASE)
119
120 # Don't try to strip libraries used as test data
121 override_dh_strip:
122 dh_strip -Xmir-test-data
123
124 # Don't try to find dependencies of libraries used as test data
125 override_dh_shlibdeps:
126 dh_shlibdeps -Xmir-test-data
127
128 override_dh_gencontrol:
129 dh_gencontrol -Nlibmiral7 -Nlibmiral-dev
130 dh_gencontrol -plibmiral7 -plibmiral-dev -- -v$(MIRAL_VERSION) -V'libmiral7:Version=$(MIRAL_VERSION)'
131
132 override_dh_auto_clean:
133 dh_auto_clean
134 # build cruft not cleaned up by CMake
135 rm -f include/miral/miral/version.h include/server/mir/version.h
136
137 override_dh_clean:
138 dh_clean
139 rm -Rfv $(BUILD_HOME)
140 rm -Rfv $(BUILD_XDG_RUNTIME_DIR)
141
142 get-orig-source:
143 uscan --noconf --force-download --rename --download-current-version --destdir=..