glib: update to 2.84.0.

Switch back to using dladdr to get libdir similar to the gobject-introspection
patch and similar to what is done with Windows and MacOS.
This commit is contained in:
oreo639 2025-03-21 18:19:05 -07:00 committed by oreo639
parent 3e714ad7ac
commit 70b7cfe280
5 changed files with 139 additions and 33 deletions

View file

@ -5,6 +5,5 @@
/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static ${GIR_EXTRA_OPTIONS} \
-L ${XBPS_CROSS_BASE} \
-E LD_LIBRARY_PATH="${XBPS_CROSS_BASE}/usr/lib:.libs:${GIR_EXTRA_LIBS_PATH}" \
-E GI_TYPELIB_SYSROOT="${XBPS_CROSS_BASE}" \
-U GIO_MODULE_DIR \
"$@"

View file

@ -1,34 +1,62 @@
Allow us to specify the typelib sysroot in wrapper scripts for cross compiling.
Instead of hard-coding GOBJECT_INTROSPECTION_LIBDIR when
gobject-introspection is built, use dladdr() to determine where
GOBJECT_INTROSPECTION_LIBDIR is and use that path to calculate the
repository directory.
This fixes gobject-introspection-native accessing paths across build
directories (e.g. if the build directories use the same shared state
cache or sstate mirror).
diff --git a/girepository/girepository.c b/girepository/girepository.c
index c1fa3d3..efa557e 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -154,6 +154,7 @@ gi_repository_init (GIRepository *reposi
const char *libdir;
char *typelib_dir;
const char *type_lib_path_env;
+ const char *type_lib_sysroot_env;
@@ -38,6 +40,8 @@
#include "gitypelib-internal.h"
#include "girepository-private.h"
/* This variable is intended to take precedence over both:
* - the default search path;
@@ -161,6 +162,9 @@ gi_repository_init (GIRepository *reposi
*/
type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
+ /* Void Linux addition for cross compiling, since we use cross sysroots */
+ type_lib_sysroot_env = g_getenv ("GI_TYPELIB_SYSROOT");
+#include <dlfcn.h>
+
if (type_lib_path_env)
{
char **custom_dirs;
@@ -176,7 +180,10 @@ gi_repository_init (GIRepository *reposi
libdir = GOBJECT_INTROSPECTION_LIBDIR;
- typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
+ if (type_lib_sysroot_env)
+ typelib_dir = g_build_filename (type_lib_sysroot_env, libdir, "girepository-1.0", NULL);
+ else
+ typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
g_ptr_array_add (repository->typelib_search_path, g_steal_pointer (&typelib_dir));
/**
* GIRepository:
*
@@ -260,7 +264,13 @@ gi_repository_get_libdir (void)
libdir = GOBJECT_INTROSPECTION_LIBDIR;
}
#else /* !G_PLATFORM_WIN32 && !__APPLE__ */
- libdir = GOBJECT_INTROSPECTION_LIBDIR;
+ Dl_info gi_lib_info;
+ if (dladdr (gi_repository_get_version, &gi_lib_info)) {
+ libdir = g_path_get_dirname (gi_lib_info.dli_fname);
+ g_ignore_leak (libdir);
+ } else {
+ libdir = GOBJECT_INTROSPECTION_LIBDIR;
+ }
#endif
g_once_init_leave_pointer (&static_libdir, libdir);
}
diff --git a/girepository/meson.build b/girepository/meson.build
index 6a8c5b5..8892f2a 100644
--- a/girepository/meson.build
+++ b/girepository/meson.build
@@ -139,7 +139,7 @@ libgirepository_internals = static_libra
c_args: gir_c_args + custom_c_args,
gnu_symbol_visibility : 'hidden',
include_directories : [configinc, girepoinc],
- dependencies: [girepo_gthash_dep, libffi_dep],
+ dependencies: [girepo_gthash_dep, libffi_dep, cc.find_library('dl')],
)
libgirepository_internals_dep = declare_dependency(
diff -rup glib-2.84.0/girepository/tests/repository-search-paths.c.orig glib-2.84.0/girepository/tests/repository-search-paths.c
--- a/girepository/tests/repository-search-paths.c
+++ a/girepository/tests/repository-search-paths.c
@@ -28,7 +28,7 @@ test_repository_search_paths_get_expecte
#if defined(G_PLATFORM_WIN32)
const char *tests_build_dir = g_getenv ("G_TEST_BUILDDIR");
char *expected_rel_path = g_build_filename (tests_build_dir, "lib", "girepository-1.0", NULL);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || 1
const char *tests_build_dir = g_getenv ("G_TEST_BUILDDIR");
char *expected_rel_path = g_build_filename (tests_build_dir, "..", "girepository-1.0", NULL);
#else /* !G_PLATFORM_WIN32 && !__APPLE__ */

View file

@ -0,0 +1,71 @@
From aee0664e6f1a29e0d5f301979f6d168b08435a61 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@gnome.org>
Date: Mon, 10 Mar 2025 15:21:15 +0000
Subject: [PATCH] girparser: Ignore new doc:format element in GIR files
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As of gobject-introspection 1.83.2, a new `<doc:format name="…"/>`
element is supported (as a child of `<repository>`) in GIR files.
For the moment, this information isnt needed in libgirepository — but
the GIR parser does have to know about the element in order to not throw
an error claiming its invalid.
This is a slightly tweaked version of the code added to
gobject-introspection.git in commit
9544cd6c962fab2c3203898779948309833e2439 by Corentin Noël
<corentin.noel@collabora.com>, reformatted slightly to fit in with
GLibs style guidelines.
This is backwards compatible and does not require a new
gobject-introspection version.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3634
---
girepository/girparser.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 63143718d9..be88d871a4 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -107,7 +107,8 @@ typedef enum
STATE_ALIAS,
STATE_TYPE,
STATE_ATTRIBUTE,
- STATE_PASSTHROUGH
+ STATE_PASSTHROUGH,
+ STATE_DOC_FORMAT, /* 35 */
} ParseState;
typedef struct _ParseContext ParseContext;
@@ -3159,6 +3160,11 @@ start_element_handler (GMarkupParseContext *context,
state_switch (ctx, STATE_PASSTHROUGH);
goto out;
}
+ else if (strcmp ("doc:format", element_name) == 0)
+ {
+ state_switch (ctx, STATE_DOC_FORMAT);
+ goto out;
+ }
break;
case 'e':
@@ -3843,6 +3849,10 @@ end_element_handler (GMarkupParseContext *context,
state_switch (ctx, ctx->prev_state);
}
break;
+ case STATE_DOC_FORMAT:
+ if (require_end_element (context, ctx, "doc:format", element_name, error))
+ state_switch (ctx, STATE_REPOSITORY);
+ break;
case STATE_PASSTHROUGH:
ctx->unknown_depth -= 1;
--
GitLab

View file

@ -1,7 +1,7 @@
# Template file for 'glib'
# keep in sync with glib-bootstrap
pkgname=glib
version=2.82.4
version=2.84.0
revision=1
build_style=meson
build_helper="qemu"
@ -11,7 +11,8 @@ configure_args="-Dman=true -Dselinux=disabled -Dintrospection=enabled
$(vopt_bool gtk_doc documentation) --default-library=both -Db_lto=false"
hostmakedepends="gettext pkg-config gobject-introspection-bootstrap
libxslt docbook-xsl $(vopt_if gtk_doc gi-docgen) python3-packaging python3-docutils"
makedepends="zlib-devel pcre2-devel libffi-devel dbus-devel elfutils-devel libmount-devel"
makedepends="zlib-devel pcre2-devel libffi-devel dbus-devel elfutils-devel libmount-devel
$(vopt_if gtk_doc gi-docgen)"
checkdepends="glib-bootstrap desktop-file-utils shared-mime-info dbus python3-pytest"
short_desc="GNU library of C routines"
maintainer="Orphaned <orphan@voidlinux.org>"
@ -20,7 +21,8 @@ homepage="https://wiki.gnome.org/Projects/GLib"
changelog="https://gitlab.gnome.org/GNOME/glib/raw/glib-2-82/NEWS"
#changelog="https://gitlab.gnome.org/GNOME/glib/raw/main/NEWS"
distfiles="${GNOME_SITE}/glib/${version%.*}/glib-${version}.tar.xz"
checksum=37dd0877fe964cd15e9a2710b044a1830fb1bd93652a6d0cb6b8b2dff187c709
checksum=f8823600cb85425e2815cfad82ea20fdaa538482ab74e7293d58b3f64a5aff6a
python_version=3
conflicts="gir-freedesktop<1.80.0_1" # glib typelibs are now in glib
make_check_pre="dbus-run-session"
@ -40,6 +42,12 @@ post_patch() {
fi
# Test fails in CI
vsed -e '/test_cleanup_handles_errors)/d' -i glib/tests/utils-isolated.c
if [ "$XBPS_TARGET_LIBC" = musl ]; then
# musl 1.1.x's implementation of faccessat is broken (doesn't behave correctly with AT_SYMLINK_NOFOLLOW)
# https://git.musl-libc.org/cgit/musl/commit/?id=55fb9a177316aa46c639d93dd0323d9a9a8c160c
vsed -e "s/'faccessat',//g" -i meson.build
fi
}
post_install() {

View file

@ -1 +1 @@
pattern="glib-[0-9]+\.[0-9]*[02468]\.[0-9]+"
pattern="[0-9]+\.[0-9]*[02468]\.[0-9]+"