gobject-introspection: Update to 1.84.0

Fixes "ModuleNotFoundError: No module named 'distutils.msvccompiler'" when updating Python version

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8878

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8717>
This commit is contained in:
L. E. Segovia 2025-06-02 18:15:35 -03:00 committed by GStreamer Marge Bot
parent b11ccc5cdf
commit b6d006f89c
10 changed files with 303 additions and 163 deletions

View File

@ -1,11 +1,11 @@
[wrap-file]
directory = gobject-introspection-1.74.0
source_url = https://download.gnome.org/sources/gobject-introspection/1.74/gobject-introspection-1.74.0.tar.xz
source_fallback_url = https://deb.debian.org/debian/pool/main/g/gobject-introspection/gobject-introspection_1.74.0.orig.tar.xz
source_filename = gobject-introspection-1.74.0.tar.xz
source_hash = 347b3a719e68ba4c69ff2d57ee2689233ea8c07fc492205e573386779e42d653
wrapdb_version = 1.74.0-0
diff_files = gobject-introspection-1.74.0/0001-Fix-gir-build-when-using-subprojects-dependencies.patch, gobject-introspection-1.74.0/0001-gir-stop-assuming-glib-source-and-build-dirs-using-v.patch, gobject-introspection-1.74.0/0001-build-Work-around-an-undocumented-GLib-variable-rena.patch
directory = gobject-introspection-1.84.0
source_url = https://download.gnome.org/sources/gobject-introspection/1.84/gobject-introspection-1.84.0.tar.xz
source_fallback_url = https://ftp.acc.umu.se/pub/gnome/sources/gobject-introspection/1.84/gobject-introspection-1.84.0.tar.xz
source_filename = gobject-introspection-1.84.0.tar.xz
source_hash = 945b57da7ec262e5c266b89e091d14be800cc424277d82a02872b7d794a84779
wrapdb_version = 1.84.0-0
diff_files = gobject-introspection-1.84.0/0003-girepository-Load-typelibs-from-a-relocatable-prefix.patch, gobject-introspection-1.84.0/0004-build-Fix-b_vscrt-value-use-without-converting-it-to.patch, gobject-introspection-1.84.0/0006-tests-Fix-path-parsing-for-Windows.patch, gobject-introspection-1.84.0/0007-g-ir-tools-Support-reading-rspfiles-for-arguments.patch, gobject-introspection-1.84.0/0008-meson-Fix-fs.copyfile-semantics-breaking-GIR-build-w.patch, gobject-introspection-1.84.0/0009-giscanner-Deduplicate-arguments-and-use-response-fil.patch
[provide]
dependency_names = gobject-introspection-1.0

View File

@ -1,96 +0,0 @@
From b4c454a75108bc31934d2d0be0141a2220bded84 Mon Sep 17 00:00:00 2001
From: Andoni Morales Alastruey <ylatuya@gmail.com>
Date: Tue, 18 Oct 2022 11:18:06 +0200
Subject: [PATCH] Fix gir build when using subprojects' dependencies
https://github.com/mesonbuild/meson/pull/10275 introduced
support in meson to use uninstalled .pc files in the meson-uninstalled
directory to resolve dependencies built with subprojects.
Replicate the same solution while all the custom_target
are migrated to gnome.generate_dir
---
gir/meson.build | 5 +++++
meson.build | 10 ++++++++++
tests/meson.build | 1 +
3 files changed, 16 insertions(+)
diff --git a/gir/meson.build b/gir/meson.build
index da23e422..09714cc1 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -239,6 +239,7 @@ glib_gir = custom_target('gir-glib',
depend_files: gir_giscanner_built_files,
install: true,
install_dir: girdir,
+ env: g_ir_scanner_env,
command: glib_command + [
'--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
'-DGLIB_COMPILATION',
@@ -307,6 +308,7 @@ gobject_gir = custom_target('gir-gobject',
depend_files: gir_giscanner_built_files,
install: true,
install_dir: girdir,
+ env: g_ir_scanner_env,
command: gobject_command + [
'--include-uninstalled=' + glib_gir.full_path(),
'--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
@@ -360,6 +362,7 @@ gir_files += custom_target('gir-gmodule',
depend_files: gir_giscanner_built_files,
install: true,
install_dir: girdir,
+ env: g_ir_scanner_env,
command: gmodule_command + [
'--include-uninstalled=' + glib_gir.full_path(),
'--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
@@ -456,6 +459,7 @@ gio_gir = custom_target('gir-gio',
depend_files: gir_giscanner_built_files,
install: true,
install_dir: girdir,
+ env: g_ir_scanner_env,
command: gio_command + [
'--include-uninstalled=' + gobject_gir.full_path(),
'--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
@@ -493,6 +497,7 @@ gir_files += custom_target('gir-girepository',
depend_files: gir_giscanner_built_files,
install: true,
install_dir: girdir,
+ env: g_ir_scanner_env,
command: girepository_command + [
'--include-uninstalled=' + gobject_gir.full_path(),
'--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
diff --git a/meson.build b/meson.build
index ca9c2b22..28fbf7fe 100644
--- a/meson.build
+++ b/meson.build
@@ -151,6 +151,16 @@ if not (host_system == 'darwin' and host_arch == 'aarch64' or
config.set('LEGACY_GIRFFI_FREE', 1)
endif
+# Replicate https://github.com/mesonbuild/meson/pull/10275 setting
+# the correct env in the custom_target
+pkg_config = find_program('pkg-config')
+g_ir_scanner_env = environment()
+dep_type = glib_dep.type_name()
+if dep_type == 'internal'
+ g_ir_scanner_env.append('PKG_CONFIG_PATH', meson.global_build_root() + '/meson-uninstalled')
+ g_ir_scanner_env.set('PKG_CONFIG', pkg_config.full_path())
+endif
+
configure_file(
configuration: config,
output: 'config.h'
diff --git a/tests/meson.build b/tests/meson.build
index abb51f58..22b402b0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -56,6 +56,7 @@ test_gircompiler = find_program('g-ir-compiler', native: false, required : false
test_everything_files = custom_target('everything',
output: ['everything.h', 'everything.c'],
depends: typelibs,
+ env: g_ir_scanner_env,
command: [
test_girscanner,
'--quiet',
--
2.39.2

View File

@ -1,28 +0,0 @@
From 3163d96f47a62a20a343eb7af9d3c2931563a63d Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@centricular.com>
Date: Sat, 24 Feb 2024 14:14:19 -0300
Subject: [PATCH] build: Work around an undocumented GLib variable renaming
See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3892
---
gir/meson.build | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gir/meson.build b/gir/meson.build
index b732d24d..3a016831 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -155,7 +155,9 @@ elif dep_type == 'internal'
if giounix_dep.found()
glib_files += [
- glib_subproject.get_variable('glib_unix_h')
+ # Variable was renamed in 2.79.2
+ # https://gitlab.gnome.org/GNOME/glib/-/commit/1f9e44d6232c3e96caa8a96d9b1cc2c65cf5848c
+ glib_subproject.get_variable('glib_unix_headers')
]
endif
--
2.47.1

View File

@ -1,32 +0,0 @@
From dc33cdc1f9210d5f284bf115c4c66b55b38f79b9 Mon Sep 17 00:00:00 2001
From: Andoni Morales Alastruey <amorales@fluendo.com>
Date: Wed, 19 Jul 2023 15:21:42 +0200
Subject: [PATCH] gir: stop assuming glib source and build dirs using variables
---
gir/meson.build | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/gir/meson.build b/gir/meson.build
index 09714cc..59e03d6 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -134,14 +134,13 @@ elif dep_type == 'internal'
# XXX: This is a pile of hacks to allow gobject-introspection to parse the
# GLib source files when GLib is used as a subproject
# Assumes that the builddir layout is 'mirror'
- # Assumes the location of the glib subproject dir
# We should add API to meson to get a specific file from a specific
# subproject
# We know exactly what headers will be installed, so just fetch that
glib_subproject = subproject('glib')
- glibproj_sourcedir = join_paths(meson.global_source_root(), subprojdir, 'glib')
- glibproj_builddir = join_paths(meson.global_build_root(), subprojdir, 'glib')
+ glibproj_sourcedir = glib_subproject.get_variable('glib_source_dir', join_paths(meson.global_source_root(), subprojdir, 'glib'))
+ glibproj_builddir = glib_subproject.get_variable('glib_build_dir', join_paths(meson.global_build_root(), subprojdir, 'glib'))
glib_files += glib_subproject.get_variable('glib_types_h')
--
2.39.2

View File

@ -0,0 +1,52 @@
From 079cd66c77d53cdf5007002bd225658e221715c3 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Wed, 12 Feb 2025 20:32:59 +0530
Subject: [PATCH 3/9] girepository: Load typelibs from a relocatable prefix on
macOS
This is already relocatable on Windows.
---
girepository/girepository.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/girepository/girepository.c b/girepository/girepository.c
index 12eaf366..ca47cd55 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -125,6 +125,33 @@ DllMain (HINSTANCE hinstDLL,
g_build_filename (g_win32_get_package_installation_directory_of_module (girepository_dll), \
"lib", \
NULL)
+#elif defined(__APPLE__)
+
+#include <dlfcn.h>
+
+#undef GOBJECT_INTROSPECTION_LIBDIR
+#define GOBJECT_INTROSPECTION_LIBDIR _get_portable_libdir ()
+
+static char*
+_get_portable_libdir (void)
+{
+ char *path, *p;
+ Dl_info info;
+
+ /* Get the location of the current dylib */
+ if (!dladdr (_get_portable_libdir, &info))
+ return NULL;
+ path = strdup (info.dli_fname);
+
+ /* Get dylib directory: PREFIX/lib */
+ if ((p = strrchr (path, '/')) == NULL) {
+ free (path);
+ return NULL;
+ }
+ *p = '\0';
+
+ return path;
+}
#endif
--
2.47.0.windows.2

View File

@ -0,0 +1,26 @@
From a0b42aa4218bea84de902065f95d0e63bdb1c0d2 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@centricular.com>
Date: Wed, 4 Jun 2025 18:28:24 -0300
Subject: [PATCH 4/9] build: Fix b_vscrt value use without converting it to a
flag
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 7b8bf1c3..8e944824 100644
--- a/meson.build
+++ b/meson.build
@@ -96,7 +96,7 @@ if cc.get_argument_syntax() == 'msvc'
msvc_crt_cflag = b_vscrt == 'static_from_buildtype' ? '/MT' : '/MD'
endif
else
- msvc_crt_cflag = b_vscrt
+ msvc_crt_cflag = '/' + b_vscrt
endif
extra_giscanner_cflags += msvc_crt_cflag
extra_giscanner_args = ['--cflags-begin'] + extra_giscanner_cflags + ['--cflags-end']
--
2.47.0.windows.2

View File

@ -0,0 +1,48 @@
From 95125183cd7d45c37d49147ee913f06a603c871a Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@centricular.com>
Date: Thu, 26 Jun 2025 13:22:14 -0300
Subject: [PATCH 6/9] tests: Fix path parsing for Windows
---
tests/meson.build | 2 +-
tests/scanner/meson.build | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/meson.build b/tests/meson.build
index e82d79f9..7e4b9887 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -198,7 +198,7 @@ if (glib_dep.type_name() == 'pkgconfig' and
# FIXME: Remove? Those tests doesn't actually do anything for typelibs ...
foreach typelib : test_typelibs
gi_tester = files('gi-tester')
- typelib_name = typelib.full_path().split('/')[-1]
+ typelib_name = typelib.full_path().replace('\\', '/').split('/')[-1]
test(
'gi-tester' + typelib_name,
python,
diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build
index 5634ee4f..402547dc 100644
--- a/tests/scanner/meson.build
+++ b/tests/scanner/meson.build
@@ -587,7 +587,7 @@ endif
gi_tester = files(join_paths('..', 'gi-tester'))
foreach gir : test_girs
- gir_name = gir.full_path().split('/')[-1]
+ gir_name = gir.full_path().replace('\\', '/').split('/')[-1]
test(
'gi-tester-' + gir_name,
python,
@@ -663,7 +663,7 @@ if has_girdoctool and glib_dep.type_name() == 'pkgconfig'
endif
foreach typelib : test_typelibs
- typelib_name = typelib.full_path().split('/')[-1]
+ typelib_name = typelib.full_path().replace('\\', '/').split('/')[-1]
test(
'gi-tester-' + typelib_name,
python,
--
2.47.0.windows.2

View File

@ -0,0 +1,62 @@
From 67f5fc047ccdbfcc3396b42fba54e9f06db93382 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@centricular.com>
Date: Thu, 5 Jun 2025 12:25:14 -0300
Subject: [PATCH 7/9] g-ir-tools: Support reading @rspfiles for arguments
This is needed on Windows, where the argument list can exceed the
maximum command-line length when many cflags are being passed.
It is easily reproducible on GStreamer CI when g-ir-scanner
is being pulled from a wrap.
See https://gitlab.gnome.org/GNOME/glib/-/commit/17316b2c16cf17ae9692ed2733f776f1082e74e5
(cherry picked from commit b0daeaa67828a61af250b438dd918c01aad8457e)
---
tools/g-ir-tool-template.in | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index 469af0ca..648c9abc 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -100,5 +100,35 @@ from giscanner.utils import dll_dirs
dll_dirs = dll_dirs()
dll_dirs.add_dll_dirs(['gio-2.0'])
+def get_rspfile_args(rspfile):
+ '''
+ Response files are useful on Windows where there is a command-line character
+ limit of 8191 because when passing sources as arguments to glib-mkenums this
+ limit can be exceeded in large codebases.
+
+ There is no specification for response files and each tool that supports it
+ generally writes them out in slightly different ways, but some sources are:
+ https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-response-files
+ https://docs.microsoft.com/en-us/windows/desktop/midl/the-response-file-command
+ '''
+ import shlex
+ if not os.path.isfile(rspfile):
+ sys.exit('Response file {!r} does not exist'.format(rspfile))
+ try:
+ with open(rspfile, 'r') as f:
+ cmdline = f.read()
+ except OSError as e:
+ sys.exit('Response file {!r} could not be read: {}'
+ .format(rspfile, e.strerror))
+ return shlex.split(cmdline)
+
+
+# Support reading an rspfile of the form @filename which contains the args
+# to be parsed
+if sys.argv[-1].startswith('@'):
+ args = sys.argv[0:-1] + get_rspfile_args(sys.argv[-1][1:])
+else:
+ args = sys.argv
+
from giscanner.@TOOL_MODULE@ import @TOOL_FUNCTION@
-sys.exit(@TOOL_FUNCTION@(sys.argv))
+sys.exit(@TOOL_FUNCTION@(args))
--
2.47.0.windows.2

View File

@ -0,0 +1,54 @@
From c699e4a4106fdce2dccef5af15a2e7a54ed458fb Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@centricular.com>
Date: Thu, 26 Jun 2025 22:36:39 -0300
Subject: [PATCH 8/9] meson: Fix fs.copyfile semantics breaking GIR build with
Ninja 1.12+
Unlike configure_file, fs.copyfile runs at build time. This, along
with Ninja 1.12+'s stricter dependency semantics, means that all
GIR files built by g-i may not be available for other subprojects
in a subproject build.
This breaks harfbuzz wrap's GIR build inside GStreamer.
See https://github.com/ninja-build/ninja/releases/tag/v1.12.0
See https://mesonbuild.com/Release-notes-for-0-64-0.html#fscopyfile-to-replace-configure_filecopy-true
---
gir/meson.build | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gir/meson.build b/gir/meson.build
index a23c0a91..792faa73 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -1,4 +1,4 @@
-gir_files = [
+base_gir_files = [
{'name': 'DBus', 'file': 'DBus-1.0.gir' },
{'name': 'DBus-GLib', 'file': 'DBusGLib-1.0.gir' },
{'name': 'fontconfig', 'file': 'fontconfig-2.0.gir' },
@@ -18,8 +18,9 @@ uninstalled_gir_files = []
# Copy gir files to build directory to have them all in a single place.
# This is needed when gobject-introspection is a subproject because Meson
# will add --includedir pointing to build directory automatically.
-foreach gir: gir_files
- fs.copyfile(gir.get('file'))
+gir_files = []
+foreach gir: base_gir_files
+ gir_files += [{'name': gir.get('name'), 'file': fs.copyfile(gir.get('file'))}]
endforeach
cairo_conf = configuration_data()
@@ -49,7 +50,7 @@ gir_files += [{'name': 'cairo', 'file': cairo_gir}]
typelibdir = join_paths(get_option('libdir'), 'girepository-1.0')
installed_gir_files = []
-foreach gir: gir_files
+foreach gir: base_gir_files
installed_gir_files += gir.get('file')
endforeach
--
2.47.0.windows.2

View File

@ -0,0 +1,54 @@
From d664384d9c1f3ff85910035b08feb1204f3e48c2 Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@centricular.com>
Date: Fri, 27 Jun 2025 00:20:23 -0300
Subject: [PATCH 9/9] giscanner: Deduplicate arguments and use response files
for MSVC
Alleviates GStreamer CI crashing because deeply nested GIR modules
can exhaust CreateProcessW because of the number of duplicated flags
(mainly include flags), and distutils has no provision for it.
---
giscanner/ccompiler.py | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index 9c27cba7..9e2e2aed 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -390,11 +390,32 @@ class CCompiler(object):
includes.extend(include_paths)
extra_postargs.extend(extra_args)
- return self.compiler.compile(sources=source,
+ tmp = None
+
+ rsp_len = sum(len(i) + 1 for i in list(*source) + extra_postargs) + sum(len(i) + 3 for i in macros + includes)
+
+ # Serialize to a response file if CommandLineToArgW etc.
+ # can get overloaded. The limit is 32k but e.g. GStreamer's CI
+ # can pile up pretty quickly, so let's follow Meson here.
+ if self.check_is_msvc() and rsp_len >= 8192:
+ # There seems to be no provision for deduplication in higher layers
+ includes = list(set(includes))
+ macros = list(set(macros))
+ if extra_postargs:
+ tmp = tempfile.mktemp()
+ with open(tmp, 'w') as f:
+ f.write(' '.join(extra_postargs))
+ extra_postargs = [f'@{tmp}']
+
+ try:
+ return self.compiler.compile(sources=source,
macros=macros,
include_dirs=includes,
extra_postargs=extra_postargs,
output_dir=os.path.abspath(os.sep))
+ finally:
+ if tmp and not utils.have_debug_flag('save-temps'):
+ os.unlink(tmp)
def resolve_windows_libs(self, libraries, options):
args = []
--
2.47.0.windows.2