Diff gtk+-2.24.33-r3 with a gtk+-3.24.35

/usr/portage/x11-libs/gtk+/gtk+-3.24.35.ebuild 2024-12-25 14:59:52.855270185 +0300
1 1
# Copyright 1999-2024 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=8
4
EAPI=7
5 5
GNOME2_EAUTORECONF="yes"
6 6

  
7
inherit flag-o-matic gnome2 multilib multilib-minimal readme.gentoo-r1 virtualx
7
inherit gnome2 multilib multilib-minimal virtualx
8 8

  
9 9
DESCRIPTION="Gimp ToolKit +"
10 10
HOMEPAGE="https://www.gtk.org/"
11 11

  
12 12
LICENSE="LGPL-2+"
13
SLOT="2"
14
IUSE="aqua cups examples +introspection test vim-syntax xinerama"
13
SLOT="3"
14
IUSE="aqua broadway colord cups examples gtk-doc +introspection sysprof test vim-syntax wayland +X xinerama"
15 15
REQUIRED_USE="
16
	xinerama? ( !aqua )
16
	|| ( aqua wayland X )
17
	xinerama? ( X )
17 18
"
18 19

  
19
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
20
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-solaris"
20 21

  
21 22
# Upstream wants us to do their job:
22
# https://bugzilla.gnome.org/show_bug.cgi?id=768663#c1
23
# https://bugzilla.gnome.org/show_bug.cgi?id=768662#c1
23 24
RESTRICT="test"
24 25

  
26
# FIXME: introspection data is built against system installation of gtk+:3,
27
# bug #????
25 28
COMMON_DEPEND="
26 29
	>=app-accessibility/at-spi2-core-2.46.0[introspection?,${MULTILIB_USEDEP}]
27
	>=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}]
28
	>=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}]
30
	>=dev-libs/fribidi-0.19.7[${MULTILIB_USEDEP}]
31
	>=dev-libs/glib-2.57.2:2[${MULTILIB_USEDEP}]
32
	media-libs/fontconfig[${MULTILIB_USEDEP}]
33
	>=media-libs/harfbuzz-2.2.0:=
34
	>=media-libs/libepoxy-1.4[X(+)?,${MULTILIB_USEDEP}]
29 35
	virtual/libintl[${MULTILIB_USEDEP}]
30
	>=x11-libs/cairo-1.12.14-r4:=[aqua?,svg(+),${MULTILIB_USEDEP}]
31
	>=x11-libs/gdk-pixbuf-2.30.7:2[introspection?,${MULTILIB_USEDEP}]
32
	>=x11-libs/pango-1.36.3[introspection?,${MULTILIB_USEDEP}]
36
	>=x11-libs/cairo-1.14[aqua?,glib,svg(+),X?,${MULTILIB_USEDEP}]
37
	>=x11-libs/gdk-pixbuf-2.30:2[introspection?,${MULTILIB_USEDEP}]
38
	>=x11-libs/pango-1.44.0[introspection?,${MULTILIB_USEDEP}]
33 39
	x11-misc/shared-mime-info
34 40

  
35
	cups? ( >=net-print/cups-1.7.1-r2:=[${MULTILIB_USEDEP}] )
36
	introspection? ( >=dev-libs/gobject-introspection-0.9.3:= )
37
	!aqua? (
38
		>=x11-libs/cairo-1.12.14-r4:=[aqua?,svg(+),X,${MULTILIB_USEDEP}]
39
		>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
40
		>=x11-libs/libXcomposite-0.4.4-r1[${MULTILIB_USEDEP}]
41
		>=x11-libs/libXcursor-1.1.14[${MULTILIB_USEDEP}]
42
		>=x11-libs/libXdamage-1.1.4-r1[${MULTILIB_USEDEP}]
43
		>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
44
		>=x11-libs/libXfixes-5.0.1[${MULTILIB_USEDEP}]
45
		>=x11-libs/libXi-1.7.2[${MULTILIB_USEDEP}]
41
	colord? ( >=x11-misc/colord-0.1.9:0=[${MULTILIB_USEDEP}] )
42
	cups? ( >=net-print/cups-2.0[${MULTILIB_USEDEP}] )
43
	introspection? ( >=dev-libs/gobject-introspection-1.39:= )
44
	sysprof? ( >=dev-util/sysprof-capture-3.33.2:3[${MULTILIB_USEDEP}] )
45
	wayland? (
46
		>=dev-libs/wayland-1.14.91[${MULTILIB_USEDEP}]
47
		>=dev-libs/wayland-protocols-1.21
48
		media-libs/mesa[wayland,${MULTILIB_USEDEP}]
49
		>=x11-libs/libxkbcommon-0.2[${MULTILIB_USEDEP}]
50
	)
51
	X? (
52
		media-libs/libglvnd[X(+),${MULTILIB_USEDEP}]
53
		x11-libs/libX11[${MULTILIB_USEDEP}]
54
		x11-libs/libXcomposite[${MULTILIB_USEDEP}]
55
		x11-libs/libXcursor[${MULTILIB_USEDEP}]
56
		x11-libs/libXdamage[${MULTILIB_USEDEP}]
57
		x11-libs/libXext[${MULTILIB_USEDEP}]
58
		x11-libs/libXfixes[${MULTILIB_USEDEP}]
59
		>=x11-libs/libXi-1.8[${MULTILIB_USEDEP}]
46 60
		>=x11-libs/libXrandr-1.5[${MULTILIB_USEDEP}]
47
		>=x11-libs/libXrender-0.9.8[${MULTILIB_USEDEP}]
48
		xinerama? ( >=x11-libs/libXinerama-1.1.3[${MULTILIB_USEDEP}] )
61
		xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
49 62
	)
50 63
"
51 64
DEPEND="${COMMON_DEPEND}
52
	!aqua? ( x11-base/xorg-proto )
53 65
	test? (
54 66
		media-fonts/font-cursor-misc
55 67
		media-fonts/font-misc-misc
56
		x11-themes/hicolor-icon-theme
57 68
	)
69
	X? ( x11-base/xorg-proto )
58 70
"
59

  
60
# gtk+-2.24.8 breaks Alt key handling in <=x11-libs/vte-0.28.2:0
61
# Add blocker against old gtk-builder-convert to be sure we maintain both
62
# in sync.
63 71
RDEPEND="${COMMON_DEPEND}
64
	>=dev-util/gtk-update-icon-cache-2
65
	>=x11-themes/adwaita-icon-theme-3.14
66
	x11-themes/gnome-themes-standard
67
	!<dev-util/gtk-builder-convert-${PV}
72
	>=dev-util/gtk-update-icon-cache-3
68 73
"
69 74
# librsvg for svg icons (PDEPEND to avoid circular dep), bug #547710
70 75
PDEPEND="
71 76
	gnome-base/librsvg[${MULTILIB_USEDEP}]
72
	x11-themes/gtk-engines-adwaita
77
	>=x11-themes/adwaita-icon-theme-3.14
73 78
	vim-syntax? ( app-vim/gtk-syntax )
74 79
"
75
# docbook-4.1.2 and xsl required for man pages
76
# docbook-4.3 required for gtk-doc
77 80
BDEPEND="
78 81
	app-text/docbook-xml-dtd:4.1.2
79
	app-text/docbook-xml-dtd:4.3
80 82
	app-text/docbook-xsl-stylesheets
81 83
	dev-libs/gobject-introspection-common
82 84
	dev-libs/libxslt
85
	>=dev-util/gdbus-codegen-2.48
83 86
	dev-util/glib-utils
84 87
	>=dev-build/gtk-doc-am-1.20
85
	>=sys-devel/gettext-0.18.3
88
	wayland? ( dev-util/wayland-scanner )
89
	>=sys-devel/gettext-0.19.7
86 90
	virtual/pkgconfig
87
	examples? ( x11-libs/gdk-pixbuf )
91
	x11-libs/gdk-pixbuf:2
92
	gtk-doc? (
93
		app-text/docbook-xml-dtd:4.3
94
		>=dev-util/gtk-doc-1.20
95
	)
88 96
"
89 97

  
90
DISABLE_AUTOFORMATTING="yes"
91
DOC_CONTENTS="To make the gtk2 file chooser use 'current directory' mode by default,
92
edit ~/.config/gtk-2.0/gtkfilechooser.ini to contain the following:
93
[Filechooser Settings]
94
StartupMode=cwd"
95

  
96 98
MULTILIB_CHOST_TOOLS=(
97
	/usr/bin/gtk-query-immodules-2.0$(get_exeext)
99
	/usr/bin/gtk-query-immodules-3.0$(get_exeext)
98 100
)
99 101

  
100 102
PATCHES=(
101
	# Fix tests running when building out of sources, bug #510596, upstream bug #730319
102
	"${FILESDIR}"/${PN}-2.24.24-out-of-source.patch
103
	# Rely on split gtk-update-icon-cache package, bug #528810
104
	"${FILESDIR}"/${PN}-2.24.31-update-icon-cache.patch # requires eautoreconf
105
	# Respect ${NM}, bug #725852
106
	"${FILESDIR}"/${PN}-2.24.33-respect-NM.patch # requires eautoreconf
107
	# Fix casts, bug #880617
108
	"${FILESDIR}"/${PN}-2.24.33-Fix-casts.patch
103
	# gtk-update-icon-cache is installed by dev-util/gtk-update-icon-cache
104
	"${FILESDIR}"/${PN}-3.24.25-update-icon-cache.patch
105

  
106
	# Fix broken autotools logic
107
	"${FILESDIR}"/${PN}-3.22.20-libcloudproviders-automagic.patch
109 108
)
110 109

  
111 110
strip_builddir() {
......
117 116
		|| die "Could not strip director ${directory} from build."
118 117
}
119 118

  
120
set_gtk2_confdir() {
121
	# An arch specific config directory is used on multilib systems
122
	GTK2_CONFDIR="/etc/gtk-2.0/${CHOST}"
123
}
124

  
125 119
src_prepare() {
126
	# Various glib marshaller churn could break build against a different glib version, force regeneration
127
	rm -v gdk/gdkmarshalers.{c,h} gtk/gtkmarshal.{c,h} gtk/gtkmarshalers.{c,h} \
128
		perf/marshalers.{c,h} gtk/gtkaliasdef.c gtk/gtkalias.h || die
129

  
130
	# Stop trying to build unmaintained docs, bug #349754, upstream bug #623150
131
	strip_builddir SUBDIRS tutorial docs/Makefile.{am,in}
132
	strip_builddir SUBDIRS faq docs/Makefile.{am,in}
133

  
134
	# -O3 and company cause random crashes in applications, bug #133469
135
	replace-flags -O3 -O2
136
	strip-flags
137
	# Not compatible with C23 decls
138
	append-flags -std=gnu17
139

  
140 120
	if ! use test ; then
141 121
		# don't waste time building tests
142
		strip_builddir SRC_SUBDIRS tests Makefile.{am,in}
143
		strip_builddir SUBDIRS tests gdk/Makefile.{am,in} gtk/Makefile.{am,in}
144
	else
145
		# Non-working test in gentoo's env
146
		sed 's:\(g_test_add_func ("/ui-tests/keys-events.*\):/*\1*/:g' \
147
			-i gtk/tests/testing.c || die "sed 1 failed"
148

  
149
		# Cannot work because glib is too clever to find real user's home
150
		# gentoo bug #285687, upstream bug #639832
151
		# XXX: /!\ Pay extra attention to second sed when bumping /!\
152
		sed '/TEST_PROGS.*recentmanager/d' -i gtk/tests/Makefile.am \
153
			|| die "failed to disable recentmanager test (1)"
154
		sed '/^TEST_PROGS =/,+3 s/recentmanager//' -i gtk/tests/Makefile.in \
155
			|| die "failed to disable recentmanager test (2)"
156
		sed 's:\({ "GtkFileChooserButton".*},\):/*\1*/:g' -i gtk/tests/object.c \
157
			|| die "failed to disable recentmanager test (3)"
158

  
159
		# https://bugzilla.gnome.org/show_bug.cgi?id=617473
160
		sed -i -e 's:pltcheck.sh:$(NULL):g' \
161
			gtk/Makefile.am || die
162

  
163
		# UI tests require immodules already installed; bug #413185
164
		if ! has_version 'x11-libs/gtk+:2'; then
165
			ewarn "Disabling UI tests because this is the first install of"
166
			ewarn "gtk+:2 on this machine. Please re-run the tests after ${P}"
167
			ewarn "has been installed."
168
			sed '/g_test_add_func.*ui-tests/ d' \
169
				-i gtk/tests/testing.c || die "sed 2 failed"
170
		fi
122
		strip_builddir SRC_SUBDIRS testsuite Makefile.{am,in}
123

  
124
		# the tests dir needs to be build now because since commit
125
		# 7ff3c6df80185e165e3bf6aa31bd014d1f8bf224 tests/gtkgears.o needs to be there
126
		# strip_builddir SRC_SUBDIRS tests Makefile.{am,in}
171 127
	fi
172 128

  
173 129
	if ! use examples; then
174 130
		# don't waste time building demos
175 131
		strip_builddir SRC_SUBDIRS demos Makefile.{am,in}
132
		strip_builddir SRC_SUBDIRS examples Makefile.{am,in}
176 133
	fi
177 134

  
178 135
	gnome2_src_prepare
179 136
}
180 137

  
181 138
multilib_src_configure() {
182
	[[ ${ABI} == ppc64 ]] && append-flags -mminimal-toc
183

  
184
	ECONF_SOURCE=${S} \
185
	gnome2_src_configure \
186
		$(usex aqua --with-gdktarget=quartz --with-gdktarget=x11) \
187
		$(usex aqua "" --with-xinput) \
188
		$(use_enable cups cups auto) \
189
		$(multilib_native_use_enable introspection) \
190
		$(use_enable xinerama) \
191
		--disable-papi \
192
		--enable-man \
193
		--with-xml-catalog="${EPREFIX}"/etc/xml/catalog \
139
	local myconf=(
140
		$(use_enable aqua quartz-backend)
141
		$(use_enable broadway broadway-backend)
142
		$(use_enable colord)
143
		$(use_enable cups cups auto)
144
		$(multilib_native_use_enable gtk-doc)
145
		$(multilib_native_use_enable introspection)
146
		$(use_enable sysprof profiler)
147
		$(use_enable wayland wayland-backend)
148
		$(use_enable X x11-backend)
149
		$(use_enable X xcomposite)
150
		$(use_enable X xdamage)
151
		$(use_enable X xfixes)
152
		$(use_enable X xkb)
153
		$(use_enable X xrandr)
154
		$(use_enable xinerama)
155
		# cloudprovider is not packaged in Gentoo yet
156
		--disable-cloudproviders
157
		--disable-papi
158
		--enable-man
159
		--with-xml-catalog="${EPREFIX}"/etc/xml/catalog
160
		# need libdir here to avoid a double slash in a path that libtool doesn't
161
		# grok so well during install (// between $EPREFIX and usr ...)
162
		# TODO: Is this still the case?
163
		--libdir="${EPREFIX}"/usr/$(get_libdir)
194 164
		CUPS_CONFIG="${EPREFIX}/usr/bin/${CHOST}-cups-config"
165
	)
166

  
167
	if use wayland; then
168
		myconf+=(
169
			# Include wayland immodule into gtk itself, to avoid problems like
170
			# https://gitlab.gnome.org/GNOME/gnome-shell/issues/109 from a
171
			# user overridden GTK_IM_MODULE envvar
172
			--with-included-immodules=wayland
173
		)
174
	fi;
175

  
176
	ECONF_SOURCE=${S} gnome2_src_configure "${myconf[@]}"
195 177

  
196 178
	# work-around gtk-doc out-of-source brokedness
197 179
	if multilib_is_native_abi; then
......
203 185
}
204 186

  
205 187
multilib_src_test() {
206
	virtx emake check
188
	"${EROOT}${GLIB_COMPILE_SCHEMAS}" --allow-any-name "${S}/gtk" || die
189
	GSETTINGS_SCHEMA_DIR="${S}/gtk" virtx emake check
207 190
}
208 191

  
209 192
multilib_src_install() {
......
211 194
}
212 195

  
213 196
multilib_src_install_all() {
214
	# see bug #133241
215
	# Also set more default variables in sync with gtk3 and other distributions
216
	insinto /usr/share/gtk-2.0
217
	newins - gtkrc <<- 'EOF'
218
	gtk-fallback-icon-theme = "gnome"
219
	gtk-theme-name = "Adwaita"
220
	gtk-icon-theme-name = "Adwaita"
221
	gtk-cursor-theme-name = "Adwaita"
222
	EOF
223

  
197
	insinto /etc/gtk-3.0
198
	doins "${FILESDIR}"/settings.ini
199
	# Skip README.{in,commits,win32} that would get installed by default
200
	DOCS=( AUTHORS ChangeLog NEWS README )
224 201
	einstalldocs
225
	rm "${ED}"/usr/share/doc/${P}/ChangeLog # empty file
226

  
227
	# dev-util/gtk-builder-convert split off into a separate package, #402905
228
	rm "${ED}"/usr/bin/gtk-builder-convert || die
229
	rm "${ED}"/usr/share/man/man1/gtk-builder-convert.* || die
230

  
231
	readme.gentoo_create_doc
232 202
}
233 203

  
234 204
pkg_preinst() {
......
236 206

  
237 207
	multilib_pkg_preinst() {
238 208
		# Make immodules.cache belongs to gtk+ alone
239
		local cache="/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache"
209
		local cache="/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache"
240 210

  
241
		if [[ -e "${EROOT}${cache}" ]]; then
211
		if [[ -e ${EROOT}${cache} ]]; then
242 212
			cp "${EROOT}${cache}" "${ED}${cache}" || die
243 213
		else
244 214
			touch "${ED}${cache}" || die
......
251 221
	gnome2_pkg_postinst
252 222

  
253 223
	multilib_pkg_postinst() {
254
		gnome2_query_immodules_gtk2 \
224
		gnome2_query_immodules_gtk3 \
255 225
			|| die "Update immodules cache failed (for ${ABI})"
256 226
	}
257 227
	multilib_parallel_foreach_abi multilib_pkg_postinst
258 228

  
259
	set_gtk2_confdir
260

  
261
	if [[ -e "${EROOT}/etc/gtk-2.0/gtk.immodules" ]]; then
262
		elog "File /etc/gtk-2.0/gtk.immodules has been moved to \$CHOST"
263
		elog "aware location. Removing deprecated file."
264
		rm -f "${EROOT}/etc/gtk-2.0/gtk.immodules"
265
	fi
266

  
267
	if [[ -e "${EROOT}${GTK2_CONFDIR}/gtk.immodules" ]]; then
268
		elog "File /etc/gtk-2.0/gtk.immodules has been moved to"
269
		elog "${EROOT}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache"
270
		elog "Removing deprecated file."
271
		rm -f "${EROOT}${GTK2_CONFDIR}/gtk.immodules"
272
	fi
273

  
274
	# pixbufs are now handled by x11-libs/gdk-pixbuf
275
	if [[ -e "${EROOT}${GTK2_CONFDIR}/gdk-pixbuf.loaders" ]]; then
276
		elog "File ${EROOT}${GTK2_CONFDIR}/gdk-pixbuf.loaders is now handled by x11-libs/gdk-pixbuf"
277
		elog "Removing deprecated file."
278
		rm -f "${EROOT}${GTK2_CONFDIR}/gdk-pixbuf.loaders"
279
	fi
280

  
281
	# two checks needed since we dropped multilib conditional
282
	if [[ -e "${EROOT}/etc/gtk-2.0/gdk-pixbuf.loaders" ]]; then
283
		elog "File ${EROOT}/etc/gtk-2.0/gdk-pixbuf.loaders is now handled by x11-libs/gdk-pixbuf"
284
		elog "Removing deprecated file."
285
		rm -f "${EROOT}/etc/gtk-2.0/gdk-pixbuf.loaders"
286
	fi
287

  
288
	if [[ -e "${EROOT}"/usr/lib/gtk-2.0/2.[^1]* ]]; then
289
		elog "You need to rebuild ebuilds that installed into" "${EROOT}"/usr/lib/gtk-2.0/2.[^1]*
290
		elog "to do that you can use qfile from portage-utils:"
291
		elog "emerge -va1 \$(qfile -qC ${EPREFIX}/usr/lib/gtk-2.0/2.[^1]*)"
292
	fi
293

  
294 229
	if ! has_version "app-text/evince"; then
295 230
		elog "Please install app-text/evince for print preview functionality."
296 231
		elog "Alternatively, check \"gtk-print-preview-command\" documentation and"
297
		elog "add it to your gtkrc."
232
		elog "add it to your settings.ini file."
298 233
	fi
299

  
300
	readme.gentoo_print_elog
301 234
}
302 235

  
303 236
pkg_postrm() {
......
305 238

  
306 239
	if [[ -z ${REPLACED_BY_VERSION} ]]; then
307 240
		multilib_pkg_postrm() {
308
			rm -f "${EROOT}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache"
241
			rm -f "${EROOT}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache"
309 242
		}
310 243
		multilib_foreach_abi multilib_pkg_postrm
311 244
	fi
Thank you!