| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
include /usr/share/dpkg/default.mk |
| 4 |
include /usr/share/dpkg/pkg-info.mk |
| 5 |
|
| 6 |
built_binaries := $(shell dh_listpackages) |
| 7 |
all_binaries := $(shell sed -ne 's/^Package: *//p' < debian/control) |
| 8 |
|
| 9 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 10 |
# Ensure the build aborts when there are still references to undefined symbols |
| 11 |
# currently fails at least in the im-multipress im module |
| 12 |
#LDFLAGS += -Wl,-z,defs |
| 13 |
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 |
| 14 |
|
| 15 |
APIVER := 3 |
| 16 |
SONAME := 0 |
| 17 |
|
| 18 |
LIBDIR := usr/lib/$(DEB_HOST_MULTIARCH) |
| 19 |
|
| 20 |
# earliest version that this release has backwards binary compatibility for |
| 21 |
GTK_BINARY_VERSION := 3.0.0 |
| 22 |
|
| 23 |
# Gtk binary version virtual Provide |
| 24 |
GTK_BINVER_DEP := gtk$(APIVER)-binver-$(GTK_BINARY_VERSION) |
| 25 |
|
| 26 |
# relative base directory for configuration |
| 27 |
CONFDIR := etc/gtk-3.0 |
| 28 |
|
| 29 |
# relative base directory for all types of modules |
| 30 |
MODULES_BASE_PATH := $(LIBDIR)/gtk-3.0/$(GTK_BINARY_VERSION) |
| 31 |
|
| 32 |
# package names |
| 33 |
SHARED_PKG := libgtk-$(APIVER)-$(SONAME)t64 |
| 34 |
COMMON_PKG := libgtk-$(APIVER)-common |
| 35 |
DEV_PKG := libgtk-$(APIVER)-dev |
| 36 |
UDEB_PKG := libgtk-$(APIVER)-$(SONAME)-udeb |
| 37 |
DOC_PKG := libgtk-$(APIVER)-doc |
| 38 |
BIN_PKG := libgtk-$(APIVER)-bin |
| 39 |
EXAMPLES_PKG := gtk-$(APIVER)-examples |
| 40 |
|
| 41 |
# files larger than 4k in size will be compressed by dh_compress |
| 42 |
# so append a .gz suffix to avoid dangling symlinks |
| 43 |
NEWS := NEWS$(shell find -maxdepth 1 -size +4k -name NEWS -exec echo ".gz" \;) |
| 44 |
README := README.md$(shell find -maxdepth 1 -size +4k -name README.md -exec echo ".gz" \;) |
| 45 |
|
| 46 |
# Avoid test failures on buildd environments |
| 47 |
export HOME=$(CURDIR)/debian/build |
| 48 |
export XDG_RUNTIME_DIR=$(HOME) |
| 49 |
# So that gsettings can find the (uninstalled) gtk schemas |
| 50 |
export XDG_DATA_DIRS=/usr/share:$(CURDIR)/debian/build |
| 51 |
# Put these back to their defaults if we are not running with a clean |
| 52 |
# environment, so that they are based on the temporary $HOME above |
| 53 |
unexport XDG_CACHE_HOME |
| 54 |
unexport XDG_CONFIG_DIRS |
| 55 |
unexport XDG_CONFIG_HOME |
| 56 |
unexport XDG_DATA_HOME |
| 57 |
|
| 58 |
# macro computing the list of 'debian/<pkg>.*" files which have a |
| 59 |
# corresponding ".in" file; pass the list of packages in $(1) |
| 60 |
dh_subst_files = $(patsubst %.in,%,$(wildcard $(addprefix debian/, $(addsuffix *.in, $(1))))) |
| 61 |
|
| 62 |
debian/%: debian/%.in |
| 63 |
dh_testdir |
| 64 |
sed \ |
| 65 |
-e "s#@SONAME@#$(SONAME)#g" \ |
| 66 |
-e "s#@APIVER@#$(APIVER)#g" \ |
| 67 |
-e "s#@SHARED_PKG@#$(SHARED_PKG)#g" \ |
| 68 |
-e "s#@COMMON_PKG@#$(COMMON_PKG)#g" \ |
| 69 |
-e "s#@DEV_PKG@#$(DEV_PKG)#g" \ |
| 70 |
-e "s#@DOC_PKG@#$(DOC_PKG)#g" \ |
| 71 |
-e "s#@BIN_PKG@#$(BIN_PKG)#g" \ |
| 72 |
-e "s#@LIBDIR@#$(LIBDIR)#g" \ |
| 73 |
-e 's#@CONFDIR@#$(CONFDIR)#g' \ |
| 74 |
-e "s#@MODULES_BASE_PATH@#$(MODULES_BASE_PATH)#g" \ |
| 75 |
-e "s#@NEWS@#$(NEWS)#g" \ |
| 76 |
-e "s#@README@#$(README)#g" \ |
| 77 |
[email protected] > $@ |
| 78 |
|
| 79 |
dh_options = |
| 80 |
|
| 81 |
configure_flags_common = \ |
| 82 |
-Dx11_backend=true \ |
| 83 |
$(NULL) |
| 84 |
|
| 85 |
configure_flags_deb = \ |
| 86 |
--default-library=shared \ |
| 87 |
-Dbroadway_backend=true \ |
| 88 |
-Dinstalled_tests=true \ |
| 89 |
-Dintrospection=true \ |
| 90 |
-Dprint_backends=cups,file \ |
| 91 |
$(NULL) |
| 92 |
|
| 93 |
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) |
| 94 |
configure_flags_deb += --cross-file=$(DEB_HOST_GNU_TYPE)-gobject-introspection.ini |
| 95 |
endif |
| 96 |
|
| 97 |
ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES))) |
| 98 |
configure_flags_deb += -Dcolord=yes |
| 99 |
else |
| 100 |
configure_flags_deb += -Dcolord=no |
| 101 |
endif |
| 102 |
|
| 103 |
ifneq (,$(filter amd64 arm64 armel armhf i386 mips64el ppc64el riscv64 s390x hppa loong64 powerpc ppc64 sh4,$(DEB_HOST_ARCH))) |
| 104 |
configure_flags_deb += -Dprofiler=true |
| 105 |
else |
| 106 |
configure_flags_deb += -Dprofiler=false |
| 107 |
endif |
| 108 |
|
| 109 |
# We don't build gtk-update-icon-cache on release architectures (+ loong64) because we assume they get it from gtk4. |
| 110 |
# We still build it on -ports architectures (except loong64) because they don't build gtk4 reliably. |
| 111 |
ifneq (,$(filter amd64 arm64 armel armhf i386 mips64el ppc64el riscv64 s390x loong64,$(DEB_HOST_ARCH))) |
| 112 |
dh_options += -Ngtk-update-icon-cache |
| 113 |
endif |
| 114 |
|
| 115 |
ifeq (linux,$(DEB_HOST_ARCH_OS)) |
| 116 |
configure_flags_deb += -Dwayland_backend=true |
| 117 |
else |
| 118 |
configure_flags_deb += -Dwayland_backend=false |
| 119 |
endif |
| 120 |
|
| 121 |
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),) |
| 122 |
configure_flags_deb += -Dman=true |
| 123 |
else |
| 124 |
configure_flags_deb += -Dman=false |
| 125 |
endif |
| 126 |
|
| 127 |
ifeq ($(filter %-doc,$(built_binaries)),) |
| 128 |
configure_flags_deb += -Dgtk_doc=false |
| 129 |
else |
| 130 |
configure_flags_deb += -Dgtk_doc=true |
| 131 |
endif |
| 132 |
|
| 133 |
ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes), yes) |
| 134 |
# Not in main repository |
| 135 |
configure_flags_deb += -Dcloudproviders=false |
| 136 |
else |
| 137 |
configure_flags_deb += -Dcloudproviders=true |
| 138 |
endif |
| 139 |
|
| 140 |
configure_flags_udeb = \ |
| 141 |
-Dbroadway_backend=false \ |
| 142 |
-Dcolord=no \ |
| 143 |
-Dgtk_doc=false \ |
| 144 |
-Dintrospection=false \ |
| 145 |
-Dman=false \ |
| 146 |
-Dprint_backends=file \ |
| 147 |
-Dwayland_backend=false \ |
| 148 |
$(NULL) |
| 149 |
|
| 150 |
%: |
| 151 |
dh $@ $(dh_options) |
| 152 |
|
| 153 |
fuzzy_reftests = |
| 154 |
|
| 155 |
# https://gitlab.gnome.org/GNOME/gtk/-/issues/5545 |
| 156 |
fuzzy_reftests += label-background |
| 157 |
|
| 158 |
# Debian-specific |
| 159 |
ignore_reftests += \ |
| 160 |
flipping-icons \ |
| 161 |
$(NULL) |
| 162 |
|
| 163 |
ifneq (,$(filter $(DEB_HOST_ARCH_CPU),i386)) |
| 164 |
ignore_reftests += linear-gradient |
| 165 |
endif |
| 166 |
|
| 167 |
# https://bugs.debian.org/1024392 |
| 168 |
ifeq (big,$(DEB_HOST_ARCH_ENDIAN)) |
| 169 |
ignore_reftests += border-image-excess-size |
| 170 |
endif |
| 171 |
|
| 172 |
xfail_reftests = \ |
| 173 |
$(NULL) |
| 174 |
|
| 175 |
override_dh_clean: |
| 176 |
rm -f $(call dh_subst_files,$(all_binaries)) |
| 177 |
rm -rf debian/build debian/install |
| 178 |
# The build system does not automatically update the GResource files |
| 179 |
# when resources change. Force an update in case we ship a patch which |
| 180 |
# modifies the theme CSS files. |
| 181 |
rm -f gtk/theme/Adwaita/gtk-contained.css |
| 182 |
rm -f gtk/theme/Adwaita/gtk-contained-dark.css |
| 183 |
rm -f gtk/theme/HighContrast/gtk-contained.css |
| 184 |
rm -f gtk/theme/HighContrast/gtk-contained-inverse.css |
| 185 |
dh_clean |
| 186 |
|
| 187 |
# Add dependencies to generate files from the debian/*.in ones |
| 188 |
override_dh_auto_build: $(call dh_subst_files,$(all_binaries)) |
| 189 |
|
| 190 |
override_dh_auto_build: rebuild-emoji |
| 191 |
rebuild-emoji: |
| 192 |
${DEB_BUILD_GNU_TYPE}-gcc ${CPPFLAGS_FOR_BUILD} ${CFLAGS_FOR_BUILD} ${LDFLAGS_FOR_BUILD} \ |
| 193 |
-o debian/convert-emoji gtk/emoji/convert-emoji.c \ |
| 194 |
$$(${DEB_BUILD_GNU_TYPE}-pkgconf --cflags --libs json-glib-1.0) |
| 195 |
set -eu; for input in debian/missing-sources/emojibase/packages/data/*/data.raw.json; do \ |
| 196 |
lang=$$(echo $$input | sed -ne 's,^.*/\([a-z][a-z]\)/data.raw.json$$,\1,p'); \ |
| 197 |
output=gtk/emoji/$$lang.data; \ |
| 198 |
debian/convert-emoji $$input $$output; \ |
| 199 |
done |
| 200 |
|
| 201 |
override_dh_auto_configure: debian/control |
| 202 |
dh_auto_configure \ |
| 203 |
--builddirectory=debian/build/deb \ |
| 204 |
-- \ |
| 205 |
$(configure_flags_common) \ |
| 206 |
$(configure_flags_deb) \ |
| 207 |
$(NULL) |
| 208 |
ifneq ($(filter %-udeb,$(built_binaries)),) |
| 209 |
dh_auto_configure \ |
| 210 |
--builddirectory=debian/build/udeb \ |
| 211 |
-- \ |
| 212 |
$(configure_flags_common) \ |
| 213 |
$(configure_flags_udeb) \ |
| 214 |
$(NULL) |
| 215 |
endif |
| 216 |
|
| 217 |
override_dh_auto_build: |
| 218 |
( cd gtk/theme/Adwaita; ./parse-sass.sh ) |
| 219 |
( cd gtk/theme/HighContrast; ./parse-sass.sh ) |
| 220 |
dh_auto_build --builddirectory=debian/build/deb |
| 221 |
ifneq ($(filter %-udeb,$(built_binaries)),) |
| 222 |
dh_auto_build --builddirectory=debian/build/udeb |
| 223 |
endif |
| 224 |
|
| 225 |
override_dh_auto_test: |
| 226 |
# The tests require librsvg2-common which is only available on architectures |
| 227 |
# where rust has been ported to, disable the tests on the other ones |
| 228 |
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x powerpc ppc64 riscv64 sparc64)) |
| 229 |
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
| 230 |
# So that gsettings can find the (uninstalled) gtk schemas |
| 231 |
mkdir -p debian/build/glib-2.0/schemas/ |
| 232 |
cp gtk/org.gtk.* debian/build/glib-2.0/schemas/ |
| 233 |
glib-compile-schemas debian/build/glib-2.0/schemas/ |
| 234 |
env \ |
| 235 |
BUILDDIR=$(CURDIR)/debian/build/deb \ |
| 236 |
FUZZY_REFTESTS="$(fuzzy_reftests)" \ |
| 237 |
IGNORE_REFTESTS="$(ignore_reftests)" \ |
| 238 |
LIBGL_ALWAYS_SOFTWARE=1 \ |
| 239 |
XFAIL_REFTESTS="$(xfail_reftests)" \ |
| 240 |
debian/run-tests.sh --timeout-multiplier 4 |
| 241 |
endif |
| 242 |
endif |
| 243 |
|
| 244 |
override_dh_auto_install: |
| 245 |
dh_auto_install --builddirectory=debian/build/deb --destdir=debian/install/deb |
| 246 |
ifneq ($(filter %-udeb,$(built_binaries)),) |
| 247 |
dh_auto_install --builddirectory=debian/build/udeb --destdir=debian/install/udeb |
| 248 |
endif |
| 249 |
|
| 250 |
override_dh_install: |
| 251 |
dh_install -p$(UDEB_PKG) --sourcedir=debian/install/udeb |
| 252 |
dh_install --remaining-packages --sourcedir=debian/install/deb |
| 253 |
ifneq ($(filter $(EXAMPLES_PKG),$(built_binaries)),) |
| 254 |
printf '%s\n' "${DEB_HOST_MULTIARCH}" > debian/$(EXAMPLES_PKG)/usr/libexec/installed-tests/gtk+/DEB_HOST_MULTIARCH |
| 255 |
endif |
| 256 |
|
| 257 |
# debhelper >= 13.4 makes all of /usr/libexec executable, which is not |
| 258 |
# quite right for installed-tests |
| 259 |
override_dh_fixperms: |
| 260 |
dh_fixperms -Xusr/libexec/installed-tests |
| 261 |
ifneq ($(filter $(EXAMPLES_PKG),$(built_binaries)),) |
| 262 |
chmod --recursive --changes a+rX,u+w,og-w debian/$(EXAMPLES_PKG)/usr/libexec/installed-tests |
| 263 |
endif |
| 264 |
|
| 265 |
override_dh_missing: |
| 266 |
ifneq ($(filter %-udeb,$(built_binaries)),) |
| 267 |
dh_missing --sourcedir=debian/install/udeb --list-missing |
| 268 |
endif |
| 269 |
dh_missing --sourcedir=debian/install/deb --list-missing |
| 270 |
|
| 271 |
override_dh_installchangelogs: |
| 272 |
dh_installchangelogs -XChangeLog |
| 273 |
|
| 274 |
override_dh_installdocs: |
| 275 |
dh_installdocs -p$(COMMON_PKG) README.md NEWS |
| 276 |
# We need to install into /u/s/d/l-doc, not -dev according to |
| 277 |
# debhelper 11's defaults, otherwise it would have file conflicts |
| 278 |
dh_installdocs -p$(DOC_PKG) --doc-main-package=$(DOC_PKG) -X.in |
| 279 |
dh_installdocs --remaining-packages -A |
| 280 |
|
| 281 |
override_dh_installman: |
| 282 |
dh_installman --sourcedir=debian/install/deb |
| 283 |
|
| 284 |
override_dh_makeshlibs: |
| 285 |
dh_makeshlibs -p$(SHARED_PKG) --add-udeb=$(UDEB_PKG) -X$(MODULES_BASE_PATH) -- -c4 |
| 286 |
dh_makeshlibs -plibgail-3-0t64 -- -c4 |
| 287 |
dh_makeshlibs --remaining-packages -X$(MODULES_BASE_PATH) |
| 288 |
|
| 289 |
dpkg_gencontrol_args = -Vgtk:BinVer=$(GTK_BINVER_DEP) |
| 290 |
# libcloudproviders is in Ubuntu "universe" |
| 291 |
ifneq ($(shell dpkg-vendor --query vendor),Ubuntu) |
| 292 |
dpkg_gencontrol_args += -VcloudProvider:Depends='libcloudproviders-dev (>= 0.3.2)' |
| 293 |
endif |
| 294 |
|
| 295 |
override_dh_gencontrol: |
| 296 |
dh_gencontrol -- $(dpkg_gencontrol_args) |
| 297 |
|
| 298 |
# We only use dh_gnome to automatically run dh_translations in Ubuntu |
| 299 |
override_dh_gnome: |