File: rules

package info (click to toggle)
glib2.0 2.58.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 48,444 kB
  • sloc: ansic: 452,195; xml: 16,781; python: 6,149; makefile: 3,776; sh: 1,499; perl: 1,140; cpp: 9
file content (245 lines) | stat: -rwxr-xr-x 7,603 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
#!/usr/bin/make -f

binaries := $(shell dh_listpackages)

export DEB_BUILD_MAINT_OPTIONS=hardening=+bindnow

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

# NB: do NOT use -Wl,--as-needed to build glib; for instance the link to
# pthread is carefully crafted to allow dlopen()ing pthread-using libs; see
# http://mid.gmane.org/1257999019.21780.15.camel@marzipan
DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed

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

include /usr/share/dpkg/default.mk

%:
	dh $@ --with gnome,python3 --buildsystem=meson

override_dh_autoreconf:
	@:

ifneq ($(filter hppa,$(DEB_HOST_ARCH_CPU)),)
stack_grows_up = true
else
stack_grows_up = false
endif

ifneq ($(filter kfreebsd,$(DEB_HOST_ARCH_OS)),)
have_non_stub_xattr = false
else
have_non_stub_xattr = true
endif

export DH_MESON_CROSS_FILE = debian/cross.txt

# We use our own copy of debcrossgen to work around unimplemented feature
# request https://bugs.debian.org/912559
override_dh_auto_configure:
ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
	debian/debcrossgen \
		--set have_c99_snprintf=true \
		--set have_c99_vsnprintf=true \
		--set have_strlcpy=false \
		--set have_unix98_printf=true \
		--set growing_stack=$(stack_grows_up) \
		-o debian/cross.txt
endif
	dh_auto_configure \
		--builddirectory=debian/build/deb \
		-- \
		$(DEB_CONFIGURE_EXTRA_FLAGS) \
		$(DEB_CONFIGURE_FLAGS_deb) \
		$(NULL)
ifneq ($(filter %-udeb,$(binaries)),)
	dh_auto_configure \
		--builddirectory=debian/build/udeb \
		-- \
		$(DEB_CONFIGURE_EXTRA_FLAGS) \
		$(DEB_CONFIGURE_FLAGS_udeb) \
		$(NULL)
endif

override_dh_clean:
	rm -rf $(CURDIR)/debian/build \
	       $(CURDIR)/debian/install \
	       $(CURDIR)/debian/tmp-xdg-runtime-dir
	dh_clean -Xorg.gtk.test.gschema.xml.orig -Xorg.gtk.test.gschema.override.orig


override_dh_makeshlibs:
	dh_makeshlibs -plibglib2.0-tests -n
	dh_makeshlibs --remaining-packages -V --add-udeb=libglib2.0-udeb -- -c4

override_dh_strip:
	dh_strip --dbgsym-migration='libglib2.0-0-dbg (<< 2.51.4-1~)'

# (Ubuntu-specific)
# Don't strip translations from the installed tests; makes them environment dependent.
override_dh_translations:
	dh_translations -Xinstalled-tests

# Do not clutter $HOME with ~/.dbus-keyrings and avoid failure on the buildds
# where creating /home/buildd/.dbus-keyrings fails
export HOME=$(CURDIR)/debian/build

# Put these back to their defaults if we are not running with a clean
# environment, so that they are based on the temporary $HOME above.
# Otherwise, some tests would try to write to the user's real XDG_DATA_HOME,
# causing unwanted side-effects or FTBFS depending whether the user's
# real HOME is available in the build chroot (if used)
unexport XDG_CACHE_HOME
unexport XDG_CONFIG_DIRS
unexport XDG_CONFIG_HOME
unexport XDG_DATA_HOME
unexport XDG_DATA_DIRS

# Make sure that everything that uses D-Bus is creating its own temporary
# session rather than polluting the developer's (or failing, on buildds)
export DBUS_SESSION_BUS_ADDRESS=this-should-not-be-used-and-will-fail:

ifeq ($(DEB_HOST_ARCH_OS), linux)
handle_test_failure := exit $$?
else
handle_test_failure := true
endif

# Upstream test timeouts assume an otherwise unloaded system, but that
# isn't necessarily the case for a porterbox or multiple parallel builds
test_timeout_multiplier = 3

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

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

override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# Remove LD_PRELOAD so we don't run with fakeroot, which makes dbus-related tests fail
	env -u LD_PRELOAD \
		DEB_BUILD_TIME_TESTS=1 \
		LC_ALL=C.UTF-8 \
		MESON_TESTTHREADS=1 \
	meson test -C debian/build/deb \
		--no-rebuild \
		--num-processes 1 \
		--timeout-multiplier $(test_timeout_multiplier) \
		--verbose \
	|| $(handle_test_failure)
endif

# Skip build-time tests if all we are building is documentation; running
# them once per architecture is plenty
override_dh_auto_test-indep:
	@:

# The tests assume this directory exists and is writable
export XDG_RUNTIME_DIR=$(CURDIR)/debian/tmp-xdg-runtime-dir
# Let's get failing tests' stdout and stderr so we have some information when
# a build fails
export VERBOSE=1

ifeq ($(DEB_HOST_ARCH_OS),linux)
is_linux := true
else
is_linux := false
endif

ifneq ($(filter hurd kfreebsd,$(DEB_HOST_ARCH_OS)),)
use_fam := true
else
use_fam := false
endif

# configure flags
DEB_CONFIGURE_EXTRA_FLAGS := \
	--libexecdir=lib/glib2.0 \
	-Dinternal_pcre=false \
	$(NULL)

DEB_CONFIGURE_FLAGS_deb := \
	--default-library both \
	-Dfam=$(use_fam) \
	-Dinstalled_tests=true \
	-Dlibmount=$(is_linux) \
	-Dman=true \
	-Dselinux=$(is_linux) \
	-Dsystemtap=true \
	-Dxattr=$(have_non_stub_xattr) \
	$(NULL)

ifneq ($(filter libglib2.0-doc,$(binaries)),)
DEB_CONFIGURE_FLAGS_deb += -Dgtk_doc=true
else
DEB_CONFIGURE_FLAGS_deb += -Dgtk_doc=false
endif

DEB_CONFIGURE_FLAGS_udeb := \
	--default-library shared \
	-Dgtk_doc=false \
	-Dinstalled_tests=false \
	-Dlibmount=false \
	-Dselinux=false \
	-Dxattr=$(have_non_stub_xattr) \
	$(NULL)

override_dh_auto_build:
	mkdir -p debian/tmp-xdg-runtime-dir
	dh_auto_build --builddirectory=debian/build/deb
ifneq ($(filter %-udeb,$(binaries)),)
	dh_auto_build --builddirectory=debian/build/udeb
endif

override_dh_auto_install:
	set -e; for script in postinst postrm triggers; do \
		sed -e"s/#MULTIARCH#/$(DEB_HOST_MULTIARCH)/g" \
		    -e"s/#ARCH#/$(DEB_HOST_ARCH)/g" \
		    debian/libglib2.0-0.$$script.in \
		    > debian/libglib2.0-0.$$script ; \
	done
ifneq ($(filter %-udeb,$(binaries)),)
	dh_auto_install -plibglib2.0-udeb --builddirectory=debian/build/udeb --destdir=debian/install/udeb
endif
	dh_auto_install --remaining-packages --builddirectory=debian/build/deb --destdir=debian/install/deb

override_dh_python3:
	# dh_python3 can't process both a private directory and /usr/bin
	# in the same invocation
	dh_python3 -plibglib2.0-dev-bin /usr/share/glib-2.0/codegen
	dh_python3 -plibglib2.0-dev-bin

override_dh_install:
	# Unwanted bits from the .deb build
	rm -fr debian/install/deb/usr/share/glib-2.0/codegen/__pycache__
	# https://gitlab.gnome.org/GNOME/glib/issues/1539
	chmod -v 0644 debian/install/deb/usr/lib/glib2.0/installed-tests/glib/desktop-files/usr/applications/org.gnome.clocks.desktop
	chmod -v 0644 debian/install/deb/usr/lib/glib2.0/installed-tests/glib/echo-script.bat
	chmod -v 0644 debian/install/deb/usr/share/bash-completion/completions/gio
	chmod -v 0644 debian/install/deb/usr/share/glib-2.0/codegen/codegen_main.py
ifneq ($(filter %-udeb,$(binaries)),)
	# Unwanted bits from the .udeb build
	rm -f debian/install/udeb/usr/lib/*/*.so
	rm -fr debian/install/udeb/usr/share/gdb
	rm -fr debian/install/udeb/usr/share/gettext/its
	rm -fr debian/install/udeb/usr/share/glib-2.0/codegen
	rm -fr debian/install/udeb/usr/share/glib-2.0/gdb
	rm -fr debian/install/udeb/usr/share/glib-2.0/valgrind
	rm -fr debian/install/udeb/usr/share/man
	dh_install -plibglib2.0-udeb --sourcedir=debian/install/udeb
endif
	dh_install --remaining-packages --sourcedir=debian/install/deb

override_dh_missing:
	dh_missing --sourcedir=debian/install/deb --fail-missing
ifneq ($(filter %-udeb,$(binaries)),)
	dh_missing --sourcedir=debian/install/udeb --fail-missing
endif