Debian Codegraph @

debian/rules

raw symbols SCIP
1 #!/usr/bin/make -f
2
3 built_binaries := $(shell dh_listpackages)
4
5 export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow
6
7 # Ensure the build aborts when there are still references to undefined symbols
8 DEB_LDFLAGS_MAINT_APPEND += -Wl,-z,defs
9
10 # NB: do NOT use -Wl,--as-needed to build glib; for instance the link to
11 # pthread is carefully crafted to allow dlopen()ing pthread-using libs; see
12 # https://marc.info/?i=1257999019.21780.15.camel@marzipan aka
13 # https://mail.gnome.org/archives/gtk-devel-list/2009-November/msg00096.html
14 DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed
15
16 # Make the linker work a bit harder so dynamic loading can be done faster
17 DEB_LDFLAGS_MAINT_APPEND += -Wl,-O1
18
19 include /usr/share/dpkg/default.mk
20
21 %:
22 dh $@
23
24 DEB_CONFIGURE_EXTRA_FLAGS =
25
26 # Can be dropped when we switch to dh compat 14
27 DEB_CONFIGURE_EXTRA_FLAGS += -Dauto_features=enabled
28
29 ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
30 # Properties of glibc. These are the same for all Debian architectures,
31 # and are auto-detected when doing a native build.
32 DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/libc-properties.ini
33
34 # The direction of stack growth varies between architectures.
35 ifneq ($(filter hppa,$(DEB_HOST_ARCH_CPU)),)
36 DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/stack-grows-up.ini
37 else
38 DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/stack-grows-down.ini
39 endif
40
41 ifeq ($(DEB_HOST_ARCH_OS),linux)
42 DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/linux.ini
43 endif
44 endif # cross-compiling
45
46 # This target can be run manually to verify that we have the source code
47 # for these files. If all goes well, it should result in no diff.
48 # This is not done automatically during the build, because it requires a
49 # git checkout of GLib.
50 maintainer-update-unicode-data:
51 rm -f glib/gscripttable.h
52 rm -f glib/gunibreak.h
53 rm -f glib/gunichartables.h
54 rm -f glib/gunidecomp.h
55 rm -f glib/tests/casefold.txt
56 rm -f glib/tests/casemap.txt
57 $(CURDIR)/tools/update-unicode-data.sh $(CURDIR)/unicode-data 17.0.0
58
59 debian/extra-substvars:
60 dpkg-architecture -c debian/extra-substvars.py > debian/extra-substvars
61
62 execute_before_dh_auto_configure: cross-tools
63
64 cross_tools = \
65 gi-compile-repository \
66 gi-decompile-typelib \
67 gi-inspect-typelib \
68 $(NULL)
69 cross-tools: debian/emulated-g-ir-tool.in debian/rules
70 mkdir -p debian/cross-tools
71 set -e; for tool in $(cross_tools); do \
72 sed \
73 -e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|' \
74 -e 's|@TOOL_PATH@|/usr/lib/$(DEB_HOST_MULTIARCH)/glib-2.0/'"$$tool"'|' \
75 < $< > debian/cross-tool.tmp; \
76 chmod 0755 debian/cross-tool.tmp; \
77 mv debian/cross-tool.tmp debian/cross-tools/$(DEB_HOST_GNU_TYPE)-$$tool; \
78 done
79
80 override_dh_auto_configure:
81 sed -e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|g' \
82 < debian/meson/exe-wrapper.ini.in \
83 > debian/meson/exe-wrapper.ini
84 dh_auto_configure \
85 --builddirectory=debian/build/deb \
86 -- \
87 $(DEB_CONFIGURE_EXTRA_FLAGS) \
88 $(DEB_CONFIGURE_FLAGS_deb) \
89 $(NULL)
90 ifneq ($(filter %-udeb,$(built_binaries)),)
91 dh_auto_configure \
92 --builddirectory=debian/build/udeb \
93 -- \
94 $(DEB_CONFIGURE_EXTRA_FLAGS) \
95 $(DEB_CONFIGURE_FLAGS_udeb) \
96 $(NULL)
97 endif
98
99 override_dh_clean:
100 rm -rf $(CURDIR)/debian/build \
101 $(CURDIR)/debian/install
102 dh_clean -Xorg.gtk.test.gschema.xml.orig -Xorg.gtk.test.gschema.override.orig
103
104 # We only use dh_gnome to automatically run dh_translations in Ubuntu
105 override_dh_gnome:
106
107 override_dh_makeshlibs:
108 ifneq ($(filter libglib2.0-tests,$(built_binaries)),)
109 dh_makeshlibs -plibglib2.0-tests -n
110 endif
111 dh_makeshlibs --remaining-packages --add-udeb=libglib2.0-udeb -- -c4
112
113 override_dh_strip_nondeterminism:
114 dh_strip_nondeterminism -Xinstalled-tests
115
116 # (Ubuntu-specific)
117 # Don't strip translations from the installed tests; makes them environment dependent.
118 override_dh_translations:
119 dh_translations -Xinstalled-tests
120
121 # Do not clutter $HOME with ~/.dbus-keyrings and avoid failure on the buildds
122 # where creating /home/buildd/.dbus-keyrings fails
123 export HOME=$(CURDIR)/debian/build
124
125 # Make sure that everything that uses D-Bus is creating its own temporary
126 # session rather than polluting the developer's (or failing, on buildds)
127 export DBUS_SESSION_BUS_ADDRESS=this-should-not-be-used-and-will-fail:
128
129 ifeq ($(DEB_HOST_ARCH_OS), linux)
130 handle_test_failure := exit $$?
131 else
132 handle_test_failure := true
133 endif
134
135 # Upstream test timeouts assume an otherwise unloaded system, but that
136 # isn't necessarily the case for a porterbox or multiple parallel builds.
137 # Keep the timeout reasonably short for architectures where interactive
138 # debugging is more likely, but extend it a lot on architectures that might
139 # be very slow or using qemu for buildds.
140 ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH_CPU)),)
141 test_timeout_multiplier = 3
142 else
143 test_timeout_multiplier = 20
144 endif
145
146 override_dh_auto_test-arch:
147 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
148 # Remove LD_PRELOAD so we don't run with fakeroot, which makes dbus-related tests fail
149 # Remove LANGUAGE to avoid mismatches between expected and actual
150 # messages in non-English locales (mainly on reproducible-builds)
151 # First run the non-flaky tests, and fail the build if they fail (on linux)
152 env \
153 -u LANG \
154 -u LANGUAGE \
155 -u LD_PRELOAD \
156 DEB_BUILD_TIME_TESTS=1 \
157 LC_ALL=C.UTF-8 \
158 debian/tests/run-with-locales \
159 --generate de_DE=ISO-8859-1 \
160 --generate de_DE.utf8 \
161 --generate [email protected] \
162 --generate el_GR.utf8 \
163 --generate en_GB=ISO-8859-1 \
164 --generate en_GB.utf8 \
165 --generate en_US=ISO-8859-1 \
166 --generate en_US.utf8 \
167 --generate es_ES.utf8 \
168 --generate fa_IR=UTF-8 \
169 --generate fa_IR.utf8 \
170 --generate fr_FR.utf8 \
171 --generate hr_HR.utf8 \
172 --generate ja_JP.utf8 \
173 --generate ja_JP.EUC-JP \
174 --generate lt_LT.utf8 \
175 --generate pl_PL=ISO-8859-2 \
176 --generate pl_PL.ISO-8859-2 \
177 --generate pl_PL.utf8 \
178 --generate ru_RU=ISO-8859-5 \
179 --generate ru_RU.utf8 \
180 --generate sr_RS=UTF-8 \
181 --generate sr_RS@latin=UTF-8 \
182 --generate sv_SE=ISO-8859-1 \
183 --generate sv_SE.utf8 \
184 --generate tr_TR=ISO-8859-9 \
185 --generate tr_TR.utf8 \
186 --generate tt_RU=UTF-8 \
187 --generate tt_RU.utf8 \
188 --generate tt_RU@iqtelif=UTF-8 \
189 -- \
190 dh_auto_test \
191 -B debian/build/deb \
192 -- \
193 --timeout-multiplier $(test_timeout_multiplier) \
194 --no-suite flaky \
195 --verbose \
196 || $(handle_test_failure)
197 # and then run the flaky ones, but ignore them failing
198 env \
199 -u LANG \
200 -u LANGUAGE \
201 -u LD_PRELOAD \
202 DEB_BUILD_TIME_TESTS=1 \
203 LC_ALL=C.UTF-8 \
204 dh_auto_test \
205 -B debian/build/deb \
206 -- \
207 --timeout-multiplier $(test_timeout_multiplier) \
208 --suite flaky \
209 --verbose \
210 || true
211 endif
212
213 # Skip build-time tests if all we are building is documentation;
214 # running them once per architecture is plenty.
215 override_dh_auto_test-indep:
216
217 ifeq ($(DEB_HOST_ARCH_OS),linux)
218 enable_libmount := enabled
219 enable_selinux := enabled
220 else
221 enable_libmount := disabled
222 enable_selinux := disabled
223 DEB_CONFIGURE_FLAGS_deb := -Dsysprof=disabled
224 endif
225
226 DEB_CONFIGURE_FLAGS_deb += \
227 --default-library both \
228 -Ddtrace=disabled \
229 -Dgir_dir_prefix=lib/${DEB_HOST_MULTIARCH} \
230 -Dglib_debug=disabled \
231 -Dlibmount=$(enable_libmount) \
232 -Dmultiarch=true \
233 -Dselinux=$(enable_selinux) \
234 -Dsystemtap=disabled \
235 $(NULL)
236
237 ifneq ($(filter gir1.2-% %-doc,$(built_binaries)),)
238 ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
239 DEB_CONFIGURE_FLAGS_deb += --cross-file=$(DEB_HOST_GNU_TYPE)-gobject-introspection.ini
240 # GLib insists on having an exe_wrapper when we enable introspection,
241 # even though in Debian, we happen to know that our g-ir-scanner
242 # automatically uses qemu
243 DEB_CONFIGURE_FLAGS_deb += --cross-file=$(CURDIR)/debian/meson/exe-wrapper.ini
244 endif
245 else
246 DEB_CONFIGURE_FLAGS_deb += -Dintrospection=disabled
247 endif
248
249 ifneq ($(filter libglib2.0-tests,$(built_binaries)),)
250 DEB_CONFIGURE_FLAGS_deb += -Dinstalled_tests=true
251 else
252 DEB_CONFIGURE_FLAGS_deb += -Dinstalled_tests=false
253 endif
254
255 ifneq ($(filter %-doc,$(built_binaries)),)
256 DEB_CONFIGURE_FLAGS_deb += -Ddocumentation=true
257 else
258 DEB_CONFIGURE_FLAGS_deb += -Ddocumentation=false
259 endif
260
261 ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
262 DEB_CONFIGURE_FLAGS_deb += -Dman-pages=enabled
263 else
264 DEB_CONFIGURE_FLAGS_deb += -Dman-pages=disabled
265 endif
266
267 DEB_CONFIGURE_FLAGS_udeb := \
268 --default-library shared \
269 -Ddocumentation=false \
270 -Ddtrace=disabled \
271 -Dglib_debug=disabled \
272 -Dinstalled_tests=false \
273 -Dintrospection=disabled \
274 -Dlibelf=disabled \
275 -Dlibmount=disabled \
276 -Dman-pages=disabled \
277 -Dselinux=disabled \
278 -Dsysprof=disabled \
279 -Dsystemtap=disabled \
280 $(NULL)
281
282 override_dh_auto_build:
283 # GResource files don't contain any executable code, only an embeddable
284 # data blob, so compiler flags that would affect the behaviour of
285 # executable code (ABIs, hardening, optimizations, debug info) are
286 # not relevant.
287 @echo 'blhc: ignore-line-regexp: .*/glib-compile-resources\s+--compiler=.*'
288 # One test uses the C compiler to convert a binary blob into a raw
289 # object; again, there is no executable code involved, so compiler
290 # options that affect executable code aren't interesting.
291 @echo 'blhc: ignore-line-regexp: .*-Wl,-b,binary\s+-nostdlib\s+gio/tests/test5\.gresource.*'
292 mkdir -p debian/tmp-xdg-runtime-dir
293 dh_auto_build --builddirectory=debian/build/deb
294 ifneq ($(filter %-udeb,$(built_binaries)),)
295 dh_auto_build --builddirectory=debian/build/udeb
296 endif
297
298 override_dh_auto_install:
299 ifneq ($(filter %-udeb,$(built_binaries)),)
300 dh_auto_install -plibglib2.0-udeb --builddirectory=debian/build/udeb --destdir=debian/install/udeb
301 endif
302 dh_auto_install --remaining-packages --builddirectory=debian/build/deb
303 sed -i \
304 -e 's|^girdir=\(.*\)|girdir=$${datadir}/gir-1.0|' \
305 debian/tmp/usr/lib/*/pkgconfig/girepository-2.0.pc
306 ifneq ($(filter %-doc,$(built_binaries)),)
307 sed -i \
308 -e 's|https\?://docs\.gtk\.org/gio/|../gio-2.0/|' \
309 -e 's|https\?://docs\.gtk\.org/gio-unix/|../gio-unix-2.0/|' \
310 -e 's|https\?://docs\.gtk\.org/glib/|../glib-2.0/|' \
311 -e 's|https\?://docs\.gtk\.org/glib-unix/|../glib-unix-2.0/|' \
312 -e 's|https\?://docs\.gtk\.org/gmodule/|../gmodule-2.0/|' \
313 -e 's|https\?://docs\.gtk\.org/gobject/|../gobject-2.0/|' \
314 debian/tmp/usr/share/doc/*-2.0/urlmap.js
315 sed -i \
316 -e 's|src="\.\./urlmap.js"|src="urlmap.js"|' \
317 debian/tmp/usr/share/doc/*-2.0/*.html
318 endif
319
320 override_dh_python3:
321 # dh_python3 can't process both a private directory and /usr/bin
322 # in the same invocation
323 dh_python3 -plibgio-2.0-dev-bin /usr/share/glib-2.0/codegen
324 dh_python3 -plibgio-2.0-dev-bin /usr/share/glib-2.0/gdb
325 dh_python3 -plibglib2.0-tests --no-ext-rename /usr/libexec/installed-tests/glib
326 dh_python3
327
328 override_dh_install:
329 ifneq ($(filter gir1.2-%,$(built_binaries)),)
330 # The build currently installs to /usr/share/gir-1.0 even though we
331 # specified lib/${DEB_HOST_MULTIARCH} as our gir_dir_prefix
332 if ! [ -d debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/gir-1.0 ]; then \
333 mv debian/tmp/usr/share/gir-1.0 debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/; \
334 fi
335 else
336 rm -fr debian/tmp/usr/lib/*/gir-1.0
337 rm -fr debian/tmp/usr/lib/*/girepository-1.0
338 rm -fr debian/tmp/usr/share/gir-1.0
339 endif
340 # Unwanted bits from the .deb build
341 rm -fr debian/tmp/usr/share/glib-2.0/codegen/__pycache__
342 ifneq ($(filter %-udeb,$(built_binaries)),)
343 # Unwanted bits from the .udeb build
344 rm -fr debian/install/udeb/usr/include
345 rm -f debian/install/udeb/usr/lib/*/*.so
346 rm -f debian/install/udeb/usr/lib/*/libgirepository*.so.*
347 rm -fr debian/install/udeb/usr/lib/*/gir-1.0
348 rm -fr debian/install/udeb/usr/lib/*/girepository-1.0
349 rm -fr debian/install/udeb/usr/lib/*/pkgconfig
350 rm -fr debian/install/udeb/usr/libexec/gio-launch-desktop
351 rm -fr debian/install/udeb/usr/share/gdb
352 rm -fr debian/install/udeb/usr/share/gettext/its
353 rm -fr debian/install/udeb/usr/share/gir-1.0
354 rm -fr debian/install/udeb/usr/share/glib-2.0/codegen
355 rm -fr debian/install/udeb/usr/share/glib-2.0/gdb
356 rm -fr debian/install/udeb/usr/share/glib-2.0/valgrind
357 rm -fr debian/install/udeb/usr/share/man
358 dh_install -plibglib2.0-udeb --sourcedir=debian/install/udeb
359 endif
360 ifneq ($(filter %-tests,$(built_binaries)),)
361 sed -i -e '/^#!.*/,1 d' debian/tmp/usr/libexec/installed-tests/glib/taptestrunner.py
362 endif
363 dh_install --remaining-packages
364
365 ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
366 execute_after_dh_installman-arch:
367 install -d debian/girepository-tools/usr/share/man/man1
368 set -e; for tool in $(cross_tools); do \
369 ln -s "$$tool.1.gz" "debian/girepository-tools/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$$tool.1.gz"; \
370 done
371 endif
372
373 override_dh_dwz:
374 dh_dwz -Nlibglib2.0-udeb
375
376 # debhelper >= 13.4 makes all of /usr/libexec executable, which is not
377 # quite right for installed-tests
378 override_dh_fixperms:
379 dh_fixperms -Xusr/libexec/installed-tests
380 ifneq ($(filter %-tests,$(built_binaries)),)
381 chmod --changes u=rw,og=r debian/libglib2.0-tests/usr/libexec/installed-tests/*/*.so
382 chmod --changes u=rw,og=r debian/libglib2.0-tests/usr/libexec/installed-tests/*/*/*.so
383 chmod --recursive --changes a+rX,u+w,og-w debian/libglib2.0-tests/usr/libexec/installed-tests
384 endif
385
386 override_dh_missing:
387 dh_missing
388 ifneq ($(filter %-udeb,$(built_binaries)),)
389 dh_missing --sourcedir=debian/install/udeb
390 endif
391
392 execute_before_dh_installdeb-arch:
393 set -e; for script in triggers; do \
394 sed -e"s/#DEB_HOST_MULTIARCH#/$(DEB_HOST_MULTIARCH)/g" \
395 debian/libglib2.0-0t64.$$script.in \
396 > debian/libglib2.0-0t64.$$script ; \
397 done
398
399 debian/libgirepository-2.0-0.symbols: debian/libgirepository-2.0-0.symbols.in debian/extra-substvars
400 set -e; \
401 libffiN=$$(sed -ne 's/^local:libffiN=//p' debian/extra-substvars); \
402 sed -e "s/@libffiN@/$$libffiN/" < $< > $@
403
404 execute_before_dh_makeshlibs: debian/libgirepository-2.0-0.symbols
405
406 override_dh_gencontrol: debian/extra-substvars
407 dh_gencontrol -- -Tdebian/extra-substvars