Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/glib/, dev-libs/glib/files/
Date: Tue, 27 Sep 2022 18:17:04
Message-Id: 1664302614.0a9a261cfe28fd20a512dfeb705b9fb4a5b3dbc2.sam@gentoo
1 commit: 0a9a261cfe28fd20a512dfeb705b9fb4a5b3dbc2
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 27 18:16:09 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 27 18:16:54 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a9a261c
7
8 dev-libs/glib: backport crash fix
9
10 As requested by e.g. GIMP maintainers
11 at https://twitter.com/zemarmot/status/1574362564015841281.
12
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14
15 .../glib/files/glib-2.74.0-crash-gparamspec.patch | 27 ++
16 dev-libs/glib/glib-2.74.0-r1.ebuild | 289 +++++++++++++++++++++
17 2 files changed, 316 insertions(+)
18
19 diff --git a/dev-libs/glib/files/glib-2.74.0-crash-gparamspec.patch b/dev-libs/glib/files/glib-2.74.0-crash-gparamspec.patch
20 new file mode 100644
21 index 000000000000..84edcde4189d
22 --- /dev/null
23 +++ b/dev-libs/glib/files/glib-2.74.0-crash-gparamspec.patch
24 @@ -0,0 +1,27 @@
25 +https://gitlab.gnome.org/GNOME/glib/-/commit/ea3f17d598d550345e94e4571130e429443e91cb
26 +https://gitlab.gnome.org/GNOME/glib/-/issues/2770
27 +
28 +From: Emmanuele Bassi <ebassi@×××××.org>
29 +Date: Sun, 25 Sep 2022 14:20:24 +0100
30 +Subject: [PATCH] Empty values are not valid GParamSpec
31 +
32 +The validate() vfunc for GParamSpecParam returns FALSE for empty GValue,
33 +which means the is_valid() vfunc should do the same.
34 +
35 +This avoids a segfault when calling g_param_value_is_valid() on a
36 +GParamSpecParam.
37 +
38 +Fixes: #2770
39 +--- a/gobject/gparamspecs.c
40 ++++ b/gobject/gparamspecs.c
41 +@@ -894,6 +894,9 @@ param_param_is_valid (GParamSpec *pspec,
42 + {
43 + GParamSpec *param = value->data[0].v_pointer;
44 +
45 ++ if (param == NULL)
46 ++ return FALSE;
47 ++
48 + return g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec));
49 + }
50 +
51 +GitLab
52
53 diff --git a/dev-libs/glib/glib-2.74.0-r1.ebuild b/dev-libs/glib/glib-2.74.0-r1.ebuild
54 new file mode 100644
55 index 000000000000..9c91688a8c0a
56 --- /dev/null
57 +++ b/dev-libs/glib/glib-2.74.0-r1.ebuild
58 @@ -0,0 +1,289 @@
59 +# Copyright 1999-2022 Gentoo Authors
60 +# Distributed under the terms of the GNU General Public License v2
61 +
62 +EAPI=8
63 +PYTHON_REQ_USE="xml(+)"
64 +PYTHON_COMPAT=( python3_{8..11} )
65 +
66 +inherit flag-o-matic gnome.org gnome2-utils linux-info meson-multilib multilib python-any-r1 toolchain-funcs xdg
67 +
68 +DESCRIPTION="The GLib library of C routines"
69 +HOMEPAGE="https://www.gtk.org/"
70 +
71 +LICENSE="LGPL-2.1+"
72 +SLOT="2"
73 +IUSE="dbus debug +elf gtk-doc +mime selinux static-libs sysprof systemtap test utils xattr"
74 +RESTRICT="!test? ( test )"
75 +REQUIRED_USE="gtk-doc? ( test )" # Bug #777636
76 +
77 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
78 +
79 +# * elfutils (via libelf) does not build on Windows. gresources are not embedded
80 +# within ELF binaries on that platform anyway and inspecting ELF binaries from
81 +# other platforms is not that useful so exclude the dependency in this case.
82 +# * Technically static-libs is needed on zlib, util-linux and perhaps more, but
83 +# these are used by GIO, which glib[static-libs] consumers don't really seem
84 +# to need at all, thus not imposing the deps for now and once some consumers
85 +# are actually found to static link libgio-2.0.a, we can revisit and either add
86 +# them or just put the (build) deps in that rare consumer instead of recursive
87 +# RDEPEND here (due to lack of recursive DEPEND).
88 +RDEPEND="
89 + !<dev-util/gdbus-codegen-${PV}
90 + >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
91 + >=dev-libs/libpcre2-10.32:0=[${MULTILIB_USEDEP},static-libs?]
92 + >=dev-libs/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}]
93 + >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
94 + >=virtual/libintl-0-r2[${MULTILIB_USEDEP}]
95 + kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] )
96 + selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
97 + xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) )
98 + elf? ( virtual/libelf:0= )
99 + sysprof? ( >=dev-util/sysprof-capture-3.40.1:4[${MULTILIB_USEDEP}] )
100 +"
101 +DEPEND="${RDEPEND}"
102 +# libxml2 used for optional tests that get automatically skipped
103 +BDEPEND="
104 + app-text/docbook-xsl-stylesheets
105 + dev-libs/libxslt
106 + >=sys-devel/gettext-0.19.8
107 + gtk-doc? ( >=dev-util/gtk-doc-1.33
108 + app-text/docbook-xml-dtd:4.2
109 + app-text/docbook-xml-dtd:4.5 )
110 + systemtap? ( >=dev-util/systemtap-1.3 )
111 + ${PYTHON_DEPS}
112 + test? ( >=sys-apps/dbus-1.2.14 )
113 + virtual/pkgconfig
114 +"
115 +# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen
116 +
117 +PDEPEND="
118 + dbus? ( gnome-base/dconf )
119 + mime? ( x11-misc/shared-mime-info )
120 +"
121 +# shared-mime-info needed for gio/xdgmime, bug #409481
122 +# dconf is needed to be able to save settings, bug #498436
123 +
124 +MULTILIB_CHOST_TOOLS=(
125 + /usr/bin/gio-querymodules$(get_exeext)
126 +)
127 +
128 +PATCHES=(
129 + "${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
130 + "${FILESDIR}"/${P}-clang-build.patch
131 + "${FILESDIR}"/${P}-crash-gparamspec.patch
132 +)
133 +
134 +pkg_setup() {
135 + if use kernel_linux ; then
136 + CONFIG_CHECK="~INOTIFY_USER"
137 + if use test ; then
138 + CONFIG_CHECK="~IPV6"
139 + WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
140 + fi
141 + linux-info_pkg_setup
142 + fi
143 + python-any-r1_pkg_setup
144 +}
145 +
146 +src_prepare() {
147 + if use test; then
148 + # TODO: Review the test exclusions, especially now with meson
149 + # Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163
150 + if ! has_version dev-util/desktop-file-utils ; then
151 + ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
152 + ewarn "think on installing it to get these tests run."
153 + sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die
154 + sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die
155 + fi
156 +
157 + # gdesktopappinfo requires existing terminal (gnome-terminal or any
158 + # other), falling back to xterm if one doesn't exist
159 + #if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then
160 + # ewarn "Some tests will be skipped due to missing terminal program"
161 + # These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson
162 + # Also try https://gitlab.gnome.org/GNOME/glib/issues/1601 once ready for backport (or in a bump) and file new issue if still fails
163 + sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die
164 + # desktop-app-info/launch* might fail similarly
165 + sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die
166 + #fi
167 +
168 + # https://bugzilla.gnome.org/show_bug.cgi?id=722604
169 + sed -i -e "/timer\/stop/d" glib/tests/timer.c || die
170 + sed -i -e "/timer\/basic/d" glib/tests/timer.c || die
171 +
172 + ewarn "Tests for search-utils have been skipped"
173 + sed -i -e "/search-utils/d" glib/tests/meson.build || die
174 +
175 + # Play nice with network-sandbox, but this approach would defeat the purpose of the test
176 + #sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die
177 + else
178 + # Don't build tests, also prevents extra deps, bug #512022
179 + sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die
180 + fi
181 +
182 + # Don't build fuzzing binaries - not used
183 + sed -i -e '/subdir.*fuzzing/d' meson.build || die
184 +
185 + # gdbus-codegen is a separate package
186 + sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die
187 +
188 + # Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon
189 + sed -i -e '/install_dir/d' gio/tests/meson.build || die
190 +
191 + cat > "${T}/glib-test-ld-wrapper" <<-EOF
192 + #!/usr/bin/env sh
193 + exec \${LD:-ld} "\$@"
194 + EOF
195 + chmod a+x "${T}/glib-test-ld-wrapper" || die
196 + sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die
197 +
198 + default
199 + gnome2_environment_reset
200 + # TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only
201 +}
202 +
203 +multilib_src_configure() {
204 + if use debug; then
205 + append-cflags -DG_ENABLE_DEBUG
206 + else
207 + append-cflags -DG_DISABLE_CAST_CHECKS # https://gitlab.gnome.org/GNOME/glib/issues/1833
208 + fi
209 +
210 + # TODO: figure a way to pass appropriate values for all cross properties that glib uses (search for get_cross_property)
211 + #if tc-is-cross-compiler ; then
212 + # https://bugzilla.gnome.org/show_bug.cgi?id=756473
213 + # TODO-meson: This should be in meson cross file as 'growing_stack' property; and more, look at get_cross_property
214 + #case ${CHOST} in
215 + #hppa*|metag*) export glib_cv_stack_grows=yes ;;
216 + #*) export glib_cv_stack_grows=no ;;
217 + #esac
218 + #fi
219 +
220 + local emesonargs=(
221 + -Ddefault_library=$(usex static-libs both shared)
222 + $(meson_feature selinux)
223 + $(meson_use xattr)
224 + -Dlibmount=enabled # only used if host_system == 'linux'
225 + -Dman=true
226 + $(meson_use systemtap dtrace)
227 + $(meson_use systemtap)
228 + $(meson_feature sysprof)
229 + $(meson_native_use_bool gtk-doc gtk_doc)
230 + $(meson_use test tests)
231 + -Dinstalled_tests=false
232 + -Dnls=enabled
233 + -Doss_fuzz=disabled
234 + $(meson_native_use_feature elf libelf)
235 + -Dmultiarch=false
236 + )
237 + meson_src_configure
238 +}
239 +
240 +multilib_src_test() {
241 + export XDG_CONFIG_DIRS=/etc/xdg
242 + export XDG_DATA_DIRS=/usr/local/share:/usr/share
243 + export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
244 + export LC_TIME=C # bug #411967
245 + export TZ=UTC
246 + unset GSETTINGS_BACKEND # bug #596380
247 + python_setup
248 +
249 + # https://bugs.gentoo.org/839807
250 + local -x SANDBOX_PREDICT=${SANDBOX_PREDICT}
251 + addpredict /usr/b
252 +
253 + # Related test is a bit nitpicking
254 + mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
255 + chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
256 +
257 + meson_src_test --timeout-multiplier 2 --no-suite flaky
258 +}
259 +
260 +multilib_src_install() {
261 + meson_src_install
262 + keepdir /usr/$(get_libdir)/gio/modules
263 +}
264 +
265 +multilib_src_install_all() {
266 + # These are installed by dev-util/glib-utils
267 + # TODO: With patching we might be able to get rid of the python-any deps and removals, and test depend on glib-utils instead; revisit now with meson
268 + rm "${ED}/usr/bin/glib-genmarshal" || die
269 + rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die
270 + rm "${ED}/usr/bin/glib-mkenums" || die
271 + rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die
272 + rm "${ED}/usr/bin/gtester-report" || die
273 + rm "${ED}/usr/share/man/man1/gtester-report.1" || die
274 + # gdbus-codegen manpage installed by dev-util/gdbus-codegen
275 + rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die
276 +}
277 +
278 +pkg_preinst() {
279 + xdg_pkg_preinst
280 +
281 + # Make gschemas.compiled belong to glib alone
282 + local cache="/usr/share/glib-2.0/schemas/gschemas.compiled"
283 +
284 + if [[ -e ${EROOT}${cache} ]]; then
285 + cp "${EROOT}"${cache} "${ED}"/${cache} || die
286 + else
287 + touch "${ED}"${cache} || die
288 + fi
289 +
290 + multilib_pkg_preinst() {
291 + # Make giomodule.cache belong to glib alone
292 + local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache"
293 +
294 + if [[ -e ${EROOT}${cache} ]]; then
295 + cp "${EROOT}"${cache} "${ED}"${cache} || die
296 + else
297 + touch "${ED}"${cache} || die
298 + fi
299 + }
300 +
301 + # Don't run the cache ownership when cross-compiling, as it would end up with an empty cache
302 + # file due to inability to create it and GIO might not look at any of the modules there
303 + if ! tc-is-cross-compiler ; then
304 + multilib_foreach_abi multilib_pkg_preinst
305 + fi
306 +}
307 +
308 +pkg_postinst() {
309 + xdg_pkg_postinst
310 + # glib installs no schemas itself, but we force update for fresh install in case
311 + # something has dropped in a schemas file without direct glib dep; and for upgrades
312 + # in case the compiled schema format could have changed
313 + gnome2_schemas_update
314 +
315 + multilib_pkg_postinst() {
316 + gnome2_giomodule_cache_update \
317 + || die "Update GIO modules cache failed (for ${ABI})"
318 + }
319 + if ! tc-is-cross-compiler ; then
320 + multilib_foreach_abi multilib_pkg_postinst
321 + else
322 + ewarn "Updating of GIO modules cache skipped due to cross-compilation."
323 + ewarn "You might want to run gio-querymodules manually on the target for"
324 + ewarn "your final image for performance reasons and re-run it when packages"
325 + ewarn "installing GIO modules get upgraded or added to the image."
326 + fi
327 +
328 + for v in ${REPLACING_VERSIONS}; do
329 + if ver_test "$v" "-lt" "2.63.6"; then
330 + ewarn "glib no longer installs the gio-launch-desktop binary. You may need"
331 + ewarn "to restart your session for \"Open With\" dialogs to work."
332 + fi
333 + done
334 +}
335 +
336 +pkg_postrm() {
337 + xdg_pkg_postrm
338 + gnome2_schemas_update
339 +
340 + if [[ -z ${REPLACED_BY_VERSION} ]]; then
341 + multilib_pkg_postrm() {
342 + rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache
343 + }
344 + multilib_foreach_abi multilib_pkg_postrm
345 + rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled
346 + fi
347 +}