dev-libs/glib: Sync with Gentoo

It's from Gentoo commit a8ab6c3e59279100329d86322eabeba8c35984e1.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2025-09-22 07:06:41 +00:00 committed by Krzesimir Nowak
parent 8e4d87f603
commit af47c39d0b
10 changed files with 0 additions and 2512 deletions

View File

@ -1,10 +1,4 @@
DIST glib-2.78.6.tar.xz 5344808 BLAKE2B d16173794c4aa019459cf8c8c84d4107fb8393828f41ec6c631b9452890f34f9022ed848a543ed134fdb8a575faef6b941cea3e05de512eb1b7a99f7601a2485 SHA512 8d75f8fd77b6309215ca86a0c7648878efe11051f18b279840c137669017ea4066388f8682367e4ea3f154333d833c9dc28ccd4a66a91f0c3854a40a2838f8da
DIST glib-2.80.5.tar.xz 5538308 BLAKE2B 3f17ff85a85d20858b69c2dccc1e5d6ffd92661a8cfda8b8770dd391861999ff3381008f4fe382e90f0a7798fe218debda7f559f6e3ac8f9305e3be98b879969 SHA512 c9cc9f99e217fd950810fcfbfa7300c7850cae4dbfbabc03cdcadb6dcca2e51ea7979ceb68c09d8e9776fd1c04db73b89b81f748c8bd911e1f7ad9f704dff172
DIST glib-2.82.5.tar.xz 5554704 BLAKE2B e7853034be1137f8b793483df9e9ce1465dd10a990eb9b3cb9ac76c9f8f86ccc6fda85645b04b35963b28c33e0f6c02df4f3d03e06cc278b8515e588d6bd05f6 SHA512 a6b035c32a42b9d6f4c031a29da405848002619654b58c9205f2f78dbb9698cd5866f31ab213adc04aa214d2c48840a9592c0a1e9201e6851ebd435635f393ae
DIST glib-2.84.0.tar.xz 5613328 BLAKE2B a482076d6b0c82824179094974110dbd10d47fce93f84f4626d0d3dbea528602c41ac4a7ab8feedc3d7cc5e404ef8bef30c6c744b6f0f4f3a764644e28210e28 SHA512 72b85e30c535c5da7d8598d1cec02b1b481c467e612dbb396a0a64ad1d37cf2f1802c6fa576885c99cf8a22f4f0fc7dfdf42a3f32f7f40394f72db588fdbebb7
DIST glib-2.84.1.tar.xz 5615396 BLAKE2B d20ade482eb95873adaefc656e22c57e6712a6263a4812e448220040e30144919331cb279566a89a2ab46495b46d6a79e3821e491317587325fa3a64b40d62cc SHA512 ee7f38a4726fd72e41ddb75c4933c7b1bb30935bb2fddc84902d0627a836af512534195132cc02e3d15f168fefc816576181a8d6e436472b582191437b79a456
DIST glib-2.84.2.tar.xz 5617588 BLAKE2B 31592cbeca58f03c138a02b0cd953b6bd2cdcbfa39283241affd1bff439d6376f0420b4b715856963c64903f3646cf89890f709f514a85d93fb3bbe26b99d516 SHA512 430928d7d7a442fc3927ca943f2569035fe8768768a0ebc6720ae1ef152b56fc5f8d4215d21b4828cc2f39a8632c907ed2c52a0c8566da1c533a2e049a1a121f
DIST glib-2.84.3.tar.xz 5615704 BLAKE2B 48444b91be68530de05667e2e009dcdc63af2f95cc978a461d930b943772e52b6c9d0e797aea3a9a5713758f22ee60a190c7d601b170c6c853fce624e5c327d7 SHA512 73f2d67d2ef5b4dc8cd2f6df9ce7903853ec619924e2927adbc73d706974a7d660afea55be18e12ccb0dee1145cf4149b743278d2b128fd466e3df2bbf90ef57
DIST glib-2.84.4.tar.xz 5618200 BLAKE2B 5faee382433085cd598545a99e2e95ce430be4ac5ca10106b70f2404ddacf328f4223bc092a23025f9bf8b936619a88a9dfb220674a07e9250cf4213c6213be9 SHA512 2de9b2f7376c0e5f6ee585087090675d597c474199a10d04aad18df688b6ca77d17e93a86ec07482898663f51c82121992272496318138f77ca5ad2c340a4bd3
DIST gobject-introspection-1.80.1.tar.xz 1040228 BLAKE2B 7a8c1da9bc8aef293deedde1eed97536fa2f42f79a9761ac8ededb0676e46b636545a69e20e63d812844aeb626fa4fb7ce3c7922e51554fdc79560f16443acd9 SHA512 f45c2c1b105086488d974c6134db9910746df8edb187772f2ecd249656a1047c8ac88ba51f5bf7393c3d99c3ace143ecd09be256c2f4d0ceee110c9ad51a839a
DIST gobject-introspection-1.82.0.tar.xz 1052872 BLAKE2B 8336ae26d48a71a203655d9d268076f603055ceabb55dbfa676f2c67b4096b83afc106d485dc45d02b3a8be806f9ef50d54806a82e61f2a252ae59543c61e934 SHA512 e139fadb4174c72b648914f3774d89fc0e5eaee45bba0c13edf05de883664dad8276dbc34006217bb09871ed4bad23adab51ff232a17b9eb131329b2926cafb7

View File

@ -1,36 +0,0 @@
https://bugs.gentoo.org/922654
https://gitlab.gnome.org/GNOME/glib/-/issues/3134
https://gitlab.gnome.org/GNOME/glib/-/commit/6ef967a0f930ce37a8c9b5aff969693b34714291
[sam: Trimmed the CI changes.]
From 6ef967a0f930ce37a8c9b5aff969693b34714291 Mon Sep 17 00:00:00 2001
From: Jordan Williams <jordan@jwillikers.com>
Date: Fri, 1 Dec 2023 09:53:50 -0600
Subject: [PATCH] Switch from the deprecated distutils module to the packaging
module
The distutils module was removed in Python 3.12.
---
--- a/gio/gdbus-2.0/codegen/utils.py
+++ b/gio/gdbus-2.0/codegen/utils.py
@@ -19,7 +19,7 @@
#
# Author: David Zeuthen <davidz@redhat.com>
-import distutils.version
+import packaging.version
import os
import sys
@@ -166,4 +166,4 @@ def version_cmp_key(key):
v = str(key[0])
else:
v = "0"
- return (distutils.version.LooseVersion(v), key[1])
+ return (packaging.version.Version(v), key[1])
--
GitLab

View File

@ -1,103 +0,0 @@
https://bugs.gentoo.org/946578
https://gitlab.gnome.org/GNOME/gobject-introspection/-/commit/a2139dba59eac283a7f543ed737f038deebddc19
From a2139dba59eac283a7f543ed737f038deebddc19 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 28 Aug 2024 21:26:02 +0200
Subject: [PATCH] giscanner: remove dependency on distutils.msvccompiler
It was removed with setuptools 74.0.0. Since we still depend on the
MSVCCompiler class use new_compiler() to get it some other way.
Remove any reference to MSVC9Compiler, which was for Visual Studio 2008
which we no longer support anyway.
Fixes #515
---
giscanner/ccompiler.py | 7 +++----
giscanner/msvccompiler.py | 14 +++++++-------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index d0ed70a3c..9a732cd5e 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -26,7 +26,6 @@ import tempfile
import sys
import distutils
-from distutils.msvccompiler import MSVCCompiler
from distutils.unixccompiler import UnixCCompiler
from distutils.cygwinccompiler import Mingw32CCompiler
from distutils.sysconfig import get_config_vars
@@ -167,7 +166,7 @@ class CCompiler(object):
# Now, create the distutils ccompiler instance based on the info we have.
if compiler_name == 'msvc':
# For MSVC, we need to create a instance of a subclass of distutil's
- # MSVC9Compiler class, as it does not provide a preprocess()
+ # MSVCCompiler class, as it does not provide a preprocess()
# implementation
from . import msvccompiler
self.compiler = msvccompiler.get_msvc_compiler()
@@ -460,7 +459,7 @@ class CCompiler(object):
return self.compiler.linker_exe
def check_is_msvc(self):
- return isinstance(self.compiler, MSVCCompiler)
+ return self.compiler.compiler_type == "msvc"
# Private APIs
def _set_cpp_options(self, options):
@@ -486,7 +485,7 @@ class CCompiler(object):
# macros for compiling using distutils
# get dropped for MSVC builds, so
# escape the escape character.
- if isinstance(self.compiler, MSVCCompiler):
+ if self.check_is_msvc():
macro_value = macro_value.replace('\"', '\\\"')
macros.append((macro_name, macro_value))
elif option.startswith('-U'):
diff --git a/giscanner/msvccompiler.py b/giscanner/msvccompiler.py
index 0a5439820..e333a80f5 100644
--- a/giscanner/msvccompiler.py
+++ b/giscanner/msvccompiler.py
@@ -19,30 +19,30 @@
#
import os
-import distutils
+from typing import Type
from distutils.errors import DistutilsExecError, CompileError
-from distutils.ccompiler import CCompiler, gen_preprocess_options
+from distutils.ccompiler import CCompiler, gen_preprocess_options, new_compiler
from distutils.dep_util import newer
# Distutil's MSVCCompiler does not provide a preprocess()
# Implementation, so do our own here.
+DistutilsMSVCCompiler: Type = type(new_compiler(compiler="msvc"))
+
+
def get_msvc_compiler():
return MSVCCompiler()
-class MSVCCompiler(distutils.msvccompiler.MSVCCompiler):
+class MSVCCompiler(DistutilsMSVCCompiler):
def __init__(self, verbose=0, dry_run=0, force=0):
- super(distutils.msvccompiler.MSVCCompiler, self).__init__()
+ super(DistutilsMSVCCompiler, self).__init__()
CCompiler.__init__(self, verbose, dry_run, force)
self.__paths = []
self.__arch = None # deprecated name
- if os.name == 'nt':
- if isinstance(self, distutils.msvc9compiler.MSVCCompiler):
- self.__version = distutils.msvc9compiler.VERSION
self.initialized = False
self.preprocess_options = None
if self.check_is_clang_cl():
--
GitLab

View File

@ -1,29 +0,0 @@
https://gitlab.gnome.org/GNOME/glib/-/commit/99382cfb4b5edf56f7c62eccc155f361a640298a.patch
https://bugs.gentoo.org/946789
From 99382cfb4b5edf56f7c62eccc155f361a640298a Mon Sep 17 00:00:00 2001
From: Andoni Morales Alastruey <ylatuya@gmail.com>
Date: Tue, 28 May 2024 17:26:38 +0200
Subject: [PATCH] girepository: fix autoptr tests build
In macOS compilation fails with the following error:
```
In file included from ../girepository/tests/autoptr.c:23:
../girepository/girffi.h:30:10: fatal error: 'ffi.h' file not found
```
---
girepository/tests/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/girepository/tests/meson.build b/girepository/tests/meson.build
index 6fa947cfdf..f9928267d5 100644
--- a/girepository/tests/meson.build
+++ b/girepository/tests/meson.build
@@ -72,6 +72,7 @@ if enable_gir
if cc.get_id() != 'msvc'
girepository_tests += {
'autoptr-girepository' : {
+ 'dependencies': [libffi_dep],
'source' : 'autoptr.c',
'depends': gio_gir_testing_dep,
},

View File

@ -1,57 +0,0 @@
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4575
From d6798089d447977ef4416d124a83344241aab14b Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 3 Apr 2025 19:03:27 +0100
Subject: [PATCH] gclosure: fix ATOMIC_CHANGE_FIELD to read vint atomically
Depending on luck, g_closure_ref may access closure->vint and observe
different values between reads. This manifests as a test failure in
signals-refcount{2,4}, properties-refcount1, and closure-refcount depending
on timing and re-runs.
Jakub Jelinek analysed this on GCC bug PR119607 after I'd reported it
over there as a possible GCC regression.
The critical part being g_closure_ref -> ATOMIC_INC_ASSIGN -> ATOMIC_CHANGE_FIELD
where closure->vint gets re-read repeatedly, both outside and inside the retry
loop. To fix that:
1. Atomically fetch it the first time;
2. Use the cached read, not a fresh read, of vint in the loop;
3. Use g_atomic_int_compare_and_exchange_full in the loop so we get a freshly
cached vint if it changed in another thread.
Bug: https://gcc.gnu.org/PR119607
Fixes: 834ddd19 ('turned all modifications to the first 32 integer bits in a closure into')
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
---
gobject/gclosure.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/gobject/gclosure.c b/gobject/gclosure.c
index 2552946e3b..e6e9769e46 100644
--- a/gobject/gclosure.c
+++ b/gobject/gclosure.c
@@ -110,15 +110,17 @@ typedef union {
G_STMT_START { \
ClosureInt *cunion = (ClosureInt*) _closure; \
gint new_int, old_int, success; \
+ old_int = g_atomic_int_get (&cunion->vint); \
do \
{ \
ClosureInt tmp; \
- tmp.vint = old_int = cunion->vint; \
+ tmp.vint = old_int; \
_SET_OLD tmp.closure._field; \
tmp.closure._field _OP _value; \
_SET_NEW tmp.closure._field; \
new_int = tmp.vint; \
- success = g_atomic_int_compare_and_exchange (&cunion->vint, old_int, new_int); \
+ success = g_atomic_int_compare_and_exchange_full (&cunion->vint, old_int, new_int,\
+ &old_int); \
} \
while (!success && _must_set); \
} G_STMT_END
--
GitLab

View File

@ -1,338 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_REQ_USE="xml(+)"
PYTHON_COMPAT=( python3_{11..13} )
inherit dot-a gnome.org gnome2-utils linux-info meson-multilib multilib python-any-r1 toolchain-funcs xdg
DESCRIPTION="The GLib library of C routines"
HOMEPAGE="https://www.gtk.org/"
LICENSE="LGPL-2.1+"
SLOT="2"
IUSE="dbus debug +elf gtk-doc +mime selinux static-libs sysprof systemtap test utils xattr"
RESTRICT="!test? ( test )"
REQUIRED_USE="gtk-doc? ( test )" # Bug #777636
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
# * elfutils (via libelf) does not build on Windows. gresources are not embedded
# within ELF binaries on that platform anyway and inspecting ELF binaries from
# other platforms is not that useful so exclude the dependency in this case.
# * Technically static-libs is needed on zlib, util-linux and perhaps more, but
# these are used by GIO, which glib[static-libs] consumers don't really seem
# to need at all, thus not imposing the deps for now and once some consumers
# are actually found to static link libgio-2.0.a, we can revisit and either add
# them or just put the (build) deps in that rare consumer instead of recursive
# RDEPEND here (due to lack of recursive DEPEND).
RDEPEND="
!<dev-util/gdbus-codegen-${PV}
>=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
>=dev-libs/libpcre2-10.32:0=[${MULTILIB_USEDEP},unicode(+),static-libs?]
>=dev-libs/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}]
>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
>=virtual/libintl-0-r2[${MULTILIB_USEDEP}]
kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] )
selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) )
elf? ( virtual/libelf:0= )
sysprof? ( >=dev-util/sysprof-capture-3.40.1:4[${MULTILIB_USEDEP}] )
"
DEPEND="${RDEPEND}"
# libxml2 used for optional tests that get automatically skipped
BDEPEND="
app-text/docbook-xsl-stylesheets
dev-libs/libxslt
>=sys-devel/gettext-0.19.8
gtk-doc? ( >=dev-util/gtk-doc-1.33
app-text/docbook-xml-dtd:4.2
app-text/docbook-xml-dtd:4.5 )
systemtap? ( >=dev-debug/systemtap-1.3 )
${PYTHON_DEPS}
$(python_gen_any_dep '
dev-python/packaging[${PYTHON_USEDEP}]
')
test? ( >=sys-apps/dbus-1.2.14 )
virtual/pkgconfig
"
# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen
PDEPEND="
dbus? ( gnome-base/dconf )
mime? ( x11-misc/shared-mime-info )
"
# shared-mime-info needed for gio/xdgmime, bug #409481
# dconf is needed to be able to save settings, bug #498436
MULTILIB_CHOST_TOOLS=(
/usr/bin/gio-querymodules$(get_exeext)
)
PATCHES=(
"${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
"${FILESDIR}"/${PN}-2.78.4-distutils.patch
)
python_check_deps() {
python_has_version "dev-python/packaging[${PYTHON_USEDEP}]"
}
pkg_setup() {
if use kernel_linux ; then
CONFIG_CHECK="~INOTIFY_USER"
if use test ; then
CONFIG_CHECK="~IPV6"
WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
fi
linux-info_pkg_setup
fi
python-any-r1_pkg_setup
}
src_prepare() {
if use test; then
# TODO: Review the test exclusions, especially now with meson
# Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163
if ! has_version dev-util/desktop-file-utils ; then
ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
ewarn "think on installing it to get these tests run."
sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die
sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die
fi
# gdesktopappinfo requires existing terminal (gnome-terminal or any
# other), falling back to xterm if one doesn't exist
#if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then
# ewarn "Some tests will be skipped due to missing terminal program"
# These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson
# 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
sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die
# desktop-app-info/launch* might fail similarly
sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die
#fi
# https://bugzilla.gnome.org/show_bug.cgi?id=722604
sed -i -e "/timer\/stop/d" glib/tests/timer.c || die
sed -i -e "/timer\/basic/d" glib/tests/timer.c || die
ewarn "Tests for search-utils have been skipped"
sed -i -e "/search-utils/d" glib/tests/meson.build || die
# Play nice with network-sandbox, but this approach would defeat the purpose of the test
#sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die
else
# Don't build tests, also prevents extra deps, bug #512022
sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die
fi
# Don't build fuzzing binaries - not used
sed -i -e '/subdir.*fuzzing/d' meson.build || die
# gdbus-codegen is a separate package
sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die
# Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon
sed -i -e '/install_dir/d' gio/tests/meson.build || die
cat > "${T}/glib-test-ld-wrapper" <<-EOF
#!/usr/bin/env sh
exec \${LD:-ld} "\$@"
EOF
chmod a+x "${T}/glib-test-ld-wrapper" || die
sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die
# make default sane for us
if use prefix ; then
sed -i -e "s:/usr/local:${EPREFIX}/usr:" gio/xdgmime/xdgmime.c || die
# bug #308609, without path, bug #314057
export PERL=perl
fi
if [[ ${CHOST} == *-solaris* ]] ; then
# fix standards conflicts
sed -i \
-e 's/\<\(_XOPEN_SOURCE_EXTENDED\)\>/_POSIX_PTHREAD_SEMANTICS/' \
-e '/\<_XOPEN_SOURCE\>/s/\<2\>/600/' \
meson.build || die
sed -i -e '/#define\s\+_POSIX_SOURCE/d' \
glib/giounix.c || die
fi
# disable native macOS integrations
sed -i -e '/glib_conf.set(.HAVE_\(CARBON\|COCOA\).,/s/true/false/' \
meson.build || die
sed -i \
-e '/AvailabilityMacros.h/d' \
gio/giomodule.c || die
default
gnome2_environment_reset
# TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only
}
src_configure() {
lto-guarantee-fat
meson-multilib_src_configure
}
multilib_src_configure() {
# TODO: figure a way to pass appropriate values for all cross properties
# that glib uses (search for get_cross_property)
#if tc-is-cross-compiler ; then
# https://bugzilla.gnome.org/show_bug.cgi?id=756473
# TODO-meson: This should be in meson cross file as 'growing_stack'
# property; and more, look at get_cross_property
#case ${CHOST} in
#hppa*|metag*) export glib_cv_stack_grows=yes ;;
#*) export glib_cv_stack_grows=no ;;
#esac
#fi
local emesonargs=(
$(meson_feature debug glib_debug)
-Ddefault_library=$(usex static-libs both shared)
-Druntime_dir="${EPREFIX}"/run
$(meson_feature selinux)
$(meson_use xattr)
-Dlibmount=enabled # only used if host_system == 'linux'
-Dman=true
$(meson_use systemtap dtrace)
$(meson_use systemtap)
$(meson_feature sysprof)
$(meson_native_use_bool gtk-doc gtk_doc)
$(meson_use test tests)
-Dinstalled_tests=false
-Dnls=enabled
-Doss_fuzz=disabled
$(meson_native_use_feature elf libelf)
-Dmultiarch=false
)
# Workaround for bug #938302
if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then
local native_file="${T}"/meson.${CHOST}.ini.local
cat >> ${native_file} <<-EOF || die
[binaries]
dtrace='stap-dtrace'
EOF
emesonargs+=( --native-file "${native_file}" )
fi
meson_src_configure
}
multilib_src_test() {
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_DATA_DIRS=/usr/local/share:/usr/share
export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
export LC_TIME=C # bug #411967
export TZ=UTC
unset GSETTINGS_BACKEND # bug #596380
python_setup
# https://bugs.gentoo.org/839807
local -x SANDBOX_PREDICT=${SANDBOX_PREDICT}
addpredict /usr/b
# Related test is a bit nitpicking
mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
meson_src_test --timeout-multiplier 20 --no-suite flaky
}
multilib_src_install() {
meson_src_install
keepdir /usr/$(get_libdir)/gio/modules
}
multilib_src_install_all() {
strip-lto-bytecode
# These are installed by dev-util/glib-utils
# 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
rm "${ED}/usr/bin/glib-genmarshal" || die
rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die
rm "${ED}/usr/bin/glib-mkenums" || die
rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die
rm "${ED}/usr/bin/gtester-report" || die
rm "${ED}/usr/share/man/man1/gtester-report.1" || die
# gdbus-codegen manpage installed by dev-util/gdbus-codegen
rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die
}
pkg_preinst() {
xdg_pkg_preinst
# Make gschemas.compiled belong to glib alone
local cache="/usr/share/glib-2.0/schemas/gschemas.compiled"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"/${cache} || die
else
touch "${ED}"${cache} || die
fi
multilib_pkg_preinst() {
# Make giomodule.cache belong to glib alone
local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"${cache} || die
else
touch "${ED}"${cache} || die
fi
}
# Don't run the cache ownership when cross-compiling, as it would end up with an empty cache
# file due to inability to create it and GIO might not look at any of the modules there
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_preinst
fi
}
pkg_postinst() {
xdg_pkg_postinst
# glib installs no schemas itself, but we force update for fresh install in case
# something has dropped in a schemas file without direct glib dep; and for upgrades
# in case the compiled schema format could have changed
gnome2_schemas_update
multilib_pkg_postinst() {
gnome2_giomodule_cache_update \
|| die "Update GIO modules cache failed (for ${ABI})"
}
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_postinst
else
ewarn "Updating of GIO modules cache skipped due to cross-compilation."
ewarn "You might want to run gio-querymodules manually on the target for"
ewarn "your final image for performance reasons and re-run it when packages"
ewarn "installing GIO modules get upgraded or added to the image."
fi
for v in ${REPLACING_VERSIONS}; do
if ver_test "$v" "-lt" "2.63.6"; then
ewarn "glib no longer installs the gio-launch-desktop binary. You may need"
ewarn "to restart your session for \"Open With\" dialogs to work."
fi
done
}
pkg_postrm() {
xdg_pkg_postrm
gnome2_schemas_update
if [[ -z ${REPLACED_BY_VERSION} ]]; then
multilib_pkg_postrm() {
rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache
}
multilib_foreach_abi multilib_pkg_postrm
rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled
fi
}

View File

@ -1,493 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_REQ_USE="xml(+)"
PYTHON_COMPAT=( python3_{11..13} )
inherit dot-a gnome.org gnome2-utils linux-info meson-multilib multilib python-any-r1 toolchain-funcs xdg
DESCRIPTION="The GLib library of C routines"
HOMEPAGE="https://www.gtk.org/"
INTROSPECTION_PN="gobject-introspection"
INTROSPECTION_PV="1.80.1"
INTROSPECTION_P="${INTROSPECTION_PN}-${INTROSPECTION_PV}"
SRC_URI="
${SRC_URI}
introspection? ( mirror://gnome/sources/gobject-introspection/${INTROSPECTION_PV%.*}/gobject-introspection-${INTROSPECTION_PV}.tar.${GNOME_TARBALL_SUFFIX} )
"
INTROSPECTION_SOURCE_DIR="${WORKDIR}/${INTROSPECTION_P}"
INTROSPECTION_BUILD_DIR="${WORKDIR}/${INTROSPECTION_P}-build"
LICENSE="LGPL-2.1+"
SLOT="2"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="dbus debug +elf doc +introspection +mime selinux static-libs sysprof systemtap test utils xattr"
RESTRICT="!test? ( test )"
# * elfutils (via libelf) does not build on Windows. gresources are not embedded
# within ELF binaries on that platform anyway and inspecting ELF binaries from
# other platforms is not that useful so exclude the dependency in this case.
# * Technically static-libs is needed on zlib, util-linux and perhaps more, but
# these are used by GIO, which glib[static-libs] consumers don't really seem
# to need at all, thus not imposing the deps for now and once some consumers
# are actually found to static link libgio-2.0.a, we can revisit and either add
# them or just put the (build) deps in that rare consumer instead of recursive
# RDEPEND here (due to lack of recursive DEPEND).
RDEPEND="
!<dev-libs/gobject-introspection-1.80.1
!<dev-util/gdbus-codegen-${PV}
>=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
>=dev-libs/libpcre2-10.32:0=[${MULTILIB_USEDEP},unicode(+),static-libs?]
>=dev-libs/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}]
>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
>=virtual/libintl-0-r2[${MULTILIB_USEDEP}]
introspection? (
>=dev-libs/gobject-introspection-common-${INTROSPECTION_PV}
)
kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] )
selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) )
elf? ( virtual/libelf:0= )
sysprof? ( >=dev-util/sysprof-capture-3.40.1:4[${MULTILIB_USEDEP}] )
"
DEPEND="${RDEPEND}"
# libxml2 used for optional tests that get automatically skipped
BDEPEND="
app-text/docbook-xsl-stylesheets
dev-libs/libxslt
>=sys-devel/gettext-0.19.8
doc? ( >=dev-util/gi-docgen-2023.1 )
dev-python/docutils
systemtap? ( >=dev-debug/systemtap-1.3 )
$(python_gen_any_dep '
dev-python/packaging[${PYTHON_USEDEP}]
')
${PYTHON_DEPS}
test? ( >=sys-apps/dbus-1.2.14 )
virtual/pkgconfig
introspection? (
$(python_gen_any_dep '
dev-python/setuptools[${PYTHON_USEDEP}]
')
virtual/pkgconfig
sys-devel/bison
app-alternatives/lex
${PYTHON_DEPS}
)
"
# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen
PDEPEND="
dbus? ( gnome-base/dconf )
mime? ( x11-misc/shared-mime-info )
"
# shared-mime-info needed for gio/xdgmime, bug #409481
# dconf is needed to be able to save settings, bug #498436
MULTILIB_CHOST_TOOLS=(
/usr/bin/gio-querymodules$(get_exeext)
)
PATCHES=(
"${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
"${FILESDIR}"/${P}-tests-autoptr-ffi.patch
)
python_check_deps() {
if use introspection ; then
python_has_version "dev-python/packaging[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]"
else
python_has_version "dev-python/packaging[${PYTHON_USEDEP}]"
fi
}
pkg_setup() {
if use kernel_linux ; then
CONFIG_CHECK="~INOTIFY_USER"
if use test ; then
CONFIG_CHECK="~IPV6"
WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
fi
linux-info_pkg_setup
fi
python-any-r1_pkg_setup
}
src_prepare() {
if use test; then
# TODO: Review the test exclusions, especially now with meson
# Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163
if ! has_version dev-util/desktop-file-utils ; then
ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
ewarn "think on installing it to get these tests run."
sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die
sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die
fi
# gdesktopappinfo requires existing terminal (gnome-terminal or any
# other), falling back to xterm if one doesn't exist
#if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then
# ewarn "Some tests will be skipped due to missing terminal program"
# These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson
# 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
sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die
# desktop-app-info/launch* might fail similarly
sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die
#fi
# https://bugzilla.gnome.org/show_bug.cgi?id=722604
sed -i -e "/timer\/stop/d" glib/tests/timer.c || die
sed -i -e "/timer\/basic/d" glib/tests/timer.c || die
ewarn "Tests for search-utils have been skipped"
sed -i -e "/search-utils/d" glib/tests/meson.build || die
# Play nice with network-sandbox, but this approach would defeat the purpose of the test
#sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die
else
# Don't build tests, also prevents extra deps, bug #512022
sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die
fi
# Don't build fuzzing binaries - not used
sed -i -e '/subdir.*fuzzing/d' meson.build || die
# gdbus-codegen is a separate package
sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die
sed -i -e '/install : true/d' gio/gdbus-2.0/codegen/meson.build || die
# Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon
sed -i -e '/install_dir/d' gio/tests/meson.build || die
cat > "${T}/glib-test-ld-wrapper" <<-EOF
#!/usr/bin/env sh
exec \${LD:-ld} "\$@"
EOF
chmod a+x "${T}/glib-test-ld-wrapper" || die
sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die
# make default sane for us
if use prefix ; then
sed -i -e "s:/usr/local:${EPREFIX}/usr:" gio/xdgmime/xdgmime.c || die
# bug #308609, without path, bug #314057
export PERL=perl
fi
if [[ ${CHOST} == *-solaris* ]] ; then
# fix standards conflicts
sed -i \
-e 's/\<\(_XOPEN_SOURCE_EXTENDED\)\>/_POSIX_PTHREAD_SEMANTICS/' \
-e '/\<_XOPEN_SOURCE\>/s/\<2\>/600/' \
meson.build || die
sed -i -e '/#define\s\+_POSIX_SOURCE/d' \
glib/giounix.c || die
fi
# disable native macOS integrations
sed -i -e '/glib_conf.set(.HAVE_\(CARBON\|COCOA\).,/s/true/false/' \
meson.build || die
sed -i \
-e '/AvailabilityMacros.h/d' \
gio/giomodule.c || die
# Link the glib source to the introspection subproject directory so it can be built there first
if use introspection ; then
ln -s "${S}" "${INTROSPECTION_SOURCE_DIR}/subprojects/glib"
# bug #946578
cd "${INTROSPECTION_SOURCE_DIR}" || die
eapply "${FILESDIR}"/glib-2.80.5-gobject-introspection-1.80.patch
cd "${S}" || die
fi
default
gnome2_environment_reset
# TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only
}
src_configure() {
lto-guarantee-fat
meson-multilib_src_configure
}
multilib_src_configure() {
# TODO: figure a way to pass appropriate values for all cross properties
# that glib uses (search for get_cross_property)
#if tc-is-cross-compiler ; then
# https://bugzilla.gnome.org/show_bug.cgi?id=756473
# TODO-meson: This should be in meson cross file as 'growing_stack'
# property; and more, look at get_cross_property
#case ${CHOST} in
#hppa*|metag*) export glib_cv_stack_grows=yes ;;
#*) export glib_cv_stack_grows=no ;;
#esac
#fi
_need_bootstrap_gi() {
if ! multilib_native_use introspection ; then
return 1
fi
if ! has_version ">=dev-libs/${INTROSPECTION_P}" ; then
return 0
fi
# Is the installed gobject-introspection usable?
if ! g-ir-scanner --version &> /dev/null ; then
return 0
fi
# Do we somehow have a dev-libs/gobject-introspection installed
# with an unsatisfied dependency? (bug #951487)
if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
# Make sure has_version didn't lie to us while at it as well,
# given bug #951487.
if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION_PV} gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
return 1
}
# Build internal copy of gobject-introspection to avoid circular dependency (built for native abi only)
if _need_bootstrap_gi ; then
einfo "Bootstrapping gobject-introspection..."
INTROSPECTION_BIN_DIR="${T}/bootstrap-gi-prefix/usr/bin"
INTROSPECTION_LIB_DIR="${T}/bootstrap-gi-prefix/usr/$(get_libdir)"
local emesonargs=(
--prefix="${T}/bootstrap-gi-prefix/usr"
-Dpython="${EPYTHON}"
-Dbuild_introspection_data=true
# Build an internal copy of glib for the internal copy of gobject-introspection
--force-fallback-for=glib
# Make the paths in pkgconfig files relative as we used to not
# do a proper install here and it seems less risky to keep it
# this way.
-Dpkgconfig.relocatable=true
# We want as minimal a build as possible here to speed things up
# and reduce the risk of failures.
-Dglib:selinux=disabled
-Dglib:xattr=false
-Dglib:libmount=disabled
-Dglib:man-pages=disabled
-Dglib:dtrace=false
-Dglib:systemtap=false
-Dglib:sysprof=disabled
-Dglib:documentation=false
-Dglib:tests=false
-Dglib:installed_tests=false
-Dglib:nls=disabled
-Dglib:oss_fuzz=disabled
-Dglib:libelf=disabled
-Dglib:multiarch=false
)
ORIG_SOURCE_DIR=${EMESON_SOURCE}
EMESON_SOURCE=${INTROSPECTION_SOURCE_DIR}
# g-ir-scanner has some relocatable logic but it searches
# for 'lib', not 'lib64', so it can't find itself and eventually
# falls back to the system installation. See bug #946221.
sed -i -e "/^pylibdir =/s:'lib:'$(get_libdir):" "${EMESON_SOURCE}"/tools/g-ir-tool-template.in || die
ORIG_BUILD_DIR=${BUILD_DIR}
BUILD_DIR=${INTROSPECTION_BUILD_DIR}
pushd ${INTROSPECTION_SOURCE_DIR} || die
meson_src_configure
meson_src_compile
# We already provide a prefix in ${T} above. Blank DESTDIR
# as it may be set in the environment by Portage (though not
# guaranteed in src_configure).
meson_src_install --destdir ""
popd || die
EMESON_SOURCE=${ORIG_SOURCE_DIR}
BUILD_DIR=${ORIG_BUILD_DIR}
# Add gobject-introspection binaries and pkgconfig files to path
export PATH="${INTROSPECTION_BIN_DIR}:${PATH}"
# Override primary pkgconfig search paths to prioritize our internal copy
export PKG_CONFIG_LIBDIR="${INTROSPECTION_LIB_DIR}/pkgconfig:${INTROSPECTION_BUILD_DIR}/meson-private"
# Set the normal primary pkgconfig search paths as secondary
# (We also need to prepend our just-built one for later use of
# g-ir-scanner to use the new one and to help workaround bugs like
# bug #946221.)
export PKG_CONFIG_PATH="${PKG_CONFIG_LIBDIR}:$(pkg-config --variable pc_path pkg-config)"
# Add the paths to the built glib libraries to the library path so that gobject-introspection can load them
for gliblib in glib gobject gthread gmodule gio girepository; do
export LD_LIBRARY_PATH="${BUILD_DIR}/${gliblib}:${LD_LIBRARY_PATH}"
done
# Add the path to introspection libraries so that glib can call gir utilities
export LD_LIBRARY_PATH="${INTROSPECTION_LIB_DIR}:${LD_LIBRARY_PATH}"
# Add the paths to the gobject-introspection python modules to python path so they can be imported
export PYTHONPATH="${INTROSPECTION_LIB_DIR}/gobject-introspection:${PYTHONPATH}"
fi
# TODO: Can this be cleaned up now we have -Dglib_debug? (bug #946485)
use debug && EMESON_BUILD_TYPE=debug
local emesonargs=(
-Ddefault_library=$(usex static-libs both shared)
-Druntime_dir="${EPREFIX}"/run
$(meson_feature debug glib_debug)
$(meson_feature selinux)
$(meson_use xattr)
-Dlibmount=enabled # only used if host_system == 'linux'
-Dman-pages=enabled
$(meson_use systemtap dtrace)
$(meson_use systemtap)
$(meson_feature sysprof)
$(meson_use doc documentation)
$(meson_use test tests)
-Dinstalled_tests=false
-Dnls=enabled
-Doss_fuzz=disabled
$(meson_native_use_feature elf libelf)
-Dmultiarch=false
$(meson_native_use_feature introspection)
)
# Workaround for bug #938302
if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then
local native_file="${T}"/meson.${CHOST}.ini.local
cat >> ${native_file} <<-EOF || die
[binaries]
dtrace='stap-dtrace'
EOF
emesonargs+=( --native-file "${native_file}" )
fi
meson_src_configure
}
multilib_src_test() {
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_DATA_DIRS=/usr/local/share:/usr/share
# TODO: Use ${ABI} here to be unique for multilib?
export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
export LC_TIME=C # bug #411967
export TZ=UTC
unset GSETTINGS_BACKEND # bug #596380
python_setup
# https://bugs.gentoo.org/839807
local -x SANDBOX_PREDICT=${SANDBOX_PREDICT}
addpredict /usr/b
# Related test is a bit nitpicking
mkdir -p "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
meson_src_test --timeout-multiplier 20 --no-suite flaky
}
multilib_src_install() {
meson_src_install
keepdir /usr/$(get_libdir)/gio/modules
}
multilib_src_install_all() {
strip-lto-bytecode
# These are installed by dev-util/glib-utils
# 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
rm "${ED}/usr/bin/glib-genmarshal" || die
rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die
rm "${ED}/usr/bin/glib-mkenums" || die
rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die
rm "${ED}/usr/bin/gtester-report" || die
rm "${ED}/usr/share/man/man1/gtester-report.1" || die
# gdbus-codegen manpage installed by dev-util/gdbus-codegen
rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die
}
pkg_preinst() {
xdg_pkg_preinst
# Make gschemas.compiled belong to glib alone
local cache="/usr/share/glib-2.0/schemas/gschemas.compiled"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"/${cache} || die
else
touch "${ED}"${cache} || die
fi
multilib_pkg_preinst() {
# Make giomodule.cache belong to glib alone
local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"${cache} || die
else
touch "${ED}"${cache} || die
fi
}
# Don't run the cache ownership when cross-compiling, as it would end up with an empty cache
# file due to inability to create it and GIO might not look at any of the modules there
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_preinst
fi
}
pkg_postinst() {
xdg_pkg_postinst
# glib installs no schemas itself, but we force update for fresh install in case
# something has dropped in a schemas file without direct glib dep; and for upgrades
# in case the compiled schema format could have changed
gnome2_schemas_update
multilib_pkg_postinst() {
gnome2_giomodule_cache_update \
|| die "Update GIO modules cache failed (for ${ABI})"
}
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_postinst
else
ewarn "Updating of GIO modules cache skipped due to cross-compilation."
ewarn "You might want to run gio-querymodules manually on the target for"
ewarn "your final image for performance reasons and re-run it when packages"
ewarn "installing GIO modules get upgraded or added to the image."
fi
for v in ${REPLACING_VERSIONS}; do
if ver_test "$v" "-lt" "2.63.6"; then
ewarn "glib no longer installs the gio-launch-desktop binary. You may need"
ewarn "to restart your session for \"Open With\" dialogs to work."
fi
done
}
pkg_postrm() {
xdg_pkg_postrm
gnome2_schemas_update
if [[ -z ${REPLACED_BY_VERSION} ]]; then
multilib_pkg_postrm() {
rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache || die
}
multilib_foreach_abi multilib_pkg_postrm
rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled || die
fi
}

View File

@ -1,483 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_REQ_USE="xml(+)"
PYTHON_COMPAT=( python3_{11..13} )
inherit dot-a eapi9-ver gnome.org gnome2-utils linux-info meson-multilib multilib python-any-r1 toolchain-funcs xdg
DESCRIPTION="The GLib library of C routines"
HOMEPAGE="https://www.gtk.org/"
INTROSPECTION_PN="gobject-introspection"
INTROSPECTION_PV="1.82.0"
INTROSPECTION_P="${INTROSPECTION_PN}-${INTROSPECTION_PV}"
SRC_URI="
${SRC_URI}
introspection? ( mirror://gnome/sources/gobject-introspection/${INTROSPECTION_PV%.*}/gobject-introspection-${INTROSPECTION_PV}.tar.${GNOME_TARBALL_SUFFIX} )
"
INTROSPECTION_SOURCE_DIR="${WORKDIR}/${INTROSPECTION_P}"
INTROSPECTION_BUILD_DIR="${WORKDIR}/${INTROSPECTION_P}-build"
LICENSE="LGPL-2.1+"
SLOT="2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="dbus debug +elf doc +introspection +mime selinux static-libs sysprof systemtap test utils xattr"
RESTRICT="!test? ( test )"
# * elfutils (via libelf) does not build on Windows. gresources are not embedded
# within ELF binaries on that platform anyway and inspecting ELF binaries from
# other platforms is not that useful so exclude the dependency in this case.
# * Technically static-libs is needed on zlib, util-linux and perhaps more, but
# these are used by GIO, which glib[static-libs] consumers don't really seem
# to need at all, thus not imposing the deps for now and once some consumers
# are actually found to static link libgio-2.0.a, we can revisit and either add
# them or just put the (build) deps in that rare consumer instead of recursive
# RDEPEND here (due to lack of recursive DEPEND).
RDEPEND="
!<dev-libs/gobject-introspection-1.80.1
!<dev-util/gdbus-codegen-${PV}
>=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
>=dev-libs/libpcre2-10.32:0=[${MULTILIB_USEDEP},unicode(+),static-libs?]
>=dev-libs/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}]
>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
>=virtual/libintl-0-r2[${MULTILIB_USEDEP}]
introspection? (
>=dev-libs/gobject-introspection-common-${INTROSPECTION_PV}
)
kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] )
selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) )
elf? ( virtual/libelf:0= )
sysprof? ( >=dev-util/sysprof-capture-3.40.1:4[${MULTILIB_USEDEP}] )
"
DEPEND="${RDEPEND}"
# libxml2 used for optional tests that get automatically skipped
BDEPEND="
app-text/docbook-xsl-stylesheets
>=dev-build/meson-1.4.0
dev-libs/libxslt
>=sys-devel/gettext-0.19.8
doc? ( >=dev-util/gi-docgen-2023.1 )
dev-python/docutils
systemtap? ( >=dev-debug/systemtap-1.3 )
${PYTHON_DEPS}
test? ( >=sys-apps/dbus-1.2.14 )
virtual/pkgconfig
introspection? (
$(python_gen_any_dep '
dev-python/setuptools[${PYTHON_USEDEP}]
')
virtual/pkgconfig
sys-devel/bison
app-alternatives/lex
${PYTHON_DEPS}
)
"
# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen
PDEPEND="
dbus? ( gnome-base/dconf )
mime? ( x11-misc/shared-mime-info )
"
# shared-mime-info needed for gio/xdgmime, bug #409481
# dconf is needed to be able to save settings, bug #498436
MULTILIB_CHOST_TOOLS=(
/usr/bin/gio-querymodules$(get_exeext)
)
PATCHES=(
"${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
)
python_check_deps() {
if use introspection ; then
python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]"
fi
}
pkg_setup() {
if use kernel_linux ; then
CONFIG_CHECK="~INOTIFY_USER"
if use test ; then
CONFIG_CHECK="~IPV6"
WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
fi
linux-info_pkg_setup
fi
python-any-r1_pkg_setup
}
src_prepare() {
if use test; then
# TODO: Review the test exclusions, especially now with meson
# Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163
if ! has_version dev-util/desktop-file-utils ; then
ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
ewarn "think on installing it to get these tests run."
sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die
sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die
fi
# gdesktopappinfo requires existing terminal (gnome-terminal or any
# other), falling back to xterm if one doesn't exist
#if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then
# ewarn "Some tests will be skipped due to missing terminal program"
# These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson
# 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
sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die
# desktop-app-info/launch* might fail similarly
sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die
#fi
# https://bugzilla.gnome.org/show_bug.cgi?id=722604
sed -i -e "/timer\/stop/d" glib/tests/timer.c || die
sed -i -e "/timer\/basic/d" glib/tests/timer.c || die
ewarn "Tests for search-utils have been skipped"
sed -i -e "/search-utils/d" glib/tests/meson.build || die
# Running gdb inside a test within sandbox is brittle
sed -i -e '/self.__gdb = shutil.which("gdb")/s:"gdb":"gdb-idonotexist":' glib/tests/assert-msg-test.py || die
# Play nice with network-sandbox, but this approach would defeat the purpose of the test
#sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die
else
# Don't build tests, also prevents extra deps, bug #512022
sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die
fi
# Don't build fuzzing binaries - not used
sed -i -e '/subdir.*fuzzing/d' meson.build || die
# gdbus-codegen is a separate package
sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die
sed -i -e '/install : true/d' gio/gdbus-2.0/codegen/meson.build || die
# Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon
sed -i -e '/install_dir/d' gio/tests/meson.build || die
cat > "${T}/glib-test-ld-wrapper" <<-EOF
#!/usr/bin/env sh
exec \${LD:-ld} "\$@"
EOF
chmod a+x "${T}/glib-test-ld-wrapper" || die
sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die
# make default sane for us
if use prefix ; then
sed -i -e "s:/usr/local:${EPREFIX}/usr:" gio/xdgmime/xdgmime.c || die
# bug #308609, without path, bug #314057
export PERL=perl
fi
if [[ ${CHOST} == *-solaris* ]] ; then
# fix standards conflicts
sed -i \
-e 's/\<\(_XOPEN_SOURCE_EXTENDED\)\>/_POSIX_PTHREAD_SEMANTICS/' \
-e '/\<_XOPEN_SOURCE\>/s/\<2\>/600/' \
meson.build || die
sed -i -e '/#define\s\+_POSIX_SOURCE/d' \
glib/giounix.c || die
fi
# disable native macOS integrations
sed -i -e '/glib_conf.set(.HAVE_\(CARBON\|COCOA\).,/s/true/false/' \
meson.build || die
sed -i \
-e '/AvailabilityMacros.h/d' \
gio/giomodule.c || die
# Link the glib source to the introspection subproject directory so it can be built there first
if use introspection ; then
ln -s "${S}" "${INTROSPECTION_SOURCE_DIR}/subprojects/glib"
fi
default
gnome2_environment_reset
# TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only
}
src_configure() {
lto-guarantee-fat
meson-multilib_src_configure
}
multilib_src_configure() {
# TODO: figure a way to pass appropriate values for all cross properties
# that glib uses (search for get_cross_property)
#if tc-is-cross-compiler ; then
# https://bugzilla.gnome.org/show_bug.cgi?id=756473
# TODO-meson: This should be in meson cross file as 'growing_stack'
# property; and more, look at get_cross_property
#case ${CHOST} in
#hppa*|metag*) export glib_cv_stack_grows=yes ;;
#*) export glib_cv_stack_grows=no ;;
#esac
#fi
_need_bootstrap_gi() {
if ! multilib_native_use introspection ; then
return 1
fi
if ! has_version ">=dev-libs/${INTROSPECTION_P}" ; then
return 0
fi
# Is the installed gobject-introspection usable?
if ! g-ir-scanner --version &> /dev/null ; then
return 0
fi
# Do we somehow have a dev-libs/gobject-introspection installed
# with an unsatisfied dependency? (bug #951487)
if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
# Make sure has_version didn't lie to us while at it as well,
# given bug #951487.
if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION_PV} gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
return 1
}
# Build internal copy of gobject-introspection to avoid circular dependency (built for native abi only)
if _need_bootstrap_gi ; then
einfo "Bootstrapping gobject-introspection..."
INTROSPECTION_BIN_DIR="${T}/bootstrap-gi-prefix/usr/bin"
INTROSPECTION_LIB_DIR="${T}/bootstrap-gi-prefix/usr/$(get_libdir)"
local emesonargs=(
--prefix="${T}/bootstrap-gi-prefix/usr"
-Dpython="${EPYTHON}"
-Dbuild_introspection_data=true
# Build an internal copy of glib for the internal copy of gobject-introspection
--force-fallback-for=glib
# Make the paths in pkgconfig files relative as we used to not
# do a proper install here and it seems less risky to keep it
# this way.
-Dpkgconfig.relocatable=true
# We want as minimal a build as possible here to speed things up
# and reduce the risk of failures.
-Dglib:selinux=disabled
-Dglib:xattr=false
-Dglib:libmount=disabled
-Dglib:man-pages=disabled
-Dglib:dtrace=disabled
-Dglib:systemtap=disabled
-Dglib:sysprof=disabled
-Dglib:documentation=false
-Dglib:tests=false
-Dglib:installed_tests=false
-Dglib:nls=disabled
-Dglib:oss_fuzz=disabled
-Dglib:libelf=disabled
-Dglib:multiarch=false
)
ORIG_SOURCE_DIR=${EMESON_SOURCE}
EMESON_SOURCE=${INTROSPECTION_SOURCE_DIR}
# g-ir-scanner has some relocatable logic but it searches
# for 'lib', not 'lib64', so it can't find itself and eventually
# falls back to the system installation. See bug #946221.
sed -i -e "/^pylibdir =/s:'lib:'$(get_libdir):" "${EMESON_SOURCE}"/tools/g-ir-tool-template.in || die
ORIG_BUILD_DIR=${BUILD_DIR}
BUILD_DIR=${INTROSPECTION_BUILD_DIR}
pushd ${INTROSPECTION_SOURCE_DIR} || die
meson_src_configure
meson_src_compile
# We already provide a prefix in ${T} above. Blank DESTDIR
# as it may be set in the environment by Portage (though not
# guaranteed in src_configure).
meson_src_install --destdir ""
popd || die
EMESON_SOURCE=${ORIG_SOURCE_DIR}
BUILD_DIR=${ORIG_BUILD_DIR}
# Add gobject-introspection binaries and pkgconfig files to path
export PATH="${INTROSPECTION_BIN_DIR}:${PATH}"
# Override primary pkgconfig search paths to prioritize our internal copy
export PKG_CONFIG_LIBDIR="${INTROSPECTION_LIB_DIR}/pkgconfig:${INTROSPECTION_BUILD_DIR}/meson-private"
# Set the normal primary pkgconfig search paths as secondary
# (We also need to prepend our just-built one for later use of
# g-ir-scanner to use the new one and to help workaround bugs like
# bug #946221.)
export PKG_CONFIG_PATH="${PKG_CONFIG_LIBDIR}:$(pkg-config --variable pc_path pkg-config)"
# Add the paths to the built glib libraries to the library path so that gobject-introspection can load them
for gliblib in glib gobject gthread gmodule gio girepository; do
export LD_LIBRARY_PATH="${BUILD_DIR}/${gliblib}:${LD_LIBRARY_PATH}"
done
# Add the path to introspection libraries so that glib can call gir utilities
export LD_LIBRARY_PATH="${INTROSPECTION_LIB_DIR}:${LD_LIBRARY_PATH}"
# Add the paths to the gobject-introspection python modules to python path so they can be imported
export PYTHONPATH="${INTROSPECTION_LIB_DIR}/gobject-introspection:${PYTHONPATH}"
fi
# TODO: Can this be cleaned up now we have -Dglib_debug? (bug #946485)
use debug && EMESON_BUILD_TYPE=debug
local emesonargs=(
-Ddefault_library=$(usex static-libs both shared)
-Druntime_dir="${EPREFIX}"/run
$(meson_feature debug glib_debug)
$(meson_feature selinux)
$(meson_use xattr)
-Dlibmount=enabled # only used if host_system == 'linux'
-Dman-pages=enabled
$(meson_feature systemtap dtrace)
$(meson_feature systemtap)
$(meson_feature sysprof)
$(meson_use doc documentation)
$(meson_use test tests)
-Dinstalled_tests=false
-Dnls=enabled
-Doss_fuzz=disabled
$(meson_native_use_feature elf libelf)
-Dmultiarch=false
$(meson_native_use_feature introspection)
)
# Workaround for bug #938302
if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then
local native_file="${T}"/meson.${CHOST}.ini.local
cat >> ${native_file} <<-EOF || die
[binaries]
dtrace='stap-dtrace'
EOF
emesonargs+=( --native-file "${native_file}" )
fi
meson_src_configure
}
multilib_src_test() {
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_DATA_DIRS=/usr/local/share:/usr/share
# TODO: Use ${ABI} here to be unique for multilib?
export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
export LC_TIME=C # bug #411967
export TZ=UTC
unset GSETTINGS_BACKEND # bug #596380
python_setup
# https://bugs.gentoo.org/839807
local -x SANDBOX_PREDICT=${SANDBOX_PREDICT}
addpredict /usr/b
# Related test is a bit nitpicking
mkdir -p "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
meson_src_test --timeout-multiplier 20 --no-suite flaky
}
multilib_src_install() {
meson_src_install
keepdir /usr/$(get_libdir)/gio/modules
}
multilib_src_install_all() {
strip-lto-bytecode
# These are installed by dev-util/glib-utils
# 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
rm "${ED}/usr/bin/glib-genmarshal" || die
rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die
rm "${ED}/usr/bin/glib-mkenums" || die
rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die
rm "${ED}/usr/bin/gtester-report" || die
rm "${ED}/usr/share/man/man1/gtester-report.1" || die
# gdbus-codegen manpage installed by dev-util/gdbus-codegen
rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die
}
pkg_preinst() {
xdg_pkg_preinst
# Make gschemas.compiled belong to glib alone
local cache="/usr/share/glib-2.0/schemas/gschemas.compiled"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"/${cache} || die
else
touch "${ED}"${cache} || die
fi
multilib_pkg_preinst() {
# Make giomodule.cache belong to glib alone
local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"${cache} || die
else
touch "${ED}"${cache} || die
fi
}
# Don't run the cache ownership when cross-compiling, as it would end up with an empty cache
# file due to inability to create it and GIO might not look at any of the modules there
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_preinst
fi
}
pkg_postinst() {
xdg_pkg_postinst
# glib installs no schemas itself, but we force update for fresh install in case
# something has dropped in a schemas file without direct glib dep; and for upgrades
# in case the compiled schema format could have changed
gnome2_schemas_update
multilib_pkg_postinst() {
gnome2_giomodule_cache_update \
|| die "Update GIO modules cache failed (for ${ABI})"
}
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_postinst
else
ewarn "Updating of GIO modules cache skipped due to cross-compilation."
ewarn "You might want to run gio-querymodules manually on the target for"
ewarn "your final image for performance reasons and re-run it when packages"
ewarn "installing GIO modules get upgraded or added to the image."
fi
if ver_replacing "-lt" "2.63.6"; then
ewarn "glib no longer installs the gio-launch-desktop binary. You may need"
ewarn "to restart your session for \"Open With\" dialogs to work."
fi
}
pkg_postrm() {
xdg_pkg_postrm
gnome2_schemas_update
if [[ -z ${REPLACED_BY_VERSION} ]]; then
multilib_pkg_postrm() {
rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache || die
}
multilib_foreach_abi multilib_pkg_postrm
rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled || die
fi
}

View File

@ -1,484 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_REQ_USE="xml(+)"
PYTHON_COMPAT=( python3_{11..13} )
inherit dot-a eapi9-ver gnome.org gnome2-utils linux-info meson-multilib multilib python-any-r1 toolchain-funcs xdg
DESCRIPTION="The GLib library of C routines"
HOMEPAGE="https://www.gtk.org/"
INTROSPECTION_PN="gobject-introspection"
INTROSPECTION_PV="1.82.0"
INTROSPECTION_P="${INTROSPECTION_PN}-${INTROSPECTION_PV}"
SRC_URI="
${SRC_URI}
introspection? ( mirror://gnome/sources/gobject-introspection/${INTROSPECTION_PV%.*}/gobject-introspection-${INTROSPECTION_PV}.tar.${GNOME_TARBALL_SUFFIX} )
"
INTROSPECTION_SOURCE_DIR="${WORKDIR}/${INTROSPECTION_P}"
INTROSPECTION_BUILD_DIR="${WORKDIR}/${INTROSPECTION_P}-build"
LICENSE="LGPL-2.1+"
SLOT="2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="dbus debug +elf doc +introspection +mime selinux static-libs sysprof systemtap test utils xattr"
RESTRICT="!test? ( test )"
# * elfutils (via libelf) does not build on Windows. gresources are not embedded
# within ELF binaries on that platform anyway and inspecting ELF binaries from
# other platforms is not that useful so exclude the dependency in this case.
# * Technically static-libs is needed on zlib, util-linux and perhaps more, but
# these are used by GIO, which glib[static-libs] consumers don't really seem
# to need at all, thus not imposing the deps for now and once some consumers
# are actually found to static link libgio-2.0.a, we can revisit and either add
# them or just put the (build) deps in that rare consumer instead of recursive
# RDEPEND here (due to lack of recursive DEPEND).
RDEPEND="
!<dev-libs/gobject-introspection-1.80.1
!<dev-util/gdbus-codegen-${PV}
>=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
>=dev-libs/libpcre2-10.32:0=[${MULTILIB_USEDEP},unicode(+),static-libs?]
>=dev-libs/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}]
>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
>=virtual/libintl-0-r2[${MULTILIB_USEDEP}]
introspection? (
>=dev-libs/gobject-introspection-common-${INTROSPECTION_PV}
)
kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] )
selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) )
elf? ( virtual/libelf:0= )
sysprof? ( >=dev-util/sysprof-capture-3.40.1:4[${MULTILIB_USEDEP}] )
"
DEPEND="${RDEPEND}"
# libxml2 used for optional tests that get automatically skipped
BDEPEND="
app-text/docbook-xsl-stylesheets
>=dev-build/meson-1.4.0
dev-libs/libxslt
>=sys-devel/gettext-0.19.8
doc? ( >=dev-util/gi-docgen-2023.1 )
dev-python/docutils
systemtap? ( >=dev-debug/systemtap-1.3 )
${PYTHON_DEPS}
test? ( >=sys-apps/dbus-1.2.14 )
virtual/pkgconfig
introspection? (
$(python_gen_any_dep '
dev-python/setuptools[${PYTHON_USEDEP}]
')
virtual/pkgconfig
sys-devel/bison
app-alternatives/lex
${PYTHON_DEPS}
)
"
# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen
PDEPEND="
dbus? ( gnome-base/dconf )
mime? ( x11-misc/shared-mime-info )
"
# shared-mime-info needed for gio/xdgmime, bug #409481
# dconf is needed to be able to save settings, bug #498436
MULTILIB_CHOST_TOOLS=(
/usr/bin/gio-querymodules$(get_exeext)
)
PATCHES=(
"${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
"${FILESDIR}"/${PN}-2.84.1-gclosure-vs-threads.patch
)
python_check_deps() {
if use introspection ; then
python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]"
fi
}
pkg_setup() {
if use kernel_linux ; then
CONFIG_CHECK="~INOTIFY_USER"
if use test ; then
CONFIG_CHECK="~IPV6"
WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
fi
linux-info_pkg_setup
fi
python-any-r1_pkg_setup
}
src_prepare() {
if use test; then
# TODO: Review the test exclusions, especially now with meson
# Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163
if ! has_version dev-util/desktop-file-utils ; then
ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
ewarn "think on installing it to get these tests run."
sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die
sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die
fi
# gdesktopappinfo requires existing terminal (gnome-terminal or any
# other), falling back to xterm if one doesn't exist
#if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then
# ewarn "Some tests will be skipped due to missing terminal program"
# These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson
# 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
sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die
# desktop-app-info/launch* might fail similarly
sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die
#fi
# https://bugzilla.gnome.org/show_bug.cgi?id=722604
sed -i -e "/timer\/stop/d" glib/tests/timer.c || die
sed -i -e "/timer\/basic/d" glib/tests/timer.c || die
ewarn "Tests for search-utils have been skipped"
sed -i -e "/search-utils/d" glib/tests/meson.build || die
# Running gdb inside a test within sandbox is brittle
sed -i -e '/self.__gdb = shutil.which("gdb")/s:"gdb":"gdb-idonotexist":' glib/tests/assert-msg-test.py || die
# Play nice with network-sandbox, but this approach would defeat the purpose of the test
#sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die
else
# Don't build tests, also prevents extra deps, bug #512022
sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die
fi
# Don't build fuzzing binaries - not used
sed -i -e '/subdir.*fuzzing/d' meson.build || die
# gdbus-codegen is a separate package
sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die
sed -i -e '/install : true/d' gio/gdbus-2.0/codegen/meson.build || die
# Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon
sed -i -e '/install_dir/d' gio/tests/meson.build || die
cat > "${T}/glib-test-ld-wrapper" <<-EOF
#!/usr/bin/env sh
exec \${LD:-ld} "\$@"
EOF
chmod a+x "${T}/glib-test-ld-wrapper" || die
sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die
# make default sane for us
if use prefix ; then
sed -i -e "s:/usr/local:${EPREFIX}/usr:" gio/xdgmime/xdgmime.c || die
# bug #308609, without path, bug #314057
export PERL=perl
fi
if [[ ${CHOST} == *-solaris* ]] ; then
# fix standards conflicts
sed -i \
-e 's/\<\(_XOPEN_SOURCE_EXTENDED\)\>/_POSIX_PTHREAD_SEMANTICS/' \
-e '/\<_XOPEN_SOURCE\>/s/\<2\>/600/' \
meson.build || die
sed -i -e '/#define\s\+_POSIX_SOURCE/d' \
glib/giounix.c || die
fi
# disable native macOS integrations
sed -i -e '/glib_conf.set(.HAVE_\(CARBON\|COCOA\).,/s/true/false/' \
meson.build || die
sed -i \
-e '/AvailabilityMacros.h/d' \
gio/giomodule.c || die
# Link the glib source to the introspection subproject directory so it can be built there first
if use introspection ; then
ln -s "${S}" "${INTROSPECTION_SOURCE_DIR}/subprojects/glib"
fi
default
gnome2_environment_reset
# TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only
}
src_configure() {
lto-guarantee-fat
meson-multilib_src_configure
}
multilib_src_configure() {
# TODO: figure a way to pass appropriate values for all cross properties
# that glib uses (search for get_cross_property)
#if tc-is-cross-compiler ; then
# https://bugzilla.gnome.org/show_bug.cgi?id=756473
# TODO-meson: This should be in meson cross file as 'growing_stack'
# property; and more, look at get_cross_property
#case ${CHOST} in
#hppa*|metag*) export glib_cv_stack_grows=yes ;;
#*) export glib_cv_stack_grows=no ;;
#esac
#fi
_need_bootstrap_gi() {
if ! multilib_native_use introspection ; then
return 1
fi
if ! has_version ">=dev-libs/${INTROSPECTION_P}" ; then
return 0
fi
# Is the installed gobject-introspection usable?
if ! g-ir-scanner --version &> /dev/null ; then
return 0
fi
# Do we somehow have a dev-libs/gobject-introspection installed
# with an unsatisfied dependency? (bug #951487)
if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
# Make sure has_version didn't lie to us while at it as well,
# given bug #951487.
if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION_PV} gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
return 1
}
# Build internal copy of gobject-introspection to avoid circular dependency (built for native abi only)
if _need_bootstrap_gi ; then
einfo "Bootstrapping gobject-introspection..."
INTROSPECTION_BIN_DIR="${T}/bootstrap-gi-prefix/usr/bin"
INTROSPECTION_LIB_DIR="${T}/bootstrap-gi-prefix/usr/$(get_libdir)"
local emesonargs=(
--prefix="${T}/bootstrap-gi-prefix/usr"
-Dpython="${EPYTHON}"
-Dbuild_introspection_data=true
# Build an internal copy of glib for the internal copy of gobject-introspection
--force-fallback-for=glib
# Make the paths in pkgconfig files relative as we used to not
# do a proper install here and it seems less risky to keep it
# this way.
-Dpkgconfig.relocatable=true
# We want as minimal a build as possible here to speed things up
# and reduce the risk of failures.
-Dglib:selinux=disabled
-Dglib:xattr=false
-Dglib:libmount=disabled
-Dglib:man-pages=disabled
-Dglib:dtrace=disabled
-Dglib:systemtap=disabled
-Dglib:sysprof=disabled
-Dglib:documentation=false
-Dglib:tests=false
-Dglib:installed_tests=false
-Dglib:nls=disabled
-Dglib:oss_fuzz=disabled
-Dglib:libelf=disabled
-Dglib:multiarch=false
)
ORIG_SOURCE_DIR=${EMESON_SOURCE}
EMESON_SOURCE=${INTROSPECTION_SOURCE_DIR}
# g-ir-scanner has some relocatable logic but it searches
# for 'lib', not 'lib64', so it can't find itself and eventually
# falls back to the system installation. See bug #946221.
sed -i -e "/^pylibdir =/s:'lib:'$(get_libdir):" "${EMESON_SOURCE}"/tools/g-ir-tool-template.in || die
ORIG_BUILD_DIR=${BUILD_DIR}
BUILD_DIR=${INTROSPECTION_BUILD_DIR}
pushd ${INTROSPECTION_SOURCE_DIR} || die
meson_src_configure
meson_src_compile
# We already provide a prefix in ${T} above. Blank DESTDIR
# as it may be set in the environment by Portage (though not
# guaranteed in src_configure).
meson_src_install --destdir ""
popd || die
EMESON_SOURCE=${ORIG_SOURCE_DIR}
BUILD_DIR=${ORIG_BUILD_DIR}
# Add gobject-introspection binaries and pkgconfig files to path
export PATH="${INTROSPECTION_BIN_DIR}:${PATH}"
# Override primary pkgconfig search paths to prioritize our internal copy
export PKG_CONFIG_LIBDIR="${INTROSPECTION_LIB_DIR}/pkgconfig:${INTROSPECTION_BUILD_DIR}/meson-private"
# Set the normal primary pkgconfig search paths as secondary
# (We also need to prepend our just-built one for later use of
# g-ir-scanner to use the new one and to help workaround bugs like
# bug #946221.)
export PKG_CONFIG_PATH="${PKG_CONFIG_LIBDIR}:$(pkg-config --variable pc_path pkg-config)"
# Add the paths to the built glib libraries to the library path so that gobject-introspection can load them
for gliblib in glib gobject gthread gmodule gio girepository; do
export LD_LIBRARY_PATH="${BUILD_DIR}/${gliblib}:${LD_LIBRARY_PATH}"
done
# Add the path to introspection libraries so that glib can call gir utilities
export LD_LIBRARY_PATH="${INTROSPECTION_LIB_DIR}:${LD_LIBRARY_PATH}"
# Add the paths to the gobject-introspection python modules to python path so they can be imported
export PYTHONPATH="${INTROSPECTION_LIB_DIR}/gobject-introspection:${PYTHONPATH}"
fi
# TODO: Can this be cleaned up now we have -Dglib_debug? (bug #946485)
use debug && EMESON_BUILD_TYPE=debug
local emesonargs=(
-Ddefault_library=$(usex static-libs both shared)
-Druntime_dir="${EPREFIX}"/run
$(meson_feature debug glib_debug)
$(meson_feature selinux)
$(meson_use xattr)
-Dlibmount=enabled # only used if host_system == 'linux'
-Dman-pages=enabled
$(meson_feature systemtap dtrace)
$(meson_feature systemtap)
$(meson_feature sysprof)
$(meson_use doc documentation)
$(meson_use test tests)
-Dinstalled_tests=false
-Dnls=enabled
-Doss_fuzz=disabled
$(meson_native_use_feature elf libelf)
-Dmultiarch=false
$(meson_native_use_feature introspection)
)
# Workaround for bug #938302
if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then
local native_file="${T}"/meson.${CHOST}.ini.local
cat >> ${native_file} <<-EOF || die
[binaries]
dtrace='stap-dtrace'
EOF
emesonargs+=( --native-file "${native_file}" )
fi
meson_src_configure
}
multilib_src_test() {
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_DATA_DIRS=/usr/local/share:/usr/share
# TODO: Use ${ABI} here to be unique for multilib?
export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
export LC_TIME=C # bug #411967
export TZ=UTC
unset GSETTINGS_BACKEND # bug #596380
python_setup
# https://bugs.gentoo.org/839807
local -x SANDBOX_PREDICT=${SANDBOX_PREDICT}
addpredict /usr/b
# Related test is a bit nitpicking
mkdir -p "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
meson_src_test --timeout-multiplier 20 --no-suite flaky
}
multilib_src_install() {
meson_src_install
keepdir /usr/$(get_libdir)/gio/modules
}
multilib_src_install_all() {
strip-lto-bytecode
# These are installed by dev-util/glib-utils
# 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
rm "${ED}/usr/bin/glib-genmarshal" || die
rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die
rm "${ED}/usr/bin/glib-mkenums" || die
rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die
rm "${ED}/usr/bin/gtester-report" || die
rm "${ED}/usr/share/man/man1/gtester-report.1" || die
# gdbus-codegen manpage installed by dev-util/gdbus-codegen
rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die
}
pkg_preinst() {
xdg_pkg_preinst
# Make gschemas.compiled belong to glib alone
local cache="/usr/share/glib-2.0/schemas/gschemas.compiled"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"/${cache} || die
else
touch "${ED}"${cache} || die
fi
multilib_pkg_preinst() {
# Make giomodule.cache belong to glib alone
local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"${cache} || die
else
touch "${ED}"${cache} || die
fi
}
# Don't run the cache ownership when cross-compiling, as it would end up with an empty cache
# file due to inability to create it and GIO might not look at any of the modules there
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_preinst
fi
}
pkg_postinst() {
xdg_pkg_postinst
# glib installs no schemas itself, but we force update for fresh install in case
# something has dropped in a schemas file without direct glib dep; and for upgrades
# in case the compiled schema format could have changed
gnome2_schemas_update
multilib_pkg_postinst() {
gnome2_giomodule_cache_update \
|| die "Update GIO modules cache failed (for ${ABI})"
}
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_postinst
else
ewarn "Updating of GIO modules cache skipped due to cross-compilation."
ewarn "You might want to run gio-querymodules manually on the target for"
ewarn "your final image for performance reasons and re-run it when packages"
ewarn "installing GIO modules get upgraded or added to the image."
fi
if ver_replacing "-lt" "2.63.6"; then
ewarn "glib no longer installs the gio-launch-desktop binary. You may need"
ewarn "to restart your session for \"Open With\" dialogs to work."
fi
}
pkg_postrm() {
xdg_pkg_postrm
gnome2_schemas_update
if [[ -z ${REPLACED_BY_VERSION} ]]; then
multilib_pkg_postrm() {
rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache || die
}
multilib_foreach_abi multilib_pkg_postrm
rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled || die
fi
}

View File

@ -1,483 +0,0 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_REQ_USE="xml(+)"
PYTHON_COMPAT=( python3_{11..14} )
inherit dot-a eapi9-ver gnome.org gnome2-utils linux-info meson-multilib multilib python-any-r1 toolchain-funcs xdg
DESCRIPTION="The GLib library of C routines"
HOMEPAGE="https://www.gtk.org/"
INTROSPECTION_PN="gobject-introspection"
INTROSPECTION_PV="1.82.0"
INTROSPECTION_P="${INTROSPECTION_PN}-${INTROSPECTION_PV}"
SRC_URI="
${SRC_URI}
introspection? ( mirror://gnome/sources/gobject-introspection/${INTROSPECTION_PV%.*}/gobject-introspection-${INTROSPECTION_PV}.tar.${GNOME_TARBALL_SUFFIX} )
"
INTROSPECTION_SOURCE_DIR="${WORKDIR}/${INTROSPECTION_P}"
INTROSPECTION_BUILD_DIR="${WORKDIR}/${INTROSPECTION_P}-build"
LICENSE="LGPL-2.1+"
SLOT="2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="dbus debug +elf doc +introspection +mime selinux static-libs sysprof systemtap test utils xattr"
RESTRICT="!test? ( test )"
# * elfutils (via libelf) does not build on Windows. gresources are not embedded
# within ELF binaries on that platform anyway and inspecting ELF binaries from
# other platforms is not that useful so exclude the dependency in this case.
# * Technically static-libs is needed on zlib, util-linux and perhaps more, but
# these are used by GIO, which glib[static-libs] consumers don't really seem
# to need at all, thus not imposing the deps for now and once some consumers
# are actually found to static link libgio-2.0.a, we can revisit and either add
# them or just put the (build) deps in that rare consumer instead of recursive
# RDEPEND here (due to lack of recursive DEPEND).
RDEPEND="
!<dev-libs/gobject-introspection-1.80.1
!<dev-util/gdbus-codegen-${PV}
>=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
>=dev-libs/libpcre2-10.32:0=[${MULTILIB_USEDEP},unicode(+),static-libs?]
>=dev-libs/libffi-3.0.13-r1:=[${MULTILIB_USEDEP}]
>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
>=virtual/libintl-0-r2[${MULTILIB_USEDEP}]
introspection? (
>=dev-libs/gobject-introspection-common-${INTROSPECTION_PV}
)
kernel_linux? ( >=sys-apps/util-linux-2.23[${MULTILIB_USEDEP}] )
selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
xattr? ( !elibc_glibc? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] ) )
elf? ( virtual/libelf:0= )
sysprof? ( >=dev-util/sysprof-capture-3.40.1:4[${MULTILIB_USEDEP}] )
"
DEPEND="${RDEPEND}"
# libxml2 used for optional tests that get automatically skipped
BDEPEND="
app-text/docbook-xsl-stylesheets
>=dev-build/meson-1.4.0
dev-libs/libxslt
>=sys-devel/gettext-0.19.8
doc? ( >=dev-util/gi-docgen-2023.1 )
dev-python/docutils
systemtap? ( >=dev-debug/systemtap-1.3 )
${PYTHON_DEPS}
test? ( >=sys-apps/dbus-1.2.14 )
virtual/pkgconfig
introspection? (
$(python_gen_any_dep '
dev-python/setuptools[${PYTHON_USEDEP}]
')
virtual/pkgconfig
sys-devel/bison
app-alternatives/lex
${PYTHON_DEPS}
)
"
# TODO: >=dev-util/gdbus-codegen-${PV} test dep once we modify gio/tests/meson.build to use external gdbus-codegen
PDEPEND="
dbus? ( gnome-base/dconf )
mime? ( x11-misc/shared-mime-info )
"
# shared-mime-info needed for gio/xdgmime, bug #409481
# dconf is needed to be able to save settings, bug #498436
MULTILIB_CHOST_TOOLS=(
/usr/bin/gio-querymodules$(get_exeext)
)
PATCHES=(
"${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch
)
python_check_deps() {
if use introspection ; then
python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]"
fi
}
pkg_setup() {
if use kernel_linux ; then
CONFIG_CHECK="~INOTIFY_USER"
if use test ; then
CONFIG_CHECK="~IPV6"
WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
fi
linux-info_pkg_setup
fi
python-any-r1_pkg_setup
}
src_prepare() {
if use test; then
# TODO: Review the test exclusions, especially now with meson
# Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163
if ! has_version dev-util/desktop-file-utils ; then
ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
ewarn "think on installing it to get these tests run."
sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die
sed -i -e "/g_test_add_func/d" gio/tests/desktop-app-info.c || die
fi
# gdesktopappinfo requires existing terminal (gnome-terminal or any
# other), falling back to xterm if one doesn't exist
#if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then
# ewarn "Some tests will be skipped due to missing terminal program"
# These tests seem to sometimes fail even with a terminal; skip for now and reevulate with meson
# 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
sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die
# desktop-app-info/launch* might fail similarly
sed -i -e "/desktop-app-info\/launch-as-manager/d" gio/tests/desktop-app-info.c || die
#fi
# https://bugzilla.gnome.org/show_bug.cgi?id=722604
sed -i -e "/timer\/stop/d" glib/tests/timer.c || die
sed -i -e "/timer\/basic/d" glib/tests/timer.c || die
ewarn "Tests for search-utils have been skipped"
sed -i -e "/search-utils/d" glib/tests/meson.build || die
# Running gdb inside a test within sandbox is brittle
sed -i -e '/self.__gdb = shutil.which("gdb")/s:"gdb":"gdb-idonotexist":' glib/tests/assert-msg-test.py || die
# Play nice with network-sandbox, but this approach would defeat the purpose of the test
#sed -i -e "s/localhost/127.0.0.1/g" gio/tests/gsocketclient-slow.c || die
else
# Don't build tests, also prevents extra deps, bug #512022
sed -i -e '/subdir.*tests/d' {.,gio,glib}/meson.build || die
fi
# Don't build fuzzing binaries - not used
sed -i -e '/subdir.*fuzzing/d' meson.build || die
# gdbus-codegen is a separate package
sed -i -e '/install_dir/d' gio/gdbus-2.0/codegen/meson.build || die
sed -i -e '/install : true/d' gio/gdbus-2.0/codegen/meson.build || die
# Same kind of meson-0.50 issue with some installed-tests files; will likely be fixed upstream soon
sed -i -e '/install_dir/d' gio/tests/meson.build || die
cat > "${T}/glib-test-ld-wrapper" <<-EOF
#!/usr/bin/env sh
exec \${LD:-ld} "\$@"
EOF
chmod a+x "${T}/glib-test-ld-wrapper" || die
sed -i -e "s|'ld'|'${T}/glib-test-ld-wrapper'|g" gio/tests/meson.build || die
# make default sane for us
if use prefix ; then
sed -i -e "s:/usr/local:${EPREFIX}/usr:" gio/xdgmime/xdgmime.c || die
# bug #308609, without path, bug #314057
export PERL=perl
fi
if [[ ${CHOST} == *-solaris* ]] ; then
# fix standards conflicts
sed -i \
-e 's/\<\(_XOPEN_SOURCE_EXTENDED\)\>/_POSIX_PTHREAD_SEMANTICS/' \
-e '/\<_XOPEN_SOURCE\>/s/\<2\>/600/' \
meson.build || die
sed -i -e '/#define\s\+_POSIX_SOURCE/d' \
glib/giounix.c || die
fi
# disable native macOS integrations
sed -i -e '/glib_conf.set(.HAVE_\(CARBON\|COCOA\).,/s/true/false/' \
meson.build || die
sed -i \
-e '/AvailabilityMacros.h/d' \
gio/giomodule.c || die
# Link the glib source to the introspection subproject directory so it can be built there first
if use introspection ; then
ln -s "${S}" "${INTROSPECTION_SOURCE_DIR}/subprojects/glib"
fi
default
gnome2_environment_reset
# TODO: python_name sedding for correct python shebang? Might be relevant mainly for glib-utils only
}
src_configure() {
lto-guarantee-fat
meson-multilib_src_configure
}
multilib_src_configure() {
# TODO: figure a way to pass appropriate values for all cross properties
# that glib uses (search for get_cross_property)
#if tc-is-cross-compiler ; then
# https://bugzilla.gnome.org/show_bug.cgi?id=756473
# TODO-meson: This should be in meson cross file as 'growing_stack'
# property; and more, look at get_cross_property
#case ${CHOST} in
#hppa*|metag*) export glib_cv_stack_grows=yes ;;
#*) export glib_cv_stack_grows=no ;;
#esac
#fi
_need_bootstrap_gi() {
if ! multilib_native_use introspection ; then
return 1
fi
if ! has_version ">=dev-libs/${INTROSPECTION_P}" ; then
return 0
fi
# Is the installed gobject-introspection usable?
if ! g-ir-scanner --version &> /dev/null ; then
return 0
fi
# Do we somehow have a dev-libs/gobject-introspection installed
# with an unsatisfied dependency? (bug #951487)
if ! $(tc-getPKG_CONFIG) --cflags gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
# Make sure has_version didn't lie to us while at it as well,
# given bug #951487.
if ! $(tc-getPKG_CONFIG) --atleast-version=${INTROSPECTION_PV} gobject-introspection-1.0 &> /dev/null ; then
return 0
fi
return 1
}
# Build internal copy of gobject-introspection to avoid circular dependency (built for native abi only)
if _need_bootstrap_gi ; then
einfo "Bootstrapping gobject-introspection..."
INTROSPECTION_BIN_DIR="${T}/bootstrap-gi-prefix/usr/bin"
INTROSPECTION_LIB_DIR="${T}/bootstrap-gi-prefix/usr/$(get_libdir)"
local emesonargs=(
--prefix="${T}/bootstrap-gi-prefix/usr"
-Dpython="${EPYTHON}"
-Dbuild_introspection_data=true
# Build an internal copy of glib for the internal copy of gobject-introspection
--force-fallback-for=glib
# Make the paths in pkgconfig files relative as we used to not
# do a proper install here and it seems less risky to keep it
# this way.
-Dpkgconfig.relocatable=true
# We want as minimal a build as possible here to speed things up
# and reduce the risk of failures.
-Dglib:selinux=disabled
-Dglib:xattr=false
-Dglib:libmount=disabled
-Dglib:man-pages=disabled
-Dglib:dtrace=disabled
-Dglib:systemtap=disabled
-Dglib:sysprof=disabled
-Dglib:documentation=false
-Dglib:tests=false
-Dglib:installed_tests=false
-Dglib:nls=disabled
-Dglib:oss_fuzz=disabled
-Dglib:libelf=disabled
-Dglib:multiarch=false
)
ORIG_SOURCE_DIR=${EMESON_SOURCE}
EMESON_SOURCE=${INTROSPECTION_SOURCE_DIR}
# g-ir-scanner has some relocatable logic but it searches
# for 'lib', not 'lib64', so it can't find itself and eventually
# falls back to the system installation. See bug #946221.
sed -i -e "/^pylibdir =/s:'lib:'$(get_libdir):" "${EMESON_SOURCE}"/tools/g-ir-tool-template.in || die
ORIG_BUILD_DIR=${BUILD_DIR}
BUILD_DIR=${INTROSPECTION_BUILD_DIR}
pushd ${INTROSPECTION_SOURCE_DIR} || die
meson_src_configure
meson_src_compile
# We already provide a prefix in ${T} above. Blank DESTDIR
# as it may be set in the environment by Portage (though not
# guaranteed in src_configure).
meson_src_install --destdir ""
popd || die
EMESON_SOURCE=${ORIG_SOURCE_DIR}
BUILD_DIR=${ORIG_BUILD_DIR}
# Add gobject-introspection binaries and pkgconfig files to path
export PATH="${INTROSPECTION_BIN_DIR}:${PATH}"
# Override primary pkgconfig search paths to prioritize our internal copy
export PKG_CONFIG_LIBDIR="${INTROSPECTION_LIB_DIR}/pkgconfig:${INTROSPECTION_BUILD_DIR}/meson-private"
# Set the normal primary pkgconfig search paths as secondary
# (We also need to prepend our just-built one for later use of
# g-ir-scanner to use the new one and to help workaround bugs like
# bug #946221.)
export PKG_CONFIG_PATH="${PKG_CONFIG_LIBDIR}:$(pkg-config --variable pc_path pkg-config)"
# Add the paths to the built glib libraries to the library path so that gobject-introspection can load them
for gliblib in glib gobject gthread gmodule gio girepository; do
export LD_LIBRARY_PATH="${BUILD_DIR}/${gliblib}:${LD_LIBRARY_PATH}"
done
# Add the path to introspection libraries so that glib can call gir utilities
export LD_LIBRARY_PATH="${INTROSPECTION_LIB_DIR}:${LD_LIBRARY_PATH}"
# Add the paths to the gobject-introspection python modules to python path so they can be imported
export PYTHONPATH="${INTROSPECTION_LIB_DIR}/gobject-introspection:${PYTHONPATH}"
fi
# TODO: Can this be cleaned up now we have -Dglib_debug? (bug #946485)
use debug && EMESON_BUILD_TYPE=debug
local emesonargs=(
-Ddefault_library=$(usex static-libs both shared)
-Druntime_dir="${EPREFIX}"/run
$(meson_feature debug glib_debug)
$(meson_feature selinux)
$(meson_use xattr)
-Dlibmount=enabled # only used if host_system == 'linux'
-Dman-pages=enabled
$(meson_feature systemtap dtrace)
$(meson_feature systemtap)
$(meson_feature sysprof)
$(meson_use doc documentation)
$(meson_use test tests)
-Dinstalled_tests=false
-Dnls=enabled
-Doss_fuzz=disabled
$(meson_native_use_feature elf libelf)
-Dmultiarch=false
$(meson_native_use_feature introspection)
)
# Workaround for bug #938302
if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then
local native_file="${T}"/meson.${CHOST}.ini.local
cat >> ${native_file} <<-EOF || die
[binaries]
dtrace='stap-dtrace'
EOF
emesonargs+=( --native-file "${native_file}" )
fi
meson_src_configure
}
multilib_src_test() {
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_DATA_DIRS=/usr/local/share:/usr/share
# TODO: Use ${ABI} here to be unique for multilib?
export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
export LC_TIME=C # bug #411967
export TZ=UTC
unset GSETTINGS_BACKEND # bug #596380
python_setup
# https://bugs.gentoo.org/839807
local -x SANDBOX_PREDICT=${SANDBOX_PREDICT}
addpredict /usr/b
# Related test is a bit nitpicking
mkdir -p "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR" || die
meson_src_test --timeout-multiplier 20 --no-suite flaky
}
multilib_src_install() {
meson_src_install
keepdir /usr/$(get_libdir)/gio/modules
}
multilib_src_install_all() {
strip-lto-bytecode
# These are installed by dev-util/glib-utils
# 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
rm "${ED}/usr/bin/glib-genmarshal" || die
rm "${ED}/usr/share/man/man1/glib-genmarshal.1" || die
rm "${ED}/usr/bin/glib-mkenums" || die
rm "${ED}/usr/share/man/man1/glib-mkenums.1" || die
rm "${ED}/usr/bin/gtester-report" || die
rm "${ED}/usr/share/man/man1/gtester-report.1" || die
# gdbus-codegen manpage installed by dev-util/gdbus-codegen
rm "${ED}/usr/share/man/man1/gdbus-codegen.1" || die
}
pkg_preinst() {
xdg_pkg_preinst
# Make gschemas.compiled belong to glib alone
local cache="/usr/share/glib-2.0/schemas/gschemas.compiled"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"/${cache} || die
else
touch "${ED}"${cache} || die
fi
multilib_pkg_preinst() {
# Make giomodule.cache belong to glib alone
local cache="/usr/$(get_libdir)/gio/modules/giomodule.cache"
if [[ -e ${EROOT}${cache} ]]; then
cp "${EROOT}"${cache} "${ED}"${cache} || die
else
touch "${ED}"${cache} || die
fi
}
# Don't run the cache ownership when cross-compiling, as it would end up with an empty cache
# file due to inability to create it and GIO might not look at any of the modules there
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_preinst
fi
}
pkg_postinst() {
xdg_pkg_postinst
# glib installs no schemas itself, but we force update for fresh install in case
# something has dropped in a schemas file without direct glib dep; and for upgrades
# in case the compiled schema format could have changed
gnome2_schemas_update
multilib_pkg_postinst() {
gnome2_giomodule_cache_update \
|| die "Update GIO modules cache failed (for ${ABI})"
}
if ! tc-is-cross-compiler ; then
multilib_foreach_abi multilib_pkg_postinst
else
ewarn "Updating of GIO modules cache skipped due to cross-compilation."
ewarn "You might want to run gio-querymodules manually on the target for"
ewarn "your final image for performance reasons and re-run it when packages"
ewarn "installing GIO modules get upgraded or added to the image."
fi
if ver_replacing "-lt" "2.63.6"; then
ewarn "glib no longer installs the gio-launch-desktop binary. You may need"
ewarn "to restart your session for \"Open With\" dialogs to work."
fi
}
pkg_postrm() {
xdg_pkg_postrm
gnome2_schemas_update
if [[ -z ${REPLACED_BY_VERSION} ]]; then
multilib_pkg_postrm() {
rm -f "${EROOT}"/usr/$(get_libdir)/gio/modules/giomodule.cache || die
}
multilib_foreach_abi multilib_pkg_postrm
rm -f "${EROOT}"/usr/share/glib-2.0/schemas/gschemas.compiled || die
fi
}