From d12aff729ec2a9e71be77973c8e4eefa967d75fe Mon Sep 17 00:00:00 2001 From: oreo639 Date: Thu, 21 Mar 2024 12:53:54 -0700 Subject: [PATCH] glib: update to 2.80.0. This merges part of gobject-introspection tools, but not all of it. Unfortunately this creates a cyclic dependency between glib and gi. This is supposed to be temporary. https://discourse.gnome.org/t/dealing-with-glib-and-gobject-introspection-circular-dependency/18701 https://gitlab.gnome.org/GNOME/glib/-/issues/2616 https://docs.gtk.org/girepository/migrating-gi.html --- common/shlibs | 1 + srcpkgs/glib/files/gi-tool-emulator-wrapper | 12 ++ srcpkgs/glib/files/gi-xbps-qemuwrapper | 10 ++ ...pository-directory-for-native-builds.patch | 34 ++++ ...12bb095382770f000055f63f82e2903f6b33.patch | 47 ++++++ ...c379e85bacc89a7a8468f7e8447c8df15785.patch | 33 ++++ .../glib/patches/disable-broken-tests.patch | 67 -------- ...ea2ac9ca2e85321c5d34f8f40f7f9b614db1.patch | 91 ++++++++++ srcpkgs/glib/patches/fix-test-cxxcpp.patch | 26 --- ...er-Fix-race-between-source-callbacks.patch | 158 ------------------ srcpkgs/glib/template | 49 ++++-- 11 files changed, 263 insertions(+), 265 deletions(-) create mode 100755 srcpkgs/glib/files/gi-tool-emulator-wrapper create mode 100755 srcpkgs/glib/files/gi-xbps-qemuwrapper create mode 100644 srcpkgs/glib/patches/0001-Relocate-the-repository-directory-for-native-builds.patch create mode 100644 srcpkgs/glib/patches/014f12bb095382770f000055f63f82e2903f6b33.patch create mode 100644 srcpkgs/glib/patches/d2a6c379e85bacc89a7a8468f7e8447c8df15785.patch delete mode 100644 srcpkgs/glib/patches/disable-broken-tests.patch create mode 100644 srcpkgs/glib/patches/fa45ea2ac9ca2e85321c5d34f8f40f7f9b614db1.patch delete mode 100644 srcpkgs/glib/patches/fix-test-cxxcpp.patch delete mode 100644 srcpkgs/glib/patches/gthreadedresolver-Fix-race-between-source-callbacks.patch diff --git a/common/shlibs b/common/shlibs index 31a843e0030..4b88c10b0d3 100644 --- a/common/shlibs +++ b/common/shlibs @@ -102,6 +102,7 @@ libglib-2.0.so.0 glib-2.76.0_1 libgmodule-2.0.so.0 glib-2.76.0_1 libgio-2.0.so.0 glib-2.76.0_1 libgobject-2.0.so.0 glib-2.76.0_1 +libgrepository-2.0.so.0 glib-2.80.0_1 libwt.so.4.10.4 wt-4.10.4_1 libwtdbo.so.4.10.4 wt-4.10.4_1 libwtdbosqlite3.so.4.10.4 wt-4.10.4_1 diff --git a/srcpkgs/glib/files/gi-tool-emulator-wrapper b/srcpkgs/glib/files/gi-tool-emulator-wrapper new file mode 100755 index 00000000000..acf9715bf9f --- /dev/null +++ b/srcpkgs/glib/files/gi-tool-emulator-wrapper @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Check if we are running in an xbps-src environment and run the wrapper if that +# is the case. +if [ -n "$XBPS_CROSS_BASE" -a -n "$XBPS_TARGET_MACHINE" -a -n "$XBPS_VERSION" ]; then + # wrapper for @TOOL@, which runs the target version of it through qemu. + # gi-compile-repository, for example, writes out the raw content of a C struct to disk, + # and therefore is architecture dependent. + exec /usr/bin/gi-xbps-qemuwrapper ${XBPS_CROSS_BASE}/usr/bin/@TOOL@.wrapped "$@" +fi + +exec /usr/bin/@TOOL@.wrapped "$@" diff --git a/srcpkgs/glib/files/gi-xbps-qemuwrapper b/srcpkgs/glib/files/gi-xbps-qemuwrapper new file mode 100755 index 00000000000..665eae0e936 --- /dev/null +++ b/srcpkgs/glib/files/gi-xbps-qemuwrapper @@ -0,0 +1,10 @@ +#!/bin/sh + +# Ensure GIO_MODULE_DIR is not set so we don't load random things +# which may then get deleted (or their dependencies) and potentially segfault +/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 \ + "$@" diff --git a/srcpkgs/glib/patches/0001-Relocate-the-repository-directory-for-native-builds.patch b/srcpkgs/glib/patches/0001-Relocate-the-repository-directory-for-native-builds.patch new file mode 100644 index 00000000000..66bf4240e7c --- /dev/null +++ b/srcpkgs/glib/patches/0001-Relocate-the-repository-directory-for-native-builds.patch @@ -0,0 +1,34 @@ +Allow us to specify the typelib sysroot in wrapper scripts for cross compiling. + +--- 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; + + /* 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"); ++ + 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)); + } diff --git a/srcpkgs/glib/patches/014f12bb095382770f000055f63f82e2903f6b33.patch b/srcpkgs/glib/patches/014f12bb095382770f000055f63f82e2903f6b33.patch new file mode 100644 index 00000000000..615f9681e42 --- /dev/null +++ b/srcpkgs/glib/patches/014f12bb095382770f000055f63f82e2903f6b33.patch @@ -0,0 +1,47 @@ +From 014f12bb095382770f000055f63f82e2903f6b33 Mon Sep 17 00:00:00 2001 +From: q66 +Date: Sat, 23 Mar 2024 20:51:52 +0100 +Subject: [PATCH] Use CPU_COUNT to get the number of set CPUs + +This fixes an issue with the number getting very big due to +CPU_ISSET not returning exactly 0 or 1. + +This also fixes scenarios where there are holes in the CPU +set. E.g. for a simple run like `taskset --cpu-list 1,2,4 ...` +the old code would return 2 instead of 3, due to iterating +until `ncores` (which is 3) and therefore not accounting for +CPUs further in the set. + +Ref https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3784 + + +(cherry picked from commit cc25486b233ada380ac8452f47f5fb35536888f4) +--- + glib/gthread.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/glib/gthread.c b/glib/gthread.c +index b39acc475c..a264353ecb 100644 +--- a/glib/gthread.c ++++ b/glib/gthread.c +@@ -1092,7 +1092,6 @@ g_get_num_processors (void) + return count; + #elif defined(_SC_NPROCESSORS_ONLN) && defined(THREADS_POSIX) && defined(HAVE_PTHREAD_GETAFFINITY_NP) + { +- int idx; + int ncores = MIN (sysconf (_SC_NPROCESSORS_ONLN), CPU_SETSIZE); + cpu_set_t cpu_mask; + CPU_ZERO (&cpu_mask); +@@ -1100,8 +1099,7 @@ g_get_num_processors (void) + int af_count = 0; + int err = pthread_getaffinity_np (pthread_self (), sizeof (cpu_mask), &cpu_mask); + if (!err) +- for (idx = 0; idx < ncores && idx < CPU_SETSIZE; ++idx) +- af_count += CPU_ISSET (idx, &cpu_mask); ++ af_count = CPU_COUNT (&cpu_mask); + + int count = (af_count > 0) ? af_count : ncores; + return count; +-- +GitLab + diff --git a/srcpkgs/glib/patches/d2a6c379e85bacc89a7a8468f7e8447c8df15785.patch b/srcpkgs/glib/patches/d2a6c379e85bacc89a7a8468f7e8447c8df15785.patch new file mode 100644 index 00000000000..1de85c881c5 --- /dev/null +++ b/srcpkgs/glib/patches/d2a6c379e85bacc89a7a8468f7e8447c8df15785.patch @@ -0,0 +1,33 @@ +From d2a6c379e85bacc89a7a8468f7e8447c8df15785 Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Fri, 15 Mar 2024 13:49:47 +0000 +Subject: [PATCH] girparser: Don't assume sizeof(size_t) == sizeof(void *) + +We don't actually need to use the results of configure-time checks here: +sizeof is a perfectly reasonable integer constant expression, so we can +use that directly. + +Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842 +Signed-off-by: Simon McVittie +--- + girepository/girparser.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/girepository/girparser.c b/girepository/girparser.c +index 647cf2498d..b5d8fc7108 100644 +--- a/girepository/girparser.c ++++ b/girepository/girparser.c +@@ -459,8 +459,8 @@ static IntegerAliasInfo integer_aliases[] = { + { "gulong", SIZEOF_LONG, 0 }, + { "gssize", GLIB_SIZEOF_SIZE_T, 1 }, + { "gsize", GLIB_SIZEOF_SIZE_T, 0 }, +- { "gintptr", GLIB_SIZEOF_SIZE_T, 1 }, +- { "guintptr", GLIB_SIZEOF_SIZE_T, 0 }, ++ { "gintptr", sizeof (gintptr), 1 }, ++ { "guintptr", sizeof (guintptr), 0 }, + }; + + typedef struct { +-- +GitLab + diff --git a/srcpkgs/glib/patches/disable-broken-tests.patch b/srcpkgs/glib/patches/disable-broken-tests.patch deleted file mode 100644 index f6e0328b214..00000000000 --- a/srcpkgs/glib/patches/disable-broken-tests.patch +++ /dev/null @@ -1,67 +0,0 @@ ---- a/gio/tests/meson.build -+++ b/gio/tests/meson.build -@@ -63,7 +63,6 @@ gio_tests = { - # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 / https://gitlab.gnome.org/GNOME/glib/-/issues/1251 - 'can_fail' : host_system == 'darwin', - }, -- 'converter-stream' : {}, - 'credentials' : {}, - 'data-input-stream' : {}, - 'data-output-stream' : {}, -@@ -227,7 +226,6 @@ endif - # Test programs buildable on UNIX only - if host_machine.system() != 'windows' - gio_tests += { -- 'file' : {}, - 'gdbus-peer-object-manager' : {}, - 'gdbus-sasl' : {}, - 'live-g-file' : {}, -@@ -951,13 +949,6 @@ if not meson.is_cross_build() - test_resources_binary2, - ] - endif -- -- gio_tests += { -- 'resources' : { -- 'extra_sources' : resources_extra_sources, -- 'depends' : resource_plugin, -- }, -- } - endif - - test_extra_programs_targets = {} -diff --git a/glib/tests/meson.build b/glib/tests/meson.build -index d74617823..1de81a825 100644 ---- a/glib/tests/meson.build -+++ b/glib/tests/meson.build -@@ -12,22 +12,14 @@ glib_tests = { - 'cache' : {}, - 'charset' : {}, - 'checksum' : {}, -- 'collate' : {}, - 'completion' : {}, - 'cond' : {}, -- 'convert' : {}, - 'dataset' : {}, -- 'date' : { -- # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 -- 'can_fail' : host_system == 'darwin', -- }, - 'dir' : {}, - 'environment' : { - # FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392 - 'can_fail' : host_system == 'darwin', - }, -- 'error' : {}, -- 'fileutils' : {}, - 'gdatetime' : { - 'suite' : ['slow'], - 'can_fail' : host_system == 'windows', -@@ -70,7 +62,6 @@ glib_tests = { - 'node' : {}, - 'once' : {}, - 'onceinit' : {}, -- 'option-context' : {}, - 'option-argv0' : {}, - 'overflow' : {}, - 'overflow-fallback' : { diff --git a/srcpkgs/glib/patches/fa45ea2ac9ca2e85321c5d34f8f40f7f9b614db1.patch b/srcpkgs/glib/patches/fa45ea2ac9ca2e85321c5d34f8f40f7f9b614db1.patch new file mode 100644 index 00000000000..59e3904ed27 --- /dev/null +++ b/srcpkgs/glib/patches/fa45ea2ac9ca2e85321c5d34f8f40f7f9b614db1.patch @@ -0,0 +1,91 @@ +From fa45ea2ac9ca2e85321c5d34f8f40f7f9b614db1 Mon Sep 17 00:00:00 2001 +From: Simon McVittie +Date: Fri, 15 Mar 2024 13:56:20 +0000 +Subject: [PATCH] girparser: Allow time_t, off_t, etc. to appear in GIR XML + +g-ir-scanner currently maps these to lower-level types at scan time by +assuming that time_t is an alias for long, off_t is an alias for size_t +and so on. This is not always accurate: some ILP32 architectures have +64-bit time_t (for Y2038 compatibility) and 64-bit off_t (for large file +support), and that mismatch is tracked as GNOME/gobject-introspection#494. + +One option for resolving this g-ir-scanner bug is to have it pass these +types through to the GIR XML, and teach g-ir-compiler and its replacement +gi-compile-repository to convert them to the corresponding concrete +type tag, as they already do for abstract types such as `long long` and +`size_t`. + +Loosely based on GNOME/gobject-introspection!451 by Shuyu Liu. + +Co-authored-by: Shuyu Liu +Signed-off-by: Simon McVittie +--- + girepository/girparser.c | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/girepository/girparser.c b/girepository/girparser.c +index b5d8fc7108..9667900826 100644 +--- a/girepository/girparser.c ++++ b/girepository/girparser.c +@@ -32,6 +32,12 @@ + #include + #include + #include ++#include /* For time_t */ ++#include /* For off_t on both Unix and Windows */ ++ ++#ifdef G_OS_UNIX ++#include /* For socklen_t */ ++#endif + + /* This is a "major" version in the sense that it's only bumped + * for incompatible changes. +@@ -448,6 +454,19 @@ typedef struct { + unsigned int is_signed : 1; + } IntegerAliasInfo; + ++/* Ignore warnings from use of signedness() */ ++#if G_GNUC_CHECK_VERSION(4, 6) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wtype-limits" ++#elif defined(__clang__) ++#pragma clang diagnostic push ++#pragma clang diagnostic ignored "-Wtype-limits" ++#endif ++ ++#define signedness(T) (((T) -1) < 0) ++G_STATIC_ASSERT (signedness (int) == 1); ++G_STATIC_ASSERT (signedness (unsigned int) == 0); ++ + static IntegerAliasInfo integer_aliases[] = { + { "gchar", SIZEOF_CHAR, 1 }, + { "guchar", SIZEOF_CHAR, 0 }, +@@ -461,8 +480,25 @@ static IntegerAliasInfo integer_aliases[] = { + { "gsize", GLIB_SIZEOF_SIZE_T, 0 }, + { "gintptr", sizeof (gintptr), 1 }, + { "guintptr", sizeof (guintptr), 0 }, ++#define INTEGER_ALIAS(T) { #T, sizeof (T), signedness (T) } ++ INTEGER_ALIAS (off_t), ++ INTEGER_ALIAS (time_t), ++#ifdef G_OS_UNIX ++ INTEGER_ALIAS (dev_t), ++ INTEGER_ALIAS (gid_t), ++ INTEGER_ALIAS (pid_t), ++ INTEGER_ALIAS (socklen_t), ++ INTEGER_ALIAS (uid_t), ++#endif ++#undef INTEGER_ALIAS + }; + ++#if G_GNUC_CHECK_VERSION(4, 6) ++#pragma GCC diagnostic pop ++#elif defined(__clang__) ++#pragma clang diagnostic pop ++#endif ++ + typedef struct { + const char *str; + int tag; +-- +GitLab + diff --git a/srcpkgs/glib/patches/fix-test-cxxcpp.patch b/srcpkgs/glib/patches/fix-test-cxxcpp.patch deleted file mode 100644 index 2b1ad5b4e6a..00000000000 --- a/srcpkgs/glib/patches/fix-test-cxxcpp.patch +++ /dev/null @@ -1,26 +0,0 @@ -Fails to build on musl. -../glib/tests/cxx.cpp:509:15: error: missing sentinel in function call [-Werror=format=] -g_test_init (&argc, &argv, NULL); - ---- a/glib/tests/cxx.cpp -+++ a/glib/tests/cxx.cpp -@@ -505,7 +505,7 @@ test_string_free (void) - int - main (int argc, char *argv[]) - { - #if G_CXX_STD_CHECK_VERSION (11) -- g_test_init (&argc, &argv, NULL); -+ g_test_init (&argc, &argv, nullptr); - #else - g_test_init (&argc, &argv, static_cast(NULL)); ---- a/gio/tests/cxx.cpp -+++ a/gio/tests/cxx.cpp -@@ -59,7 +59,7 @@ int - main (int argc, char **argv) - { - #if G_CXX_STD_CHECK_VERSION (11) -- g_test_init (&argc, &argv, NULL); -+ g_test_init (&argc, &argv, nullptr); - #else - g_test_init (&argc, &argv, static_cast(NULL)); - #endif diff --git a/srcpkgs/glib/patches/gthreadedresolver-Fix-race-between-source-callbacks.patch b/srcpkgs/glib/patches/gthreadedresolver-Fix-race-between-source-callbacks.patch deleted file mode 100644 index 17de85b15bd..00000000000 --- a/srcpkgs/glib/patches/gthreadedresolver-Fix-race-between-source-callbacks.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Philip Withnall -Date: Mon, 11 Sep 2023 16:02:15 +0100 -Subject: [PATCH] gthreadedresolver: Fix race between source callbacks and - finalize -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -I had thought that because `g_source_destroy()` was called for the two -sources (cancel and timeout) in the `GTask` finalize function for a -threaded resolver operation, that it would be fine to use a plain -pointer in the source callbacks to point to the `GTask`. - -That turns out to not be true: because the source callbacks are executed -in the GLib worker thread, and the `GTask` can be finalized in another -thread, it’s possible for a source callback (e.g. `cancelled_cb()`) to -be scheduled in the worker thread, then for the `GTask` to be finalized, -and then the source callback to continue execution and find itself -doing a use-after-free. - -Fix that by using a weak ref to the `GTask` in the source callbacks, -rather than a plain pointer. - -Signed-off-by: Philip Withnall - -Fixes: #3105 ---- - gio/gthreadedresolver.c | 43 +++++++++++++++++++++++++++++++++++------ - 1 file changed, 37 insertions(+), 6 deletions(-) - -diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c -index 2d94531bfda3..c7a567549f28 100644 ---- a/gio/gthreadedresolver.c -+++ b/gio/gthreadedresolver.c -@@ -1422,85 +1422,116 @@ lookup_records_finish (GResolver *resolver, - static gboolean - timeout_cb (gpointer user_data) - { -- GTask *task = G_TASK (user_data); -- LookupData *data = g_task_get_task_data (task); -+ GWeakRef *weak_task = user_data; -+ GTask *task = NULL; /* (owned) */ -+ LookupData *data; - gboolean should_return; - -+ task = g_weak_ref_get (weak_task); -+ if (task == NULL) -+ return G_SOURCE_REMOVE; -+ -+ data = g_task_get_task_data (task); -+ - g_mutex_lock (&data->lock); - - should_return = g_atomic_int_compare_and_exchange (&data->will_return, NOT_YET, TIMED_OUT); - g_clear_pointer (&data->timeout_source, g_source_unref); - - g_mutex_unlock (&data->lock); - - if (should_return) - g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_TIMED_OUT, - _("Socket I/O timed out")); - - /* Signal completion of the task. */ - g_mutex_lock (&data->lock); - data->has_returned = TRUE; - g_cond_broadcast (&data->cond); - g_mutex_unlock (&data->lock); - -+ g_object_unref (task); -+ - return G_SOURCE_REMOVE; - } - - /* Will be called in the GLib worker thread, so must lock all accesses to shared - * data. */ - static gboolean - cancelled_cb (GCancellable *cancellable, - gpointer user_data) - { -- GTask *task = G_TASK (user_data); -- LookupData *data = g_task_get_task_data (task); -+ GWeakRef *weak_task = user_data; -+ GTask *task = NULL; /* (owned) */ -+ LookupData *data; - gboolean should_return; - -+ task = g_weak_ref_get (weak_task); -+ if (task == NULL) -+ return G_SOURCE_REMOVE; -+ -+ data = g_task_get_task_data (task); -+ - g_mutex_lock (&data->lock); - - g_assert (g_cancellable_is_cancelled (cancellable)); - should_return = g_atomic_int_compare_and_exchange (&data->will_return, NOT_YET, CANCELLED); - g_clear_pointer (&data->cancellable_source, g_source_unref); - - g_mutex_unlock (&data->lock); - - if (should_return) - g_task_return_error_if_cancelled (task); - - /* Signal completion of the task. */ - g_mutex_lock (&data->lock); - data->has_returned = TRUE; - g_cond_broadcast (&data->cond); - g_mutex_unlock (&data->lock); - -+ g_object_unref (task); -+ - return G_SOURCE_REMOVE; - } - -+static void -+weak_ref_clear_and_free (GWeakRef *weak_ref) -+{ -+ g_weak_ref_clear (weak_ref); -+ g_free (weak_ref); -+} -+ - static void - run_task_in_thread_pool_async (GThreadedResolver *self, - GTask *task) - { - LookupData *data = g_task_get_task_data (task); - guint timeout_ms = g_resolver_get_timeout (G_RESOLVER (self)); - GCancellable *cancellable = g_task_get_cancellable (task); - - g_mutex_lock (&data->lock); - - g_thread_pool_push (self->thread_pool, g_object_ref (task), NULL); - - if (timeout_ms != 0) - { -+ GWeakRef *weak_task = g_new0 (GWeakRef, 1); -+ g_weak_ref_set (weak_task, task); -+ - data->timeout_source = g_timeout_source_new (timeout_ms); - g_source_set_static_name (data->timeout_source, "[gio] threaded resolver timeout"); -- g_source_set_callback (data->timeout_source, G_SOURCE_FUNC (timeout_cb), task, NULL); -+ g_source_set_callback (data->timeout_source, G_SOURCE_FUNC (timeout_cb), g_steal_pointer (&weak_task), (GDestroyNotify) weak_ref_clear_and_free); - g_source_attach (data->timeout_source, GLIB_PRIVATE_CALL (g_get_worker_context) ()); - } - - if (cancellable != NULL) - { -+ GWeakRef *weak_task = g_new0 (GWeakRef, 1); -+ g_weak_ref_set (weak_task, task); -+ - data->cancellable_source = g_cancellable_source_new (cancellable); - g_source_set_static_name (data->cancellable_source, "[gio] threaded resolver cancellable"); -- g_source_set_callback (data->cancellable_source, G_SOURCE_FUNC (cancelled_cb), task, NULL); -+ g_source_set_callback (data->cancellable_source, G_SOURCE_FUNC (cancelled_cb), g_steal_pointer (&weak_task), (GDestroyNotify) weak_ref_clear_and_free); - g_source_attach (data->cancellable_source, GLIB_PRIVATE_CALL (g_get_worker_context) ()); - } - diff --git a/srcpkgs/glib/template b/srcpkgs/glib/template index 8cbde21cc60..f7f4acbe63e 100644 --- a/srcpkgs/glib/template +++ b/srcpkgs/glib/template @@ -1,30 +1,36 @@ # Template file for 'glib' +# keep in sync with glib-bootstrap pkgname=glib -version=2.78.0 -revision=3 +version=2.80.0 +revision=1 build_style=meson +build_helper=qemu # static version is necessary for qemu-user-static; # also disable LTO, otherwise there are multiple failures when linking qemu -configure_args="-Dman=true -Dselinux=disabled - $(vopt_bool gtk_doc gtk_doc) --default-library=both -Db_lto=false" -hostmakedepends="gettext pkg-config libxslt docbook-xsl $(vopt_if gtk_doc gtk-doc)" +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" checkdepends="desktop-file-utils shared-mime-info dbus python3-pytest" short_desc="GNU library of C routines" maintainer="Orphaned " license="LGPL-2.1-or-later" homepage="https://wiki.gnome.org/Projects/GLib" -#changelog="https://gitlab.gnome.org/GNOME/glib/raw/glib-2-78/NEWS" +#changelog="https://gitlab.gnome.org/GNOME/glib/raw/glib-2-80/NEWS" changelog="https://gitlab.gnome.org/GNOME/glib/raw/main/NEWS" distfiles="${GNOME_SITE}/glib/${version%.*}/glib-${version}.tar.xz" -checksum=44eaab8b720877ce303c5540b657b126f12dc94972d9880b52959f43fb537b30 +checksum=8228a92f92a412160b139ae68b6345bd28f24434a7b5af150ebe21ff587a561d +conflicts="gir-freedesktop<1.80.0_1" # glib typelibs are now in glib make_check_pre="dbus-run-session" build_options="gtk_doc" -desc_option_gtk_doc="Build GTK API docs" +build_options_default="gtk_doc" +desc_option_gtk_doc="Build Glib API docs" -if [ -z "$CROSS_BUILD" ]; then - build_options_default+=" gtk_doc" +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" prelink-cross" + makedepends+=" gobject-introspection-bootstrap" fi post_patch() { @@ -34,6 +40,18 @@ post_patch() { fi } +post_install() { + # Install introspection wrappers for cross compiling + vbin ${FILESDIR}/gi-xbps-qemuwrapper + + # Install emulator wrappers for tools that require it + for tool in gi-compile-repository gi-decompile-typelib gi-inspect-typelib; do + mv ${DESTDIR}/usr/bin/${tool}{,.wrapped} + sed -e "s|@TOOL@|${tool}|" ${FILESDIR}/gi-tool-emulator-wrapper > gi-tool-emulator-wrapper + vbin gi-tool-emulator-wrapper ${tool} + done +} + pre_check() { # machine-id is a random, non-zero value echo 'dcb30309cd6c8b7cc20383d85a5c7012' > /etc/machine-id @@ -44,11 +62,13 @@ post_check() { } libglib-devel_package() { - depends="${makedepends} ${sourcepkg}>=${version}_${revision}" + depends="${makedepends/gobject-introspection-bootstrap/} ${sourcepkg}>=${version}_${revision}" + conflicts="libgirepository-devel<1.80.0_1" short_desc+=" - development files" lib32files="/usr/lib/glib-2.0/include/glibconfig.h" pkg_install() { vmove usr/include + vmove usr/share/gir-1.0 vmove usr/lib/glib-2.0 vmove usr/lib/pkgconfig vmove "usr/lib/*.so" @@ -57,7 +77,7 @@ libglib-devel_package() { } glib-devel_package() { - depends="python3-setuptools libglib-devel>=${version}_${revision}" + depends="python3-packaging libglib-devel>=${version}_${revision}" short_desc+=" - development files" python_version=3 pycompile_dirs="usr/share/glib-2.0/codegen usr/share/glib-2.0/gdb" @@ -69,6 +89,7 @@ glib-devel_package() { vmove usr/bin/gdbus-codegen vmove usr/bin/gtester vmove usr/bin/glib-gettextize + vmove "usr/bin/gi-*" vmove usr/share/man/man1/glib-compile-resources.1 vmove usr/share/man/man1/glib-gettextize.1 vmove usr/share/man/man1/gtester.1 @@ -79,8 +100,8 @@ glib-devel_package() { for f in aclocal glib-2.0 gdb; do vmove usr/share/${f} done - if [ -d $DESTDIR/usr/share/gtk-doc ]; then - vmove usr/share/gtk-doc + if [ "$build_option_gtk_doc" ]; then + vmove usr/share/doc fi } }