File: rules

package info (click to toggle)
gtk4 4.18.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 191,540 kB
  • sloc: ansic: 808,125; xml: 3,256; javascript: 3,061; python: 2,118; sh: 972; cpp: 799; java: 685; makefile: 319; perl: 218
file content (416 lines) | stat: -rwxr-xr-x 13,090 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

# Ensure the build aborts when there are still references to undefined symbols
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs

# Make the linker work a bit harder so dynamic loading can be done faster
DEB_LDFLAGS_MAINT_APPEND += -Wl,-O1

# https://bugs.debian.org/1077289
ifeq (i386,$(DEB_HOST_ARCH_CPU))
export DEB_CFLAGS_MAINT_APPEND = -ffloat-store
endif

include /usr/share/dpkg/default.mk

dh_options =
built_binaries := $(shell dh_listpackages)
all_binaries := $(shell sed -ne 's/^Package: *//p' < debian/control)

export APIVER := 4
export SONAME := 1

export LIBDIR := usr/lib/$(DEB_HOST_MULTIARCH)

# earliest version that this release has backwards binary compatibility for
export GTK_BINARY_VERSION := 4.0.0

# relative base directory for configuration
export CONFDIR := etc/gtk-4.0

# relative base directory for all types of modules
export MODULES_BASE_PATH := $(LIBDIR)/gtk-4.0/$(GTK_BINARY_VERSION)

# package names
export SHARED_PKG := libgtk-$(APIVER)-$(SONAME)
export COMMON_PKG := libgtk-$(APIVER)-common
export DEV_PKG := libgtk-$(APIVER)-dev
export UDEB_PKG := $(SHARED_PKG)-udeb
export DOC_PKG := libgtk-$(APIVER)-doc
export BIN_PKG := libgtk-$(APIVER)-bin
export MEDIA_GSTREAMER_PKG := libgtk-$(APIVER)-media-gstreamer
export EXAMPLES_PKG := gtk-$(APIVER)-examples
export TESTS_PKG := gtk-$(APIVER)-tests

# files larger than 4k in size will be compressed by dh_compress
# so append a .gz suffix to avoid dangling symlinks
export README_MD_MAYBE_GZ := README.md$(shell find -maxdepth 1 -size +4k -name README.md -exec echo ".gz" \;)

# macro computing the list of 'debian/<pkg>.*" files which have a
# corresponding ".in" file; pass the list of packages in $(1)
dh_subst_files = $(patsubst %.in,%,$(wildcard $(addprefix debian/, $(addsuffix *.in, $(1)))))

debian/%: debian/%.in
	dh_testdir
	sed \
		-e "s#@SONAME@#$(SONAME)#g" \
		-e "s#@APIVER@#$(APIVER)#g" \
		-e "s#@SHARED_PKG@#$(SHARED_PKG)#g" \
		-e "s#@COMMON_PKG@#$(COMMON_PKG)#g" \
		-e "s#@DEV_PKG@#$(DEV_PKG)#g" \
		-e "s#@UDEB_PKG@#$(UDEB_PKG)#g" \
		-e "s#@DOC_PKG@#$(DOC_PKG)#g" \
		-e "s#@BIN_PKG@#$(BIN_PKG)#g" \
		-e "s#@MEDIA_GSTREAMER_PKG@#$(MEDIA_GSTREAMER_PKG)#g" \
		-e "s#@EXAMPLES_PKG@#$(EXAMPLES_PKG)#g" \
		-e "s#@TESTS_PKG@#$(TESTS_PKG)#g" \
		-e "s#@LIBDIR@#$(LIBDIR)#g" \
		-e "s#@MODULES_BASE_PATH@#$(MODULES_BASE_PATH)#g" \
		-e "s#@DEB_VERSION_UPSTREAM@#$(DEB_VERSION_UPSTREAM)#g" \
		$@.in > $@

configure_flags_deb = \
	-Dauto_features=enabled \
	-Dbroadway-backend=true \
	-Dx11-backend=true \
	${NULL}
local_recommends =

ifeq ($(call dpkg_vendor_derives_from_v1,ubuntu),yes)
configure_flags_deb += -Dprint-cpdb=enabled
configure_flags_deb += -Dprint-cups=disabled
local_recommends += 'cpdb-backend-cups (>= 2.0~b5)',
else
configure_flags_deb += -Dprint-cpdb=disabled
configure_flags_deb += -Dprint-cups=enabled
endif

ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
configure_flags_deb += --cross-file=$(DEB_HOST_GNU_TYPE)-gobject-introspection.ini
endif

ifeq (,$(filter pkg.gtk4.nocolord,$(DEB_BUILD_PROFILES)))
configure_flags_deb += -Dcolord=enabled
else
configure_flags_deb += -Dcolord=disabled
endif

ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
configure_flags_deb += -Dman-pages=true
else
configure_flags_deb += -Dman-pages=false
endif

ifeq (linux,$(DEB_HOST_ARCH_OS))
configure_flags_deb += -Dwayland-backend=true
else
configure_flags_deb += -Dvulkan=disabled
configure_flags_deb += -Dwayland-backend=false
endif

ifneq (,$(filter amd64 arm64 armel armhf i386 mips64el ppc64el riscv64 s390x hppa loong64 powerpc ppc64 sh4,$(DEB_HOST_ARCH)))
configure_flags_deb += -Dsysprof=enabled
else
configure_flags_deb += -Dsysprof=disabled
endif

ifeq ($(filter %-doc,$(built_binaries)),)
configure_flags_deb += -Ddocumentation=false
else
configure_flags_deb += -Ddocumentation=true
endif

ifeq ($(filter %-examples,$(built_binaries)),)
configure_flags_deb += -Dbuild-demos=false
configure_flags_deb += -Dbuild-examples=false
else
configure_flags_deb += -Dbuild-demos=true
configure_flags_deb += -Dbuild-examples=true
endif

ifeq ($(filter %-tests,$(built_binaries)),)
configure_flags_deb += -Dinstall-tests=false
else
configure_flags_deb += -Dinstall-tests=true
endif

ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes), yes)
# Not in main repository
configure_flags_deb += -Dcloudproviders=disabled
else
configure_flags_deb += -Dcloudproviders=enabled
endif

configure_flags_udeb = \
	-Dauto_features=disabled \
	-Dbroadway-backend=false \
	-Dbuild-examples=false \
	-Dbuild-demos=false \
	-Dbuild-tests=false \
	-Dinstall-tests=false \
	-Dintrospection=disabled \
	-Dvulkan=disabled \
	-Dwayland-backend=false \
	-Dx11-backend=true \
	$(NULL)

%:
	dh $@ --buildsystem=meson $(dh_options)

override_dh_clean: debian/control
	rm -f $(call dh_subst_files,$(all_binaries))
	rm -rf debian/build debian/install
	# Rebuild the CSS from source. Note that gtk.css is hand-written,
	# not generated, so don't delete that one.
	rm -f gtk/theme/Default/Default-*.css
	dh_clean

# Add dependencies to generate files from the debian/*.in ones
override_dh_auto_build: $(call dh_subst_files,$(all_binaries))

override_dh_auto_build: rebuild-emoji
rebuild-emoji:
	${DEB_BUILD_GNU_TYPE}-gcc \
		$(CPPFLAGS_FOR_BUILD) \
		$(CFLAGS_FOR_BUILD) \
		$(LDFLAGS_FOR_BUILD) \
		-o debian/convert-emoji \
		gtk/emoji/convert-emoji.c \
		$$(${DEB_BUILD_GNU_TYPE}-pkgconf --cflags --libs json-glib-1.0)
	set -eu; for input in debian/missing-sources/emojibase/packages/data/??/data.raw.json; do \
		lang="$$(echo "$$input" | sed -ne 's,^.*/\([a-z][a-z]\)/data.raw.json$$,\1,p')"; \
		output="gtk/emoji/$$lang.data"; \
		inputen="debian/missing-sources/emojibase/packages/data/en/data.raw.json"; \
		test -f "$$output" || continue; \
		debian/convert-emoji "$$inputen" "$$input" "$$output"; \
	done

override_dh_auto_configure: debian/control
	dh_auto_configure \
		--builddirectory=debian/build/deb \
		-- \
		$(configure_flags_deb) \
		$(NULL)
ifneq ($(filter %-udeb,$(built_binaries)),)
	dh_auto_configure \
		--builddirectory=debian/build/udeb \
		-- \
		$(configure_flags_udeb) \
		$(NULL)
endif

override_dh_auto_build:
	dh_auto_build --builddirectory=debian/build/deb
ifneq ($(filter %-udeb,$(built_binaries)),)
	dh_auto_build --builddirectory=debian/build/udeb
endif

test_backends = x11
test_timeout_multiplier = 3

ifeq (linux,$(DEB_HOST_ARCH_OS))
	test_backends += wayland
endif

ifneq ($(filter arm hppa mips% sparc%,$(DEB_HOST_ARCH_CPU)),)
$(info Slow architecture detected, increasing test timeout)
test_timeout_multiplier = 10
endif

ifneq ($(filter loong64 m68k riscv64 sh4,$(DEB_HOST_ARCH_CPU)),)
$(info Architecture with qemu buildds detected, increasing test timeout a lot)
test_timeout_multiplier = 20
endif

export LIBGL_ALWAYS_SOFTWARE=true

fuzzy_gsk_compare = \
	$(NULL)

ignore_gsk_compare = \
	unaligned-offscreen \
	$(NULL)

xfail_gsk_compare = \
	$(NULL)

fuzzy_reftests = \
	border-image-url \
	label-attribute-preference \
	label-wrap-justify \
	pseudoclass-on-box \
	quit-mnemonic \
	$(NULL)

ignore_reftests = \
	$(NULL)

xfail_reftests = \
	label-sizing \
	sizegroups-evolution-identity-page \
	$(NULL)

# ignore some of the gsk compare suites, upstream said those are going
# to give slightly different results depending on the renderers and the
# software rendering stack and are meant to be used in CI in a well
# defined environment and not really suitable for distros
# https://gitlab.gnome.org/GNOME/gtk/-/issues/6383
skipped_suites = \
	failing \
	flaky \
	headless \
	wayland_failing \
	wayland_gles_failing \
	gsk-compare-broadway \
	gsk-compare-gl \
	gsk-compare-cairo \
	gsk-compare-ngl \
	gsk-compare-vulkan \
	needs-udmabuf \
	$(NULL)

# The doc-check tests aren't passing yet
skipped_suites += docs

# mips*: many tests segfault as of 2024-09-16, see also https://bugs.debian.org/993550
# powerpc: "LLVM ERROR: Relocation type not implemented yet!" as of 2024-09-16, https://bugs.debian.org/1081947
# sparc*: "Target has no JIT support" as of 2024-09-16, https://bugs.debian.org/1081943
ifneq ($(filter mips% powerpc sparc%,$(DEB_HOST_ARCH_CPU)),)
$(info Disabling use of llvmpipe on this CPU)
export GALLIUM_DRIVER=softpipe
# https://bugs.debian.org/1077178
ignore_reftests += label-shadows
# These succeed with llvmpipe, but fail with softpipe
# https://gitlab.gnome.org/GNOME/gtk/-/issues/6085
# https://bugs.debian.org/1050077
# https://bugs.debian.org/1051168
fuzzy_gsk_compare += opacity-overdraw
ignore_gsk_compare += border-one-rounded
fuzzy_reftests += opacity
endif

# https://bugs.debian.org/1050312
ifeq (i386,$(DEB_HOST_ARCH_CPU))
ignore_reftests += \
	hbox-with-ellipsizing-wrapping-label \
	window-border-width \
	$(NULL)
endif

# https://bugs.debian.org/1024391
ifeq (big,$(DEB_HOST_ARCH_ENDIAN))
	ignore_reftests += border-image-excess-size
endif

# workaround 4.14 tests failing on s390x
ifeq (big,$(DEB_HOST_ARCH_ENDIAN))
	ignore_reftests += \
	background-blend-mode-clip-interaction \
	gradient-hard-stop \
	linear-gradient \
	background-origin \
	background-position-repeat \
	background-position \
	center-center-100x100-picture-in-100x200 \
	center-center-100x100-picture-in-100x200-overlay \
	center-center-100x100-picture-in-200x100 \
	center-center-100x100-picture-in-200x100-overlay \
	center-center-20x20-picture-in-100x200 \
	center-center-20x20-picture-in-100x200-overlay \
	center-center-20x20-picture-in-200x100 \
	center-center-20x20-picture-in-200x100-overlay \
	center-center-150x150-picture-in-100x200 \
	center-center-150x150-picture-in-100x200-overlay \
	center-center-150x150-picture-in-200x100 \
	center-center-150x150-picture-in-200x100-overlay \
	center-center-300x300-picture-in-100x200 \
	center-center-300x300-picture-in-100x200-overlay \
	center-center-300x300-picture-in-200x100 \
	center-center-300x300-picture-in-200x100-overlay \
	css-match-class \
	css-match-name \
	css-match-type \
	icon-vfuncs \
	image-load-from-file \
	linear-gradient-transition-to-other \
	$(NULL)
endif

override_dh_auto_test:
	env \
		BUILDDIR=debian/build/deb \
		FUZZY_GSK_COMPARE="$(fuzzy_gsk_compare)" \
		FUZZY_REFTESTS="$(fuzzy_reftests)" \
		IGNORE_GSK_COMPARE="$(ignore_gsk_compare)" \
		IGNORE_REFTESTS="$(ignore_reftests)" \
		XFAIL_GSK_COMPARE="$(xfail_gsk_compare)" \
		XFAIL_REFTESTS="$(xfail_reftests)" \
		BACKENDS="$(test_backends)" \
	debian/run-tests.sh -t $(test_timeout_multiplier) \
		$(addprefix --no-suite=,$(skipped_suites)) \
		$(NULL)

override_dh_auto_install:
	dh_auto_install --builddirectory=debian/build/deb --destdir=debian/install/deb
ifneq ($(filter %-udeb,$(built_binaries)),)
	dh_auto_install --builddirectory=debian/build/udeb --destdir=debian/install/udeb
endif

override_dh_installman:
	dh_installman -p gtk-update-icon-cache debian/update-icon-caches.8 \
		debian/install/deb/usr/share/man/man1/gtk4-update-icon-cache.1
	dh_installman --sourcedir=debian/install/deb

override_dh_install:
	# upstream's Gitlab-CI has /dev/udmabuf but Debian kernels normally don't
	rm -fv debian/install/deb/usr/share/installed-tests/gtk-4.0/gdk/dmabuf-support.test
	rm -fv debian/install/udeb/usr/bin/gtk4-update-icon-cache
	rm -frv debian/install/udeb/usr/share/gtk-4.0/valgrind
	rm -frv debian/install/udeb/usr/share/metainfo
	:
	dh_install -p$(UDEB_PKG) --sourcedir=debian/install/udeb
	dh_install --remaining-packages --sourcedir=debian/install/deb

# debhelper >= 13.4 makes all of /usr/libexec executable, which is not
# quite right for installed-tests
override_dh_fixperms:
	dh_fixperms -Xusr/libexec/installed-tests
ifneq ($(filter %-tests,$(built_binaries)),)
	chmod --recursive --changes a+rX,u+w,og-w debian/*-tests/usr/libexec/installed-tests
	chmod +x debian/*-tests/usr/libexec/installed-tests/gtk-4.0/tools/simplify \
	         debian/*-tests/usr/libexec/installed-tests/gtk-4.0/tools/settings \
	         debian/*-tests/usr/libexec/installed-tests/gtk-4.0/tools/enumerate \
	         debian/*-tests/usr/libexec/installed-tests/gtk-4.0/tools/simplify-3to4 \
	         debian/*-tests/usr/libexec/installed-tests/gtk-4.0/tools/validate
endif

override_dh_missing:
ifneq ($(filter %-udeb,$(built_binaries)),)
	dh_missing --sourcedir=debian/install/udeb --list-missing -X.la
endif
	dh_missing --sourcedir=debian/install/deb --fail-missing -X.la -Xusr/share/man/man1/gtk4-update-icon-cache.1

override_dh_installdocs:
	dh_installdocs -p$(COMMON_PKG) AUTHORS README.md NEWS
	dh_installdocs -p$(DOC_PKG) AUTHORS -X.in
	dh_installdocs --remaining-packages

override_dh_makeshlibs:
	dh_makeshlibs -p$(SHARED_PKG) -V --add-udeb=$(UDEB_PKG) -X$(MODULES_BASE_PATH) -- -c4
	dh_makeshlibs --remaining-packages -X$(MODULES_BASE_PATH)

override_dh_gencontrol-arch:
	dh_gencontrol -p$(SHARED_PKG) -- \
		-Vlocal:Recommends=$(local_recommends) \
		-Vgtk:Provides=gtk$(APIVER)-binver-$(GTK_BINARY_VERSION)
ifneq ($(filter %-udeb,$(built_binaries)),)
	dh_gencontrol -p$(UDEB_PKG) -- \
		-Vgtk:Provides=gtk$(APIVER)-binver-$(GTK_BINARY_VERSION)
endif
	dh_gencontrol --remaining-packages

override_dh_gnome_clean: