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
|
#!/usr/bin/make -f
built_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
# https://marc.info/?i=1257999019.21780.15.camel@marzipan aka
# https://mail.gnome.org/archives/gtk-devel-list/2009-November/msg00096.html
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 $@
DEB_CONFIGURE_EXTRA_FLAGS =
# Can be dropped when we switch to dh compat 14
DEB_CONFIGURE_EXTRA_FLAGS += -Dauto_features=enabled
ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
# Properties of glibc. These are the same for all Debian architectures,
# and are auto-detected when doing a native build.
DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/libc-properties.ini
# The direction of stack growth varies between architectures.
ifneq ($(filter hppa,$(DEB_HOST_ARCH_CPU)),)
DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/stack-grows-up.ini
else
DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/stack-grows-down.ini
endif
ifeq ($(DEB_HOST_ARCH_OS),linux)
DEB_CONFIGURE_EXTRA_FLAGS += --cross-file=$(CURDIR)/debian/meson/linux.ini
endif
endif # cross-compiling
# This target can be run manually to verify that we have the source code
# for these files. If all goes well, it should result in no diff.
# This is not done automatically during the build, because it requires a
# git checkout of GLib.
maintainer-update-unicode-data:
rm -f glib/gscripttable.h
rm -f glib/gunibreak.h
rm -f glib/gunichartables.h
rm -f glib/gunidecomp.h
rm -f glib/tests/casefold.txt
rm -f glib/tests/casemap.txt
$(CURDIR)/tools/update-unicode-data.sh $(CURDIR)/unicode-data 17.0.0
debian/extra-substvars:
dpkg-architecture -c debian/extra-substvars.py > debian/extra-substvars
execute_before_dh_auto_configure: cross-tools
cross_tools = \
gi-compile-repository \
gi-decompile-typelib \
gi-inspect-typelib \
$(NULL)
cross-tools: debian/emulated-g-ir-tool.in debian/rules
mkdir -p debian/cross-tools
set -e; for tool in $(cross_tools); do \
sed \
-e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|' \
-e 's|@TOOL_PATH@|/usr/lib/$(DEB_HOST_MULTIARCH)/glib-2.0/'"$$tool"'|' \
< $< > debian/cross-tool.tmp; \
chmod 0755 debian/cross-tool.tmp; \
mv debian/cross-tool.tmp debian/cross-tools/$(DEB_HOST_GNU_TYPE)-$$tool; \
done
override_dh_auto_configure:
sed -e 's|@DEB_HOST_GNU_TYPE@|$(DEB_HOST_GNU_TYPE)|g' \
< debian/meson/exe-wrapper.ini.in \
> debian/meson/exe-wrapper.ini
dh_auto_configure \
--builddirectory=debian/build/deb \
-- \
$(DEB_CONFIGURE_EXTRA_FLAGS) \
$(DEB_CONFIGURE_FLAGS_deb) \
$(NULL)
ifneq ($(filter %-udeb,$(built_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
dh_clean -Xorg.gtk.test.gschema.xml.orig -Xorg.gtk.test.gschema.override.orig
# We only use dh_gnome to automatically run dh_translations in Ubuntu
override_dh_gnome:
override_dh_makeshlibs:
ifneq ($(filter libglib2.0-tests,$(built_binaries)),)
dh_makeshlibs -plibglib2.0-tests -n
endif
dh_makeshlibs --remaining-packages --add-udeb=libglib2.0-udeb -- -c4
override_dh_strip_nondeterminism:
dh_strip_nondeterminism -Xinstalled-tests
# (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
# 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.
# Keep the timeout reasonably short for architectures where interactive
# debugging is more likely, but extend it a lot on architectures that might
# be very slow or using qemu for buildds.
ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH_CPU)),)
test_timeout_multiplier = 3
else
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
# Remove LANGUAGE to avoid mismatches between expected and actual
# messages in non-English locales (mainly on reproducible-builds)
# First run the non-flaky tests, and fail the build if they fail (on linux)
env \
-u LANG \
-u LANGUAGE \
-u LD_PRELOAD \
DEB_BUILD_TIME_TESTS=1 \
LC_ALL=C.UTF-8 \
debian/tests/run-with-locales \
--generate de_DE=ISO-8859-1 \
--generate de_DE.utf8 \
--generate de_DE@euro.utf8 \
--generate el_GR.utf8 \
--generate en_GB=ISO-8859-1 \
--generate en_GB.utf8 \
--generate en_US=ISO-8859-1 \
--generate en_US.utf8 \
--generate es_ES.utf8 \
--generate fa_IR=UTF-8 \
--generate fa_IR.utf8 \
--generate fr_FR.utf8 \
--generate hr_HR.utf8 \
--generate ja_JP.utf8 \
--generate ja_JP.EUC-JP \
--generate lt_LT.utf8 \
--generate pl_PL=ISO-8859-2 \
--generate pl_PL.ISO-8859-2 \
--generate pl_PL.utf8 \
--generate ru_RU=ISO-8859-5 \
--generate ru_RU.utf8 \
--generate sr_RS=UTF-8 \
--generate sr_RS@latin=UTF-8 \
--generate sv_SE=ISO-8859-1 \
--generate sv_SE.utf8 \
--generate tr_TR=ISO-8859-9 \
--generate tr_TR.utf8 \
--generate tt_RU=UTF-8 \
--generate tt_RU.utf8 \
--generate tt_RU@iqtelif=UTF-8 \
-- \
dh_auto_test \
-B debian/build/deb \
-- \
--timeout-multiplier $(test_timeout_multiplier) \
--no-suite flaky \
--verbose \
|| $(handle_test_failure)
# and then run the flaky ones, but ignore them failing
env \
-u LANG \
-u LANGUAGE \
-u LD_PRELOAD \
DEB_BUILD_TIME_TESTS=1 \
LC_ALL=C.UTF-8 \
dh_auto_test \
-B debian/build/deb \
-- \
--timeout-multiplier $(test_timeout_multiplier) \
--suite flaky \
--verbose \
|| true
endif
# Skip build-time tests if all we are building is documentation;
# running them once per architecture is plenty.
override_dh_auto_test-indep:
ifeq ($(DEB_HOST_ARCH_OS),linux)
enable_libmount := enabled
enable_selinux := enabled
else
enable_libmount := disabled
enable_selinux := disabled
DEB_CONFIGURE_FLAGS_deb := -Dsysprof=disabled
endif
DEB_CONFIGURE_FLAGS_deb += \
--default-library both \
-Ddtrace=disabled \
-Dgir_dir_prefix=lib/${DEB_HOST_MULTIARCH} \
-Dglib_debug=disabled \
-Dlibmount=$(enable_libmount) \
-Dmultiarch=true \
-Dselinux=$(enable_selinux) \
-Dsystemtap=disabled \
$(NULL)
ifneq ($(filter gir1.2-% %-doc,$(built_binaries)),)
ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
DEB_CONFIGURE_FLAGS_deb += --cross-file=$(DEB_HOST_GNU_TYPE)-gobject-introspection.ini
# GLib insists on having an exe_wrapper when we enable introspection,
# even though in Debian, we happen to know that our g-ir-scanner
# automatically uses qemu
DEB_CONFIGURE_FLAGS_deb += --cross-file=$(CURDIR)/debian/meson/exe-wrapper.ini
endif
else
DEB_CONFIGURE_FLAGS_deb += -Dintrospection=disabled
endif
ifneq ($(filter libglib2.0-tests,$(built_binaries)),)
DEB_CONFIGURE_FLAGS_deb += -Dinstalled_tests=true
else
DEB_CONFIGURE_FLAGS_deb += -Dinstalled_tests=false
endif
ifneq ($(filter %-doc,$(built_binaries)),)
DEB_CONFIGURE_FLAGS_deb += -Ddocumentation=true
else
DEB_CONFIGURE_FLAGS_deb += -Ddocumentation=false
endif
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
DEB_CONFIGURE_FLAGS_deb += -Dman-pages=enabled
else
DEB_CONFIGURE_FLAGS_deb += -Dman-pages=disabled
endif
DEB_CONFIGURE_FLAGS_udeb := \
--default-library shared \
-Ddocumentation=false \
-Ddtrace=disabled \
-Dglib_debug=disabled \
-Dinstalled_tests=false \
-Dintrospection=disabled \
-Dlibelf=disabled \
-Dlibmount=disabled \
-Dman-pages=disabled \
-Dselinux=disabled \
-Dsysprof=disabled \
-Dsystemtap=disabled \
$(NULL)
override_dh_auto_build:
# GResource files don't contain any executable code, only an embeddable
# data blob, so compiler flags that would affect the behaviour of
# executable code (ABIs, hardening, optimizations, debug info) are
# not relevant.
@echo 'blhc: ignore-line-regexp: .*/glib-compile-resources\s+--compiler=.*'
# One test uses the C compiler to convert a binary blob into a raw
# object; again, there is no executable code involved, so compiler
# options that affect executable code aren't interesting.
@echo 'blhc: ignore-line-regexp: .*-Wl,-b,binary\s+-nostdlib\s+gio/tests/test5\.gresource.*'
mkdir -p debian/tmp-xdg-runtime-dir
dh_auto_build --builddirectory=debian/build/deb
ifneq ($(filter %-udeb,$(built_binaries)),)
dh_auto_build --builddirectory=debian/build/udeb
endif
override_dh_auto_install:
ifneq ($(filter %-udeb,$(built_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
sed -i \
-e 's|^girdir=\(.*\)|girdir=$${datadir}/gir-1.0|' \
debian/tmp/usr/lib/*/pkgconfig/girepository-2.0.pc
ifneq ($(filter %-doc,$(built_binaries)),)
sed -i \
-e 's|https\?://docs\.gtk\.org/gio/|../gio-2.0/|' \
-e 's|https\?://docs\.gtk\.org/gio-unix/|../gio-unix-2.0/|' \
-e 's|https\?://docs\.gtk\.org/glib/|../glib-2.0/|' \
-e 's|https\?://docs\.gtk\.org/glib-unix/|../glib-unix-2.0/|' \
-e 's|https\?://docs\.gtk\.org/gmodule/|../gmodule-2.0/|' \
-e 's|https\?://docs\.gtk\.org/gobject/|../gobject-2.0/|' \
debian/tmp/usr/share/doc/*-2.0/urlmap.js
sed -i \
-e 's|src="\.\./urlmap.js"|src="urlmap.js"|' \
debian/tmp/usr/share/doc/*-2.0/*.html
endif
override_dh_python3:
# dh_python3 can't process both a private directory and /usr/bin
# in the same invocation
dh_python3 -plibgio-2.0-dev-bin /usr/share/glib-2.0/codegen
dh_python3 -plibgio-2.0-dev-bin /usr/share/glib-2.0/gdb
dh_python3 -plibglib2.0-tests --no-ext-rename /usr/libexec/installed-tests/glib
dh_python3
override_dh_install:
ifneq ($(filter gir1.2-%,$(built_binaries)),)
# The build currently installs to /usr/share/gir-1.0 even though we
# specified lib/${DEB_HOST_MULTIARCH} as our gir_dir_prefix
if ! [ -d debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/gir-1.0 ]; then \
mv debian/tmp/usr/share/gir-1.0 debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/; \
fi
else
rm -fr debian/tmp/usr/lib/*/gir-1.0
rm -fr debian/tmp/usr/lib/*/girepository-1.0
rm -fr debian/tmp/usr/share/gir-1.0
endif
# Unwanted bits from the .deb build
rm -fr debian/tmp/usr/share/glib-2.0/codegen/__pycache__
ifneq ($(filter %-udeb,$(built_binaries)),)
# Unwanted bits from the .udeb build
rm -fr debian/install/udeb/usr/include
rm -f debian/install/udeb/usr/lib/*/*.so
rm -f debian/install/udeb/usr/lib/*/libgirepository*.so.*
rm -fr debian/install/udeb/usr/lib/*/gir-1.0
rm -fr debian/install/udeb/usr/lib/*/girepository-1.0
rm -fr debian/install/udeb/usr/lib/*/pkgconfig
rm -fr debian/install/udeb/usr/libexec/gio-launch-desktop
rm -fr debian/install/udeb/usr/share/gdb
rm -fr debian/install/udeb/usr/share/gettext/its
rm -fr debian/install/udeb/usr/share/gir-1.0
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
ifneq ($(filter %-tests,$(built_binaries)),)
sed -i -e '/^#!.*/,1 d' debian/tmp/usr/libexec/installed-tests/glib/taptestrunner.py
endif
dh_install --remaining-packages
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
execute_after_dh_installman-arch:
install -d debian/girepository-tools/usr/share/man/man1
set -e; for tool in $(cross_tools); do \
ln -s "$$tool.1.gz" "debian/girepository-tools/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-$$tool.1.gz"; \
done
endif
override_dh_dwz:
dh_dwz -Nlibglib2.0-udeb
# 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 --changes u=rw,og=r debian/libglib2.0-tests/usr/libexec/installed-tests/*/*.so
chmod --changes u=rw,og=r debian/libglib2.0-tests/usr/libexec/installed-tests/*/*/*.so
chmod --recursive --changes a+rX,u+w,og-w debian/libglib2.0-tests/usr/libexec/installed-tests
endif
override_dh_missing:
dh_missing
ifneq ($(filter %-udeb,$(built_binaries)),)
dh_missing --sourcedir=debian/install/udeb
endif
execute_before_dh_installdeb-arch:
set -e; for script in triggers; do \
sed -e"s/#DEB_HOST_MULTIARCH#/$(DEB_HOST_MULTIARCH)/g" \
debian/libglib2.0-0t64.$$script.in \
> debian/libglib2.0-0t64.$$script ; \
done
debian/libgirepository-2.0-0.symbols: debian/libgirepository-2.0-0.symbols.in debian/extra-substvars
set -e; \
libffiN=$$(sed -ne 's/^local:libffiN=//p' debian/extra-substvars); \
sed -e "s/@libffiN@/$$libffiN/" < $< > $@
execute_before_dh_makeshlibs: debian/libgirepository-2.0-0.symbols
override_dh_gencontrol: debian/extra-substvars
dh_gencontrol -- -Tdebian/extra-substvars
|