summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/accountsservice-extensions.patch5
-rw-r--r--gnu/packages/patches/appstream-force-reload-stemmer.patch89
-rw-r--r--gnu/packages/patches/ath9k-htc-firmware-objcopy.patch14
-rw-r--r--gnu/packages/patches/calls-disable-application-test.patch72
-rw-r--r--gnu/packages/patches/calls-disable-sip-test.patch44
-rw-r--r--gnu/packages/patches/chez-scheme-backport-configure.patch463
-rw-r--r--gnu/packages/patches/chez-scheme-bin-sh.patch37
-rw-r--r--gnu/packages/patches/clang-18.0-libc-search-path.patch90
-rw-r--r--gnu/packages/patches/cogl-fix-double-free.patch32
-rw-r--r--gnu/packages/patches/duc-fix-test-sh.patch70
-rw-r--r--gnu/packages/patches/durden-shadow-arcan.patch42
-rw-r--r--gnu/packages/patches/emacs-disable-jit-compilation.patch19
-rw-r--r--gnu/packages/patches/emacs-native-comp-fix-filenames.patch338
-rw-r--r--gnu/packages/patches/feedbackd-use-system-gmobile.patch42
-rw-r--r--gnu/packages/patches/ffmpeg-jami-pipewiregrab-source-filter.patch1451
-rw-r--r--gnu/packages/patches/gcc-13-cross-system-header-dir.patch32
-rw-r--r--gnu/packages/patches/gdm-elogind-support.patch93
-rw-r--r--gnu/packages/patches/gegl-compatibility-old-librsvg.patch80
-rw-r--r--gnu/packages/patches/gitg-fix-positional-argument.patch36
-rw-r--r--gnu/packages/patches/glib-networking-gnutls-binding.patch21
-rw-r--r--gnu/packages/patches/glib-skip-failing-test.patch3
-rw-r--r--gnu/packages/patches/glslang-install-static-libs.patch61
-rw-r--r--gnu/packages/patches/gmobile-make-it-installable.patch89
-rw-r--r--gnu/packages/patches/gnome-control-center-firmware-security.patch33
-rw-r--r--gnu/packages/patches/gtk2-harden-list-store.patch42
-rw-r--r--gnu/packages/patches/gwenview-kimageannotator.patch29
-rw-r--r--gnu/packages/patches/jami-qml-tests-discovery.patch15
-rw-r--r--gnu/packages/patches/jami-qwindowkit.patch37
-rw-r--r--gnu/packages/patches/jami-tests-qtwebengine-ifdef-to-if.patch26
-rw-r--r--gnu/packages/patches/jami-unbundle-dependencies.patch6
-rw-r--r--gnu/packages/patches/libarchive-remove-potential-backdoor.patch47
-rw-r--r--gnu/packages/patches/libcall-ui-make-it-installable.patch81
-rw-r--r--gnu/packages/patches/libgda-disable-data-proxy-test.patch59
-rw-r--r--gnu/packages/patches/librecad-support-for-boost-1.76.patch17
-rw-r--r--gnu/packages/patches/mm-common-reproducible-tarball.patch40
-rw-r--r--gnu/packages/patches/mutter-fix-inverted-test.patch290
-rw-r--r--gnu/packages/patches/nautilus-extension-search-path.patch64
-rw-r--r--gnu/packages/patches/opencolorio-fix-build-with-gcc11.patch37
-rw-r--r--gnu/packages/patches/openssh-gcc-13-ppc64le-fzero-call-used-regs.patch61
-rw-r--r--gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch40
-rw-r--r--gnu/packages/patches/pdfpc-build-with-vala-0.56.patch40
-rw-r--r--gnu/packages/patches/qtbase-find-tools-in-PATH.patch49
-rw-r--r--gnu/packages/patches/qtbase-qmake-fix-includedir.patch29
-rw-r--r--gnu/packages/patches/qtbase-qmlimportscanner-qml-import-path.patch33
-rw-r--r--gnu/packages/patches/qtbase-use-TZDIR.patch141
-rw-r--r--gnu/packages/patches/qtdeclarative-disable-qmlcache.patch27
-rw-r--r--gnu/packages/patches/racket-backport-8.11-layered-docs.patch36
-rw-r--r--gnu/packages/patches/racket-backport-8.12-chez-configure.patch423
-rw-r--r--gnu/packages/patches/racket-chez-scheme-bin-sh.patch21
-rw-r--r--gnu/packages/patches/racket-rktio-bin-sh.patch17
-rw-r--r--gnu/packages/patches/shared-mime-info-xdgmime-path.patch22
-rw-r--r--gnu/packages/patches/xgboost-use-system-dmlc-core.patch14
-rw-r--r--gnu/packages/patches/zathura-use-struct-initializers.patch68
-rw-r--r--gnu/packages/patches/zuo-bin-sh.patch (renamed from gnu/packages/patches/racket-zuo-bin-sh.patch)33
54 files changed, 4189 insertions, 911 deletions
diff --git a/gnu/packages/patches/accountsservice-extensions.patch b/gnu/packages/patches/accountsservice-extensions.patch
index 2cfab580e3..8027a28a44 100644
--- a/gnu/packages/patches/accountsservice-extensions.patch
+++ b/gnu/packages/patches/accountsservice-extensions.patch
@@ -5,7 +5,7 @@ diff --git a/src/extensions.c b/src/extensions.c
index 038dcb2..830465d 100644
--- a/src/extensions.c
+++ b/src/extensions.c
-@@ -121,16 +121,7 @@ daemon_read_extension_directory (GHashTable *ifaces,
+@@ -122,15 +122,7 @@ daemon_read_extension_directory (GHashTable *ifaces,
continue;
}
@@ -13,8 +13,7 @@ index 038dcb2..830465d 100644
- const gchar * const prefix = "../../dbus-1/interfaces/";
- if (g_str_has_prefix (symlink, prefix) && g_str_equal (symlink + strlen (prefix), name)) {
- daemon_read_extension_file (ifaces, filename);
-- }
-- else {
+- } else {
- g_warning ("Found accounts service vendor extension symlink %s, but it must be exactly "
- "equal to '../../dbus-1/interfaces/%s' for forwards-compatibility reasons.",
- filename, name);
diff --git a/gnu/packages/patches/appstream-force-reload-stemmer.patch b/gnu/packages/patches/appstream-force-reload-stemmer.patch
new file mode 100644
index 0000000000..a2cf84c8b1
--- /dev/null
+++ b/gnu/packages/patches/appstream-force-reload-stemmer.patch
@@ -0,0 +1,89 @@
+From 32182d7a7a67d0d204cd0a37bd211bfd0177bc27 Mon Sep 17 00:00:00 2001
+Message-ID: <32182d7a7a67d0d204cd0a37bd211bfd0177bc27.1700093066.git.vivien@planete-kraus.eu>
+From: Matthias Klumpp <matthias@tenstral.net>
+Date: Thu, 16 Nov 2023 00:59:15 +0100
+Subject: [PATCH] stemmer: Resolve potential issue where stemmer may never be
+ initialized
+
+If the initial locale was equal to the current stemming language, we may
+never have initialized the stemmer (which could lead to crashes or
+stemming being disabled).
+
+So we force the reload to always happen on initialization.
+CC: #558
+---
+ src/as-stemmer.c | 33 +++++++++++++++++++++------------
+ 1 file changed, 21 insertions(+), 12 deletions(-)
+
+diff --git a/src/as-stemmer.c b/src/as-stemmer.c
+index 63d45267..16ebd09b 100644
+--- a/src/as-stemmer.c
++++ b/src/as-stemmer.c
+@@ -47,6 +47,8 @@ G_DEFINE_TYPE (AsStemmer, as_stemmer, G_TYPE_OBJECT)
+
+ static gpointer as_stemmer_object = NULL;
+
++static void as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force);
++
+ /**
+ * as_stemmer_finalize:
+ **/
+@@ -76,21 +78,14 @@ as_stemmer_init (AsStemmer *stemmer)
+
+ /* we don't use the locale in XML, so it can be POSIX */
+ locale = as_get_current_locale_posix ();
+- stemmer->current_lang = as_utils_locale_to_language (locale);
+
+- as_stemmer_reload (stemmer, stemmer->current_lang);
++ /* force a reload for initialization */
++ as_stemmer_reload_internal (stemmer, locale, TRUE);
+ #endif
+ }
+
+-/**
+- * as_stemmer_reload:
+- * @stemmer: A #AsStemmer
+- * @locale: The stemming language as POSIX locale.
+- *
+- * Allows realoading the #AsStemmer with a different language.
+- */
+-void
+-as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++static void
++as_stemmer_reload_internal (AsStemmer *stemmer, const gchar *locale, gboolean force)
+ {
+ #ifdef HAVE_STEMMING
+ g_autofree gchar *lang = NULL;
+@@ -99,7 +94,7 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ /* check if we need to reload */
+ lang = as_utils_locale_to_language (locale);
+ locker = g_mutex_locker_new (&stemmer->mutex);
+- if (as_str_equal0 (lang, stemmer->current_lang)) {
++ if (!force && as_str_equal0 (lang, stemmer->current_lang)) {
+ g_mutex_locker_free (locker);
+ return;
+ }
+@@ -119,6 +114,20 @@ as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
+ #endif
+ }
+
++/**
++ * as_stemmer_reload:
++ * @stemmer: A #AsStemmer
++ * @locale: The stemming language as POSIX locale.
++ *
++ * Allows realoading the #AsStemmer with a different language.
++ * Does nothing if the stemmer is already using the selected language.
++ */
++void
++as_stemmer_reload (AsStemmer *stemmer, const gchar *locale)
++{
++ as_stemmer_reload_internal (stemmer, locale, FALSE);
++}
++
+ /**
+ * as_stemmer_stem:
+ * @stemmer: A #AsStemmer
+--
+2.41.0
+
diff --git a/gnu/packages/patches/ath9k-htc-firmware-objcopy.patch b/gnu/packages/patches/ath9k-htc-firmware-objcopy.patch
deleted file mode 100644
index 2172f8353f..0000000000
--- a/gnu/packages/patches/ath9k-htc-firmware-objcopy.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-The firmware is cross-compiled, but the build system ends up using
-'objcopy' instead of 'xtensa-elf-objcopy' by default. Force it to
-use the right one.
-
---- source/target_firmware/configure 2014-10-28 20:57:26.834436561 +0100
-+++ source/target_firmware/configure 2014-10-28 20:57:29.666436530 +0100
-@@ -11,6 +11,7 @@ mkdir -p build
- cat > "$TOOLCHAIN_FILE" <<EOF
- INCLUDE(CMakeForceCompiler)
-
-+SET(CMAKE_OBJCOPY xtensa-elf-objcopy)
- SET(CMAKE_SYSTEM_PROCESSOR xtensa)
- SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/$TARGET)
- SET(CMAKE_STRIP :)
diff --git a/gnu/packages/patches/calls-disable-application-test.patch b/gnu/packages/patches/calls-disable-application-test.patch
new file mode 100644
index 0000000000..f06f747487
--- /dev/null
+++ b/gnu/packages/patches/calls-disable-application-test.patch
@@ -0,0 +1,72 @@
+From e0fdae20840ffe3aeca7190eb8b1bcae70f0c93b Mon Sep 17 00:00:00 2001
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sun, 29 Oct 2023 21:03:27 +0100
+Subject: [PATCH] Disable the application test.
+
+The application test does not work in a Guix container, because an actual
+sound card is required to run this integration test.
+
+* tests/meson.build: Disable test-application.
+---
+ tests/meson.build | 38 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/tests/meson.build b/tests/meson.build
+index c9bdc3d..65f9b93 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -165,24 +165,24 @@ test('dbus', t, env: test_env)
+
+ dbus_run_session = find_program('dbus-run-session')
+
+-if dbus_run_session.found ()
+- test_sources = [ 'test-application.c' ]
+- t = executable('application', test_sources, calls_resources,
+- c_args : test_cflags,
+- link_args: test_link_args,
+- pie: true,
+- link_with : [calls_vala, libcalls],
+- dependencies: calls_deps,
+- include_directories : [
+- calls_includes,
+- ]
+- )
+- test('application',
+- dbus_run_session,
+- args: t.full_path(),
+- env: test_env,
+- timeout : 300
+- )
+-endif
++# if dbus_run_session.found ()
++# test_sources = [ 'test-application.c' ]
++# t = executable('application', test_sources, calls_resources,
++# c_args : test_cflags,
++# link_args: test_link_args,
++# pie: true,
++# link_with : [calls_vala, libcalls],
++# dependencies: calls_deps,
++# include_directories : [
++# calls_includes,
++# ]
++# )
++# test('application',
++# dbus_run_session,
++# args: t.full_path(),
++# env: test_env,
++# timeout : 300
++# )
++# endif
+
+ endif
+
+base-commit: 936d36287324163b958c6ea0c4297c7a607ee18c
+prerequisite-patch-id: 20f8a81da35ce1797635eb310e1f85ac5ff814f6
+prerequisite-patch-id: 96768617d0a8ee8c66faa00220a1612e0f527292
+prerequisite-patch-id: 444c1ee57c24ba4b8165497b0a5885844110c59b
+prerequisite-patch-id: 9415b848ca9ee277bccbad7c3fff23230d5016f1
+prerequisite-patch-id: 3ca2a45be430041875b21f6c8dfac0bc17916abf
+prerequisite-patch-id: e8302846f4650dba9e0072c18be3459ce903fe2e
+--
+2.41.0
+
diff --git a/gnu/packages/patches/calls-disable-sip-test.patch b/gnu/packages/patches/calls-disable-sip-test.patch
new file mode 100644
index 0000000000..75e9294fc0
--- /dev/null
+++ b/gnu/packages/patches/calls-disable-sip-test.patch
@@ -0,0 +1,44 @@
+From 33b75bfcda3437b12b6155addeeddcea697a4270 Mon Sep 17 00:00:00 2001
+Message-ID: <33b75bfcda3437b12b6155addeeddcea697a4270.1698608762.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sun, 29 Oct 2023 20:45:24 +0100
+Subject: [PATCH] Disable the direct call SIP test.
+
+* plugins/provider/tests/test-sip.c (main): Disable it.
+---
+
+This test passes in a guix shell --container --network but not in
+guix shell --container. The most likely cause is it requires access to the
+network.
+
+ plugins/provider/tests/test-sip.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/provider/tests/test-sip.c b/plugins/provider/tests/test-sip.c
+index 185d372..4e83d40 100644
+--- a/plugins/provider/tests/test-sip.c
++++ b/plugins/provider/tests/test-sip.c
+@@ -442,8 +442,11 @@ main (int argc,
+ g_test_add ("/Calls/SIP/origin_call_lists", SipFixture, NULL,
+ setup_sip_origins, test_sip_origin_call_lists, tear_down_sip_origins);
+
+- g_test_add ("/Calls/SIP/calls_direct_call", SipFixture, NULL,
+- setup_sip_origins, test_sip_call_direct_calls, tear_down_sip_origins);
++ /* The direct call fails in the Guix build environment, possibly
++ * because the network is more restricted. */
++
++ /* g_test_add ("/Calls/SIP/calls_direct_call", SipFixture, NULL,
++ setup_sip_origins, test_sip_call_direct_calls, tear_down_sip_origins); */
+
+ ret = g_test_run ();
+
+
+base-commit: 936d36287324163b958c6ea0c4297c7a607ee18c
+prerequisite-patch-id: 20f8a81da35ce1797635eb310e1f85ac5ff814f6
+prerequisite-patch-id: 96768617d0a8ee8c66faa00220a1612e0f527292
+prerequisite-patch-id: 444c1ee57c24ba4b8165497b0a5885844110c59b
+prerequisite-patch-id: 9415b848ca9ee277bccbad7c3fff23230d5016f1
+prerequisite-patch-id: 3ca2a45be430041875b21f6c8dfac0bc17916abf
+--
+2.41.0
+
diff --git a/gnu/packages/patches/chez-scheme-backport-configure.patch b/gnu/packages/patches/chez-scheme-backport-configure.patch
new file mode 100644
index 0000000000..584dcb3f0b
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-backport-configure.patch
@@ -0,0 +1,463 @@
+From 24ab36374f2e366b6c939fffe8c129c8b0ae3b9c Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 28 Feb 2024 19:41:22 -0500
+Subject: [PATCH 1/2] Repairs and improvements for building with external
+ dependencies (#807)
+
+* configure: fix zlib and lz4 submodule checks
+
+Conditionals to skip the submodule checks were using the wrong
+variable names, so the checks were always skipped. The correct
+behavior is to perform the check unless given `ZLIB=<zlib>` or
+`LZ4=<lz4>`, as applicable.
+
+* configure: support `ZUO=<zuo>`
+
+Supplying `ZUO=<zuo>` skips the submodule check in `configure`
+and configures the generated makefile not to build or remove Zuo.
+
+* configure: support `STEXLIB=<stex>`
+
+For compatibility with older scripts, when not explicitly configured,
+continue to honor the `STEXLIB` environment variable at build time.
+
+(cherry picked from commit b8838c3280ef10e115236d2f7ac9ae857f83e268)
+---
+ BUILDING | 5 +++--
+ build.zuo | 13 +++++++++----
+ configure | 40 +++++++++++++++++++++++++++++++++-------
+ makefiles/Makefile.in | 6 ++----
+ 4 files changed, 47 insertions(+), 17 deletions(-)
+
+diff --git a/BUILDING b/BUILDING
+index 7b3dc9c8..9e9a268b 100644
+--- a/BUILDING
++++ b/BUILDING
+@@ -149,7 +149,8 @@ information on the supported options.
+ The generated makefile mostly just ensures that a `zuo` executable is
+ built in a `bin` directory, and then it defers the actual build work
+ to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
+-you can use `zuo` directly instead of `make`. In general, instead of
++you can use `zuo` directly instead of `make`: in that case, you may
++wish to use `./configure ZUO=<zuo>`. In general, instead of
+ the command `make X` to build target `X` as described below, you can
+ use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
+
+@@ -333,7 +334,7 @@ The makefile supports several targets:
+ * `make clean`
+
+ Removes all built elements from the workarea, and then removes
+- `bin/zuo`.
++ `bin/zuo` (unless configured with `ZUO=<zuo>`).
+
+
+ WINDOWS VIA COMMAND PROMPT
+diff --git a/build.zuo b/build.zuo
+index c21d2caa..c5896396 100644
+--- a/build.zuo
++++ b/build.zuo
+@@ -224,10 +224,15 @@
+ token))
+
+ (define stexlib
+- (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
+- (if found
+- (cdr found)
+- (at-source "stex"))))
++ (let ([configured (hash-ref config 'STEXLIB "")]
++ [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
++ (cond
++ [(not (equal? "" configured))
++ configured]
++ [env
++ (cdr env)]
++ [else
++ (at-source "stex")])))
+ (define stex-sources
+ (source-tree stexlib))
+
+diff --git a/configure b/configure
+index 2b4b594e..782dd09b 100755
+--- a/configure
++++ b/configure
+@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
+ CFLAGS_ADD=
+ zlibLib=
+ LZ4Lib=
++STEXLIB=
+ Kernel=KernelLib
+ buildKernelOnly=no
+ enableFrompb=yes
+@@ -103,6 +104,7 @@ moreBootFiles=
+ preloadBootFiles=
+ alwaysUseBootFile=
+ skipSubmoduleUpdate=
++zuoExternal=
+
+ CONFIG_UNAME=`uname`
+
+@@ -446,6 +448,12 @@ while [ $# != 0 ] ; do
+ LZ4=*)
+ LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
+ ;;
++ STEXLIB=*)
++ STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
++ ;;
++ ZUO=*)
++ zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
++ ;;
+ *)
+ echo "option '$1' unrecognized or missing an argument; try $0 --help"
+ exit 1
+@@ -672,6 +680,8 @@ if [ "$help" = "yes" ]; then
+ echo " STRIP=<strip> executable stripper"
+ echo " ZLIB=<lib> link to <lib> instead of own zlib"
+ echo " LZ4=<lib> link to <lib> instead of own LZ4"
++ echo " STEXLIB=<stex> build docs with <stex> instead of own stex"
++ echo " ZUO=<zuo> build with <zuo> instead of own Zuo"
+ echo ""
+ echo "Available machine types: $machs"
+ echo ""
+@@ -889,28 +899,39 @@ submod_instructions () {
+ exit 1
+ }
+
+-if [ ! -f "$srcdir"/zuo/configure ] ; then
+- submod_instructions 'Source in "zuo" is missing'
++if [ "${zuoExternal}" = "" ] ; then
++ if [ ! -f "$srcdir"/zuo/configure ] ; then
++ submod_instructions 'Source in "zuo" is missing'
++ fi
++ ZUO="bin/zuo"
++ RM_ZUO="rm -f bin/zuo"
++ ZUO_TARGET="bin/zuo"
++else
++ ZUO="${zuoExternal}"
++ RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
++ ZUO_TARGET="DoNotBuildZuo"
+ fi
+
+ if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then
+ submod_instructions 'Source in "nanopass" is missing'
+ fi
+
+-if [ "${zlibDep}" != "" ] ; then
++if [ "${zlibLib}" = "" ] ; then
+ if [ ! -f "$srcdir"/zlib/configure ] ; then
+ submod_instructions 'Source in "zlib" is missing'
+ fi
+ fi
+
+-if [ "${LZ4Dep}" != "" ] ; then
++if [ "${LZ4Lib}" = "" ] ; then
+ if [ ! -f "$srcdir"/lz4/lib/Makefile ] ; then
+ submod_instructions 'Source in "lz4" is missing'
+ fi
+ fi
+
+-if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
+- submod_instructions 'Source in "stex" is missing'
++if [ "${STEXLIB}" = "" ] ; then
++ if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
++ submod_instructions 'Source in "stex" is missing'
++ fi
+ fi
+
+ # more compile and link flags for c/Mf-unix and mats/Mf-unix
+@@ -1083,7 +1104,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
+ # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
+ cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
+
+-# The content of "$w/Makefile" records configuration decisions,
++# The content of "$w/Mf-config" records configuration decisions,
+ # and the Zuo build script takes it from there
+ cat > $w/Mf-config << END
+ srcdir=$srcdir
+@@ -1119,6 +1140,7 @@ cursesLib=$cursesLib
+ ncursesLib=$ncursesLib
+ zlibLib=$zlibLib
+ LZ4Lib=$LZ4Lib
++STEXLIB=$STEXLIB
+ warningFlags=$warningFlags
+ Kernel=$Kernel
+ installscriptname=$installscriptname
+@@ -1130,6 +1152,10 @@ preloadBootFiles=$preloadBootFiles
+ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+
++ZUO=$ZUO
++RM_ZUO=$RM_ZUO
++ZUO_TARGET=$ZUO_TARGET
++
+ InstallBin=$installbin
+ InstallLib=$installlib
+ InstallMan=$installman/man1
+diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
+index 3b95f065..0e3d307d 100644
+--- a/makefiles/Makefile.in
++++ b/makefiles/Makefile.in
+@@ -3,8 +3,6 @@ workarea=$(w)
+
+ include $(workarea)/Mf-config
+
+-ZUO=bin/zuo
+-
+ .PHONY: build
+ build: $(ZUO)
+ + $(ZUO) $(workarea) MAKE="$(MAKE)"
+@@ -144,9 +142,9 @@ pkg: $(ZUO)
+ .PHONY: clean
+ clean: $(ZUO)
+ + $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+- rm -f bin/zuo
++ $(RM_ZUO)
+
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+-$(ZUO): $(srcdir)/zuo/zuo.c
++$(ZUO_TARGET): $(srcdir)/zuo/zuo.c
+ + mkdir -p bin
+ + $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
+
+base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
+--
+2.41.0
+
+
+From 665bccc1c074131e790879adc1436f8059801171 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sun, 17 Mar 2024 09:06:30 -0600
+Subject: [PATCH 2/2] adjust `configure ZUO=<command>` support (#816)
+
+Continuing from b8838c3280, adjust the generated makefile so the
+supplied `<command>` is not a makefile dependency. That way, `ZUO=zuo`
+works if `zuo` is installed and the current build directory is not the
+source directory. (The `zuo` executable is a dependency in a real and
+relevant sense, but not in the sense of dependencies that we normally
+track in makefiles.)
+
+Also adapt the makefile for the case that `ZUO=...` is not supplied
+and the build directory is not the source directory, in which case
+`ZUO_LIB_PATH` needs to be relative to the source directory.
+
+Using `make ZUO=zuo` can also work, but in that case, `bin/zuo` is
+still built as a dependency. It's possible that some portable makefile
+magic could overcome that limitation, but it doesn't seem important.
+
+(cherry picked from commit d327968f37cdf669d15a9ad6d356bbf92c502bb9)
+---
+ configure | 3 ++
+ makefiles/Makefile.in | 66 +++++++++++++++++++++----------------------
+ 2 files changed, 36 insertions(+), 33 deletions(-)
+
+diff --git a/configure b/configure
+index 782dd09b..9adae37a 100755
+--- a/configure
++++ b/configure
+@@ -904,10 +904,12 @@ if [ "${zuoExternal}" = "" ] ; then
+ submod_instructions 'Source in "zuo" is missing'
+ fi
+ ZUO="bin/zuo"
++ ZUO_DEP="${ZUO}"
+ RM_ZUO="rm -f bin/zuo"
+ ZUO_TARGET="bin/zuo"
+ else
+ ZUO="${zuoExternal}"
++ ZUO_DEP=""
+ RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
+ ZUO_TARGET="DoNotBuildZuo"
+ fi
+@@ -1153,6 +1155,7 @@ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+
+ ZUO=$ZUO
++ZUO_DEP=$ZUO_DEP
+ RM_ZUO=$RM_ZUO
+ ZUO_TARGET=$ZUO_TARGET
+
+diff --git a/makefiles/Makefile.in b/makefiles/Makefile.in
+index 0e3d307d..fc8605a0 100644
+--- a/makefiles/Makefile.in
++++ b/makefiles/Makefile.in
+@@ -4,55 +4,55 @@ workarea=$(w)
+ include $(workarea)/Mf-config
+
+ .PHONY: build
+-build: $(ZUO)
++build: $(ZUO_DEP)
+ + $(ZUO) $(workarea) MAKE="$(MAKE)"
+
+ .PHONY: run
+-run: $(ZUO)
++run: $(ZUO_DEP)
+ + $(ZUO) $(workarea) run
+
+ .PHONY: kernel
+-kernel: $(ZUO)
++kernel: $(ZUO_DEP)
+ + $(ZUO) $(workarea) kernel MAKE="$(MAKE)"
+
+ .PHONY: install
+-install: $(ZUO)
++install: $(ZUO_DEP)
+ $(ZUO) $(workarea) install MAKE="$(MAKE)"
+
+ .PHONY: uninstall
+-uninstall: $(ZUO)
++uninstall: $(ZUO_DEP)
+ + $(ZUO) $(workarea) uninstall MAKE="$(MAKE)"
+
+ .PHONY: test-one
+-test-one: $(ZUO)
++test-one: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test-one MAKE="$(MAKE)"
+
+ .PHONY: test-some-fast
+-test-some-fast: $(ZUO)
++test-some-fast: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test-some-fast MAKE="$(MAKE)"
+
+ .PHONY: test-some
+-test-some: $(ZUO)
++test-some: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test-some MAKE="$(MAKE)"
+
+ .PHONY: test
+-test: $(ZUO)
++test: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test MAKE="$(MAKE)"
+
+ .PHONY: test-more
+-test-more: $(ZUO)
++test-more: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test-more MAKE="$(MAKE)"
+
+ .PHONY: coverage
+-coverage: $(ZUO)
++coverage: $(ZUO_DEP)
+ + $(ZUO) $(workarea) coverage MAKE="$(MAKE)"
+
+ .PHONY: bootfiles
+-bootfiles: $(ZUO)
++bootfiles: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootfiles MAKE="$(MAKE)"
+
+ .PHONY: reset
+-reset: $(ZUO)
++reset: $(ZUO_DEP)
+ + $(ZUO) $(workarea) reset MAKE="$(MAKE)"
+
+ # Supply XM=<machine> to build boot files for <machine>
+@@ -61,90 +61,90 @@ boot:
+ + $(ZUO) $(workarea) boot "$(XM)" MAKE="$(MAKE)"
+
+ # `<machine>.boot` as alias for `boot XM=<machine>`
+-%.boot: $(ZUO)
++%.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) boot $* MAKE="$(MAKE)"
+
+ .PHONY: auto.boot
+-auto.boot: $(ZUO)
++auto.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) boot MAKE="$(MAKE)"
+
+ SCHEME=scheme
+
+ .PHONY: cross.boot
+-cross.boot: $(ZUO)
++cross.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) boot SCHEME="$(SCHEME)" MAKE="$(MAKE)"
+
+ .PHONY: re.boot
+-re.boot: $(ZUO)
++re.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) reboot SCHEME="$(SCHEME)"
+
+ # Supply XM=<machine> to build boot files for <machine>
+ # with o=3 d=0 for the cross compiler, and only after
+ # building the kernel for the configured machine
+ .PHONY: bootquick
+-bootquick: $(ZUO)
++bootquick: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootquick "$(XM)" MAKE="$(MAKE)"
+
+ # `<machine>.bootquick` as alias for `boot XM=<machine>`
+-%.bootquick: $(ZUO)
++%.bootquick: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootquick $* MAKE="$(MAKE)"
+
+-auto.bootquick: $(ZUO)
++auto.bootquick: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootquick MAKE="$(MAKE)"
+
+ # Supply XM=<machine>-<tag>.bootpbchunk to repackage boot files for
+ # <machine> with pbchunk sources, including additional
+ # boot files
+ .PHONY: bootpbchunk
+-bootpbchunk: $(ZUO)
++bootpbchunk: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootpbchunk "$(XM)" $(ARGS) MAKE="$(MAKE)"
+
+ # `<machine>.bootpbchunk` as alias for `pbchunk XM=<machine>`
+-%.bootpbchunk: $(ZUO)
++%.bootpbchunk: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootpbchunk $* $(ARGS) MAKE="$(MAKE)"
+
+ .PHONY: docs
+-docs: build $(ZUO)
++docs: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) docs MAKE="$(MAKE)"
+
+ .PHONY: csug
+-csug: build $(ZUO)
++csug: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) csug MAKE="$(MAKE)"
+
+ .PHONY: release_notes
+-release_notes: build $(ZUO)
++release_notes: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) release_notes MAKE="$(MAKE)"
+
+ .PHONY: install-docs
+-install-docs: build $(ZUO)
++install-docs: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) install-docs MAKE="$(MAKE)"
+
+ .PHONY: install-csug
+-install-csug: build $(ZUO)
++install-csug: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) install-csug MAKE="$(MAKE)"
+
+ .PHONY: install-release_notes
+-install-release_notes: build $(ZUO)
++install-release_notes: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) install-release_notes MAKE="$(MAKE)"
+
+ .PHONY: bintar
+-bintar: $(ZUO)
++bintar: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bintar MAKE="$(MAKE)"
+
+ .PHONY: rpm
+-rpm: $(ZUO)
++rpm: $(ZUO_DEP)
+ + $(ZUO) $(workarea) rpm MAKE="$(MAKE)"
+
+ .PHONY: pkg
+-pkg: $(ZUO)
++pkg: $(ZUO_DEP)
+ + $(ZUO) $(workarea) pkg MAKE="$(MAKE)"
+
+ .PHONY: clean
+-clean: $(ZUO)
++clean: $(ZUO_DEP)
+ + $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+ $(RM_ZUO)
+
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+ $(ZUO_TARGET): $(srcdir)/zuo/zuo.c
+ + mkdir -p bin
+- + $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"../zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
++ + $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"$(upsrcdir)/zuo/lib"'"' -o $(ZUO) $(srcdir)/zuo/zuo.c
+--
+2.41.0
+
diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch
index 7650914f01..c2a4b292f7 100644
--- a/gnu/packages/patches/chez-scheme-bin-sh.patch
+++ b/gnu/packages/patches/chez-scheme-bin-sh.patch
@@ -1,6 +1,6 @@
-From 3c838e6a0c3214d95bf02048cddccfd1b69a679f Mon Sep 17 00:00:00 2001
+From b8428ad25b437acf4bd8210b14db207b71fe44c3 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
-Date: Thu, 19 May 2022 13:41:56 -0400
+Date: Wed, 24 Aug 2022 19:55:14 -0400
Subject: [PATCH] patch s_process for "/bin/sh" on Guix
If:
@@ -14,22 +14,27 @@ then `s_process` will call `execl` with the file specified by
`_PATH_BSHELL` instead of "/bin/sh".
Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Chez Scheme
+or executables it builds in non-Guix envoronments.
This patch does not change the behavior of `s_system`, which relies
on `system` from the C library.
---
+
+Notes:
+ See also racket-chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
+ and zuo-bin-sh.patch.
+
c/prim5.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/c/prim5.c b/c/prim5.c
-index 5a07893..bc2736c 100644
+index 90b087f1..284f063f 100644
--- a/c/prim5.c
+++ b/c/prim5.c
-@@ -23,6 +23,12 @@
- #include <ctype.h>
- #include <math.h>
+@@ -27,6 +27,12 @@
+ #include <sys/resource.h>
+ #endif
+/* BEGIN PATCH for Guix */
+#ifndef WIN32
@@ -39,8 +44,8 @@ index 5a07893..bc2736c 100644
+
/* locally defined functions */
static INT s_errno(void);
- static iptr s_addr_in_heap(uptr x);
-@@ -746,6 +752,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ static IBOOL s_addr_in_heap(uptr x);
+@@ -875,6 +881,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
INT tofds[2], fromfds[2], errfds[2];
struct sigaction act, oint_act;
@@ -58,10 +63,10 @@ index 5a07893..bc2736c 100644
if (pipe(tofds)) S_error("process","cannot open pipes");
if (pipe(fromfds)) {
-@@ -771,7 +788,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
- CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1);
- CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1);
- {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);}
+@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+ }
+ }
+ #endif /* __GNU__ Hurd */
- execl("/bin/sh", "/bin/sh", "-c", s, NULL);
+ /* BEGIN PATCH for Guix */
+ execl(guix_sh, guix_sh, "-c", s, NULL);
@@ -70,7 +75,7 @@ index 5a07893..bc2736c 100644
/*NOTREACHED*/
} else {
-base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84
+base-commit: 253230f7dfbb4fe777277d6bbf93f39f9567f086
--
-2.32.0
+2.41.0
diff --git a/gnu/packages/patches/clang-18.0-libc-search-path.patch b/gnu/packages/patches/clang-18.0-libc-search-path.patch
new file mode 100644
index 0000000000..e3c673bf80
--- /dev/null
+++ b/gnu/packages/patches/clang-18.0-libc-search-path.patch
@@ -0,0 +1,90 @@
+Clang attempts to guess file names based on the OS and distro (yes!),
+but unfortunately, that doesn't work for us.
+
+This patch makes it easy to insert libc's $libdir so that Clang passes the
+correct absolute file name of crt1.o etc. to 'ld'. It also disables all
+the distro-specific stuff and removes the hard-coded FHS directory names
+to make sure Clang also works on foreign distros.
+
+diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
+index a7e7f169dc14..0564003352a4 100644
+--- a/clang/lib/Driver/Distro.cpp
++++ b/clang/lib/Driver/Distro.cpp
+@@ -100,6 +100,10 @@ static Distro::DistroType DetectLsbRelease(llvm::vfs::FileSystem &VFS) {
+ }
+
+ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
++ // The compiler should always behave the same, even when used via Guix on a
++ // foreign distro.
++ return Distro::UnknownDistro;
++
+ Distro::DistroType Version = Distro::UnknownDistro;
+
+ // Newer freedesktop.org's compilant systemd-based systems
+diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
+index 1462576ca870..1078dba8f481 100644
+--- a/clang/lib/Driver/ToolChains/Cuda.cpp
++++ b/clang/lib/Driver/ToolChains/Cuda.cpp
+@@ -132,6 +132,9 @@ CudaInstallationDetector::CudaInstallationDetector(
+ const Driver &D, const llvm::Triple &HostTriple,
+ const llvm::opt::ArgList &Args)
+ : D(D) {
++ // Don't look for CUDA in /usr.
++ return;
++
+ struct Candidate {
+ std::string Path;
+ bool StrictChecking;
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 4300a2bdff17..ac3b29d0fc13 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -224,6 +224,10 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ Generic_GCC::PushPPaths(PPaths);
+
++ // Comment out the distro-specific tweaks so that they don't bite when
++ // using Guix on a foreign distro.
++#if 0
++
+ Distro Distro(D.getVFS(), Triple);
+
+ if (Distro.IsAlpineLinux() || Triple.isAndroid()) {
+@@ -284,6 +288,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+
+ #ifdef ENABLE_LINKER_BUILD_ID
+ ExtraOpts.push_back("--build-id");
++#endif
+ #endif
+
+ // The selection of paths to try here is designed to match the patterns which
+@@ -305,6 +310,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ }
+ Generic_GCC::AddMultilibPaths(D, SysRoot, OSLibDir, MultiarchTriple, Paths);
+
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib", MultiarchTriple), Paths);
+ addPathIfExists(D, concat(SysRoot, "/lib/..", OSLibDir), Paths);
+
+@@ -333,11 +339,21 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ addPathIfExists(D, concat(SysRoot, "/", OSLibDir, ABIName), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir, ABIName), Paths);
+ }
++#endif
+
+ Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
+
++#if 0
+ addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
+ addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
++#endif
++
++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
++ // and friends can be found.
++ addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
++
++ // Add GCC's lib/ directory so libstdc++.so can be found.
++ addPathIfExists(D, GCCInstallation.getParentLibPath(), Paths);
+ }
+
+ ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const {
diff --git a/gnu/packages/patches/cogl-fix-double-free.patch b/gnu/packages/patches/cogl-fix-double-free.patch
new file mode 100644
index 0000000000..e7a994b33a
--- /dev/null
+++ b/gnu/packages/patches/cogl-fix-double-free.patch
@@ -0,0 +1,32 @@
+From 15d0f7d96cf53263196e26f2eb48ededdff0efeb Mon Sep 17 00:00:00 2001
+Message-ID: <15d0f7d96cf53263196e26f2eb48ededdff0efeb.1694148833.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Thu, 7 Sep 2023 22:16:48 +0200
+Subject: [PATCH] Prevent double free on context objects
+
+The display is unrefed in the context destructor, but not refed in the
+constructor.
+
+This targets an archived (read-only) repository.
+---
+ cogl/cogl-context.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
+index a7eed29a..7cdc9fe7 100644
+--- a/cogl/cogl-context.c
++++ b/cogl/cogl-context.c
+@@ -218,7 +218,7 @@ cogl_context_new (CoglDisplay *display,
+ return NULL;
+ }
+
+- context->display = display;
++ context->display = cogl_object_ref (display);
+
+ /* This is duplicated data, but it's much more convenient to have
+ the driver attached to the context and the value is accessed a
+
+base-commit: 61d966c7442d521e38572b7f93ac7b8973a9c65e
+--
+2.41.0
+
diff --git a/gnu/packages/patches/duc-fix-test-sh.patch b/gnu/packages/patches/duc-fix-test-sh.patch
new file mode 100644
index 0000000000..8b79e4bd03
--- /dev/null
+++ b/gnu/packages/patches/duc-fix-test-sh.patch
@@ -0,0 +1,70 @@
+From a84835e481d9b5fcfc101bb1fa5aba38a245b6f3 Mon Sep 17 00:00:00 2001
+Message-ID: <a84835e481d9b5fcfc101bb1fa5aba38a245b6f3.1711177846.git.vivien@planete-kraus.eu>
+From: Fabio Natali <me@fabionatali.com>
+Date: Wed, 30 Aug 2023 11:35:40 +0100
+Subject: [PATCH] Fix test.sh which used to fail in some circumstances
+
+duc's behaviour may legitimately vary depending on the system it is being run
+on. The test.sh script used to fail in some circumstances as it was too strict
+and it did not account for some legitimate behaviour differences.
+
+Fix: update `test.sh' variable
+---
+
+This is a squash of pull request https://github.com/zevv/duc/pull/318,
+waiting to be merged.
+
+ test.sh | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/test.sh b/test.sh
+index eb592be..7668499 100755
+--- a/test.sh
++++ b/test.sh
+@@ -130,8 +130,8 @@ fi
+ # Actual tests are below. If you add test cases above, these need to be tweaked.
+ #---------------------------------------------------------------------------------
+
+-
+-cat ${DUC_TEST_DIR}.out | grep -q "Indexed 77 files and 47 directories, (91869B apparent, 540672B actual)"
++# An exact match is expected on the apparent size; the actual size may vary.
++cat ${DUC_TEST_DIR}.out | grep -q "Indexed 77 files and 47 directories, (91869B apparent, [0-9]*B actual)"
+
+ if [ "$?" = "0" ]; then
+ echo "report: ok"
+@@ -153,16 +153,26 @@ if [ "$?" != "0" ]; then
+ exit 1
+ fi
+
+-testsum="33e2be27a9e70e81d4006a2d7b555948"
++# When two or more hard links point to the same file and when running duc with
++# the `--check-hard-links' option, only one of the hard links will be
++# counted. However, duc may pick up and display a different hard link depending
++# on the system it is being run on. Since our tests include three hard links to
++# the same file, we should be expecting three possible outcomes, all equally
++# valid, each corresponding to one of the following MD5 checksums.
++testsum0="78dbf880ef6917ea665fddb5ebb44428"
++testsum1="38ab7b7d1ec6ac57d672c5618371386d"
++testsum2="33e2be27a9e70e81d4006a2d7b555948"
+ md5sum ${DUC_TEST_DIR}.out > /tmp/.duc.md5sum
+-grep -q $testsum /tmp/.duc.md5sum
++grep -q "$testsum0\|$testsum1\|$testsum2" /tmp/.duc.md5sum
+
+ if [ "$?" = "0" ]; then
+ echo "md5sum: ok"
+ else
+ echo "md5sum: failed"
+- echo "expected: "
+- echo "$testsum ${DUC_TEST_DIR}.out"
++ echo "expected one of: "
++ echo "$testsum0 ${DUC_TEST_DIR}.out"
++ echo "$testsum1 ${DUC_TEST_DIR}.out"
++ echo "$testsum2 ${DUC_TEST_DIR}.out"
+ echo "got: "
+ cat /tmp/.duc.md5sum
+ exit 1
+
+base-commit: b8f9659688a38476df9f613be3342bb8e2d65402
+--
+2.41.0
+
diff --git a/gnu/packages/patches/durden-shadow-arcan.patch b/gnu/packages/patches/durden-shadow-arcan.patch
new file mode 100644
index 0000000000..b666a6d7e3
--- /dev/null
+++ b/gnu/packages/patches/durden-shadow-arcan.patch
@@ -0,0 +1,42 @@
+From 157524b7cb76c5044a27f4a9e373ee04a9da3c71 Mon Sep 17 00:00:00 2001
+From: Ahmad Draidi <a.r.draidi@redscript.org>
+Date: Tue, 9 Apr 2024 18:26:52 +0400
+Subject: [PATCH] Use arcan from setuid-programs if available
+
+---
+ distr/durden | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/distr/durden b/distr/durden
+index ab431ce..8672556 100755
+--- a/distr/durden
++++ b/distr/durden
+@@ -1,5 +1,11 @@
+ #!/bin/sh
+
++if [ -n "$(command -v /run/setuid-programs/arcan 2>/dev/null)" ]; then
++ ARCAN_CMD="/run/setuid-programs/arcan"
++else
++ ARCAN_CMD="@ARCAN_STORE_PATH@"
++fi
++
+ arcan_base=${HOME}/.arcan
+ applname="$(basename $0)"
+ distargs=""
+@@ -98,11 +104,11 @@ while true; do
+ starttime=$(date +%s)
+
+ if [ -d "${arcan_logpath}" ]; then
+- if arcan ${distargs} -b "$applname" "$applname" "$@" >"${arcan_logpath}/${applname}_${starttime}.log" 2>&1; then
++ if "${ARCAN_CMD}" ${distargs} -b "$applname" "$applname" "$@" >"${arcan_logpath}/${applname}_${starttime}.log" 2>&1; then
+ exit
+ fi
+ else
+- if arcan ${distargs} -b "$applname" "$applname" "$@"; then
++ if "${ARCAN_CMD}" ${distargs} -b "$applname" "$applname" "$@"; then
+ exit
+ fi
+ fi
+--
+2.41.0
+
diff --git a/gnu/packages/patches/emacs-disable-jit-compilation.patch b/gnu/packages/patches/emacs-disable-jit-compilation.patch
new file mode 100644
index 0000000000..8b1ac5a9df
--- /dev/null
+++ b/gnu/packages/patches/emacs-disable-jit-compilation.patch
@@ -0,0 +1,19 @@
+Index: emacs-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -5648,8 +5648,12 @@ For internal use. */);
+ doc: /* If non-nil, compile loaded .elc files asynchronously.
+
+ After compilation, each function definition is updated to use the
+-natively-compiled one. */);
+- native_comp_jit_compilation = true;
++natively-compiled one. This variable is enabled by default upstream,
++but disabled in Guix to better make use of precompiled packages.
++Notably, Guix removes the hashes that prevent inadvertent shadowing
++frm the file names of compiled libraries in order to facilitate grafts.
++Enable at your own risk! */);
++ native_comp_jit_compilation = false;
+
+ DEFSYM (Qnative_comp_speed, "native-comp-speed");
+ DEFSYM (Qnative_comp_debug, "native-comp-debug");
diff --git a/gnu/packages/patches/emacs-native-comp-fix-filenames.patch b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
new file mode 100644
index 0000000000..169323f290
--- /dev/null
+++ b/gnu/packages/patches/emacs-native-comp-fix-filenames.patch
@@ -0,0 +1,338 @@
+Upstream hashes both the absolute file name and the content of a file
+to derive the name for the natively compiled files. This breaks the
+staged install used in guix, as any $GUIX_PROFILE is distinct from
+the build directory. It also breaks grafts, as hardcoded store file
+names get rewritten; thus changing the file hash.
+
+In addition, this patch changes how native-comp-eln-load-path is
+constructed. Upstream, an entry of the directory “../lisp” is added
+supposedly for bootstrap only, but this directory appears to find its
+way into the actual variable despite attempts to remove it by calling
+‘startup--update-eln-cache’.
+The user-visible procedure ‘startup-redirect-eln-cache’ is kept, as
+packages may require it, but only pushes the new value now.
+
+Index: emacs-29.2/src/comp.c
+===================================================================
+--- emacs-29.2.orig/src/comp.c
++++ emacs-29.2/src/comp.c
+@@ -4396,26 +4396,17 @@ DEFUN ("comp-el-to-eln-rel-filename", Fc
+ Scomp_el_to_eln_rel_filename, 1, 1, 0,
+ doc: /* Return the relative name of the .eln file for FILENAME.
+ FILENAME must exist, and if it's a symlink, the target must exist.
+-If FILENAME is compressed, it must have the \".gz\" extension,
+-and Emacs must have been compiled with zlib; the file will be
+-uncompressed on the fly to hash its contents.
+-Value includes the original base name, followed by 2 hash values,
+-one for the file name and another for its contents, followed by .eln. */)
++FILENAME is resolved relative to `load-path' and only the suffix of
++the first matching path is kept. If FILENAME is not found to be relative
++to any directory `load-path', it is used as-is to construct the return
++value. */)
+ (Lisp_Object filename)
+ {
+ CHECK_STRING (filename);
+
+- /* Resolve possible symlinks in FILENAME, so that path_hash below
+- always compares equal. (Bug#44701). */
+- filename = Fexpand_file_name (filename, Qnil);
+- char *file_normalized = realpath (SSDATA (ENCODE_FILE (filename)), NULL);
+- if (file_normalized)
+- {
+- filename = DECODE_FILE (make_unibyte_string (file_normalized,
+- strlen (file_normalized)));
+- xfree (file_normalized);
+- }
++ Lisp_Object rel_name = filename;
+
++ filename = Fexpand_file_name (filename, Qnil);
+ if (NILP (Ffile_exists_p (filename)))
+ xsignal1 (Qfile_missing, filename);
+
+@@ -4423,64 +4414,55 @@ one for the file name and another for it
+ filename = Fw32_long_file_name (filename);
+ #endif
+
+- Lisp_Object content_hash = comp_hash_source_file (filename);
+-
+- if (suffix_p (filename, ".gz"))
+- filename = Fsubstring (filename, Qnil, make_fixnum (-3));
+-
+- /* We create eln filenames with an hash in order to look-up these
+- starting from the source filename, IOW have a relation
+-
+- /absolute/path/filename.el + content ->
+- eln-cache/filename-path_hash-content_hash.eln.
+-
+- 'dlopen' can return the same handle if two shared with the same
+- filename are loaded in two different times (even if the first was
+- deleted!). To prevent this scenario the source file content is
+- included in the hashing algorithm.
+-
+- As at any point in time no more then one file can exist with the
+- same filename, should be possible to clean up all
+- filename-path_hash-* except the most recent one (or the new one
+- being recompiled).
+-
+- As installing .eln files compiled during the build changes their
+- absolute path we need an hashing mechanism that is not sensitive
+- to that. For this we replace if match PATH_DUMPLOADSEARCH or
+- *PATH_REL_LOADSEARCH with '//' before computing the hash. */
+-
+- if (NILP (loadsearch_re_list))
+- {
+- Lisp_Object sys_re =
+- concat2 (build_string ("\\`[[:ascii:]]+"),
+- Fregexp_quote (build_string ("/" PATH_REL_LOADSEARCH "/")));
+- Lisp_Object dump_load_search =
+- Fexpand_file_name (build_string (PATH_DUMPLOADSEARCH "/"), Qnil);
+-#ifdef WINDOWSNT
+- dump_load_search = Fw32_long_file_name (dump_load_search);
+-#endif
+- loadsearch_re_list = list2 (sys_re, Fregexp_quote (dump_load_search));
+- }
++ Lisp_Object tail = Vload_path;
++ Lisp_Object name_len = Flength (filename);
+
+- Lisp_Object lds_re_tail = loadsearch_re_list;
+- FOR_EACH_TAIL (lds_re_tail)
++ FOR_EACH_TAIL_SAFE (tail)
+ {
+- Lisp_Object match_idx =
+- Fstring_match (XCAR (lds_re_tail), filename, Qnil, Qnil);
+- if (BASE_EQ (match_idx, make_fixnum (0)))
++ Lisp_Object directory = Ffile_name_as_directory (XCAR (tail));
++ Lisp_Object len = Flength (directory);
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ directory, make_fixnum (0), len,
++ Qnil)))
+ {
+- filename =
+- Freplace_match (build_string ("//"), Qt, Qt, filename, Qnil);
++ filename = Fsubstring (filename, len, Qnil);
+ break;
+ }
+ }
+- Lisp_Object separator = build_string ("-");
+- Lisp_Object path_hash = comp_hash_string (filename);
+- filename = concat2 (Ffile_name_nondirectory (Fsubstring (filename, Qnil,
+- make_fixnum (-3))),
+- separator);
+- Lisp_Object hash = concat3 (path_hash, separator, content_hash);
+- return concat3 (filename, hash, build_string (NATIVE_ELISP_SUFFIX));
++
++ if (file_name_absolute_p (filename)) /* no match in load-path */
++ filename = rel_name;
++
++ Lisp_Object bogus_dirs =
++ Fgetenv_internal (build_string ("NATIVE_COMP_BOGUS_DIRS"), Qnil);
++
++ if (!NILP (bogus_dirs))
++ {
++ tail = CALL2I (split-string, bogus_dirs, build_string (":"));
++
++ FOR_EACH_TAIL_SAFE (tail)
++ {
++ Lisp_Object directory = Ffile_name_as_directory (XCAR (tail));
++ Lisp_Object len = Flength (directory);
++ if (XFIXNUM (name_len) < XFIXNUM (len))
++ continue;
++ else if (EQ (Qt, Fcompare_strings (filename, make_fixnum (0), len,
++ directory, make_fixnum (0), len,
++ Qnil)))
++ {
++ filename = Fsubstring (filename, len, Qnil);
++ break;
++ }
++ }
++ }
++
++ if (suffix_p (filename, ".gz"))
++ filename = Fsubstring (filename, Qnil, make_fixnum (-3));
++
++ return concat2(Fsubstring (filename, Qnil, make_fixnum (-3)),
++ build_string (NATIVE_ELISP_SUFFIX));
+ }
+
+ DEFUN ("comp-el-to-eln-filename", Fcomp_el_to_eln_filename,
+@@ -4494,13 +4476,7 @@ If BASE-DIR is non-nil, use it as the di
+ non-absolute BASE-DIR is interpreted as relative to `invocation-directory'.
+ If BASE-DIR is omitted or nil, look for the first writable directory
+ in `native-comp-eln-load-path', and use as BASE-DIR its subdirectory
+-whose name is given by `comp-native-version-dir'.
+-If FILENAME specifies a preloaded file, the directory for the .eln
+-file is the \"preloaded/\" subdirectory of the directory determined
+-as described above. FILENAME is considered to be a preloaded file if
+-the value of `comp-file-preloaded-p' is non-nil, or if FILENAME
+-appears in the value of the environment variable LISP_PRELOADED;
+-the latter is supposed to be used by the Emacs build procedure. */)
++whose name is given by `comp-native-version-dir'. */)
+ (Lisp_Object filename, Lisp_Object base_dir)
+ {
+ Lisp_Object source_filename = filename;
+@@ -4548,10 +4524,11 @@ the latter is supposed to be used by the
+ Lisp_Object lisp_preloaded =
+ Fgetenv_internal (build_string ("LISP_PRELOADED"), Qnil);
+ base_dir = Fexpand_file_name (Vcomp_native_version_dir, base_dir);
++ bool preloaded = comp_file_preloaded_p;
+ if (comp_file_preloaded_p
+ || (!NILP (lisp_preloaded)
+- && !NILP (Fmember (CALL1I (file-name-base, source_filename),
+- Fmapcar (intern_c_string ("file-name-base"),
++ && !NILP (Fmember (CALL1I (file-name-sans-extension, source_filename),
++ Fmapcar (intern_c_string ("file-name-sans-extension"),
+ CALL1I (split-string, lisp_preloaded))))))
+ base_dir = Fexpand_file_name (build_string ("preloaded"), base_dir);
+
+@@ -5863,10 +5840,7 @@ The last directory of this list is assum
+ the system *.eln files, which are the files produced when building
+ Emacs. */);
+
+- /* Temporary value in use for bootstrap. We can't do better as
+- `invocation-directory' is still unset, will be fixed up during
+- dump reload. */
+- Vnative_comp_eln_load_path = Fcons (build_string ("../native-lisp/"), Qnil);
++ Vnative_comp_eln_load_path = Qnil;
+
+ DEFVAR_LISP ("native-comp-enable-subr-trampolines",
+ Vnative_comp_enable_subr_trampolines,
+Index: emacs-29.2/lisp/startup.el
+===================================================================
+--- emacs-29.2.orig/lisp/startup.el
++++ emacs-29.2/lisp/startup.el
+@@ -545,9 +545,6 @@ DIRS are relative."
+ (defvar native-comp-jit-compilation)
+ (defvar native-comp-enable-subr-trampolines)
+
+-(defvar startup--original-eln-load-path nil
+- "Original value of `native-comp-eln-load-path'.")
+-
+ (defun startup-redirect-eln-cache (cache-directory)
+ "Redirect the user's eln-cache directory to CACHE-DIRECTORY.
+ CACHE-DIRECTORY must be a single directory, a string.
+@@ -558,22 +555,10 @@ to `user-emacs-directory'.
+ For best results, call this function in your early-init file,
+ so that the rest of initialization and package loading uses
+ the updated value."
+- ;; Remove the original eln-cache.
+- (setq native-comp-eln-load-path (cdr native-comp-eln-load-path))
+- ;; Add the new eln-cache.
+ (push (expand-file-name (file-name-as-directory cache-directory)
+ user-emacs-directory)
+ native-comp-eln-load-path))
+
+-(defun startup--update-eln-cache ()
+- "Update the user eln-cache directory due to user customizations."
+- ;; Don't override user customizations!
+- (when (equal native-comp-eln-load-path
+- startup--original-eln-load-path)
+- (startup-redirect-eln-cache "eln-cache")
+- (setq startup--original-eln-load-path
+- (copy-sequence native-comp-eln-load-path))))
+-
+ (defun normal-top-level ()
+ "Emacs calls this function when it first starts up.
+ It sets `command-line-processed', processes the command-line,
+@@ -1362,12 +1347,6 @@ please check its value")
+ startup-init-directory)))
+ (setq early-init-file user-init-file)
+
+- ;; Amend `native-comp-eln-load-path', since the early-init file may
+- ;; have altered `user-emacs-directory' and/or changed the eln-cache
+- ;; directory.
+- (when (featurep 'native-compile)
+- (startup--update-eln-cache))
+-
+ ;; If any package directory exists, initialize the package system.
+ (and user-init-file
+ package-enable-at-startup
+@@ -1502,12 +1481,6 @@ please check its value")
+ startup-init-directory))
+ t)
+
+- ;; Amend `native-comp-eln-load-path' again, since the early-init
+- ;; file may have altered `user-emacs-directory' and/or changed the
+- ;; eln-cache directory.
+- (when (featurep 'native-compile)
+- (startup--update-eln-cache))
+-
+ (when (and deactivate-mark transient-mark-mode)
+ (with-current-buffer (window-buffer)
+ (deactivate-mark)))
+Index: emacs-29.2/lisp/loadup.el
+===================================================================
+--- emacs-29.2.orig/lisp/loadup.el
++++ emacs-29.2/lisp/loadup.el
+@@ -53,6 +53,14 @@
+ (setq redisplay--inhibit-bidi t)
+
+ (message "Dump mode: %s" dump-mode)
++;; Compensate for native-comp-eln-load-path being empty by Guix' default.
++(and (featurep 'native-compile)
++ dump-mode
++ (setq
++ native-comp-eln-load-path
++ (cons (expand-file-name "../native-lisp" invocation-directory)
++ native-comp-eln-load-path)
++ comp-file-preloaded-p t))
+
+ ;; Add subdirectories to the load-path for files that might get
+ ;; autoloaded when bootstrapping or running Emacs normally.
+@@ -494,22 +502,20 @@ lost after dumping")))
+ (concat eln-dest-dir "native-lisp/" comp-native-version-dir "/"))
+ (maphash (lambda (_ cu)
+ (let* ((file (native-comp-unit-file cu))
+- (preloaded (equal (substring (file-name-directory file)
+- -10 -1)
+- "preloaded"))
+- (eln-dest-dir-eff (if preloaded
+- (expand-file-name "preloaded"
+- eln-dest-dir)
+- eln-dest-dir)))
++ (native-lisp-needle
++ (regexp-quote (concat "native-lisp/"
++ comp-native-version-dir "/"))))
+ (native-comp-unit-set-file
+ cu
+ (cons
+ ;; Relative filename from the installed binary.
+- (file-relative-name (expand-file-name
+- (file-name-nondirectory
+- file)
+- eln-dest-dir-eff)
+- bin-dest-dir)
++ (file-relative-name
++ (expand-file-name
++ (save-match-data
++ (string-match native-lisp-needle file)
++ (substring file (match-end 0)))
++ eln-dest-dir)
++ bin-dest-dir)
+ ;; Relative filename from the built uninstalled binary.
+ (file-relative-name file invocation-directory)))))
+ comp-loaded-comp-units-h)))
+@@ -557,7 +563,9 @@ lost after dumping")))
+ (equal dump-mode "pdump"))
+ ;; Don't enable this before bootstrap is completed, as the
+ ;; compiler infrastructure may not be usable yet.
+- (setq native-comp-enable-subr-trampolines t))
++ (setq native-comp-enable-subr-trampolines t
++ ;; We loaded everything we could.
++ comp-file-preloaded-p nil))
+ (message "Dumping under the name %s" output)
+ (condition-case ()
+ (delete-file output)
+Index: emacs-29.2/src/Makefile.in
+===================================================================
+--- emacs-29.2.orig/src/Makefile.in
++++ emacs-29.2/src/Makefile.in
+@@ -553,6 +553,7 @@ shortlisp := $(filter-out ${shortlisp_fi
+ ## We don't really need to sort, but may as well use it to remove duplicates.
+ shortlisp := loaddefs.el loadup.el $(sort ${shortlisp})
+ export LISP_PRELOADED = ${shortlisp}
++export NATIVE_COMP_BOGUS_DIRS =
+ lisp = $(addprefix ${lispsource}/,${shortlisp})
+
+ ## Construct full set of libraries to be linked.
diff --git a/gnu/packages/patches/feedbackd-use-system-gmobile.patch b/gnu/packages/patches/feedbackd-use-system-gmobile.patch
new file mode 100644
index 0000000000..f0a0449472
--- /dev/null
+++ b/gnu/packages/patches/feedbackd-use-system-gmobile.patch
@@ -0,0 +1,42 @@
+From af9e72124b12ca481fd3592f9c8ea2649f7e4c80 Mon Sep 17 00:00:00 2001
+Message-ID: <af9e72124b12ca481fd3592f9c8ea2649f7e4c80.1698775513.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sun, 29 Oct 2023 19:12:27 +0100
+Subject: [PATCH] Look for a system-installed gmobile first.
+
+Meson lets projects use a dependency with fallback to a submodule, in
+case the dependency is not installed.
+
+* meson.build (gmobile_subp): Convert to a dependency with subproject
+fallback.
+---
+I am waiting for Purism to approve my account before I can report this.
+
+ meson.build | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 8725e76..e5504be 100644
+--- a/meson.build
++++ b/meson.build
+@@ -14,13 +14,13 @@ gio_unix = dependency('gio-unix-2.0', version: '>=2.50.0')
+ glib = dependency('glib-2.0', version: '>=2.50.0')
+ if get_option('daemon')
+ gobject = dependency('gobject-2.0', version: '>=2.50.0')
+- gmobile_subp = subproject('gmobile',
++ gmobile = dependency('gmobile',
++ fallback: ['gmobile', 'gmobile_dep'],
+ default_options: [
+ 'examples=false',
+ 'gtk_doc=false',
+ 'tests=false',
+ ])
+- gmobile = gmobile_subp.get_variable('gmobile_dep')
+ gsound = dependency('gsound')
+ gudev = dependency('gudev-1.0', version: '>=232')
+ json_glib = dependency('json-glib-1.0')
+
+base-commit: 853bd6d7ea8455efea063ba7c4f29ce8c203285f
+--
+2.41.0
+
diff --git a/gnu/packages/patches/ffmpeg-jami-pipewiregrab-source-filter.patch b/gnu/packages/patches/ffmpeg-jami-pipewiregrab-source-filter.patch
new file mode 100644
index 0000000000..f2da4f478f
--- /dev/null
+++ b/gnu/packages/patches/ffmpeg-jami-pipewiregrab-source-filter.patch
@@ -0,0 +1,1451 @@
+diff --git a/configure b/configure
+index 3cd3bdfb44..0756ad95ea 100755
+--- a/configure
++++ b/configure
+@@ -297,6 +297,7 @@ External library support:
+ --enable-libxcb-shm enable X11 grabbing shm communication [autodetect]
+ --enable-libxcb-xfixes enable X11 grabbing mouse rendering [autodetect]
+ --enable-libxcb-shape enable X11 grabbing shape rendering [autodetect]
++ --enable-libpipewire enable screen grabbing using pipewire [autodetect]
+ --enable-libxvid enable Xvid encoding via xvidcore,
+ native MPEG-4/Xvid encoder exists [no]
+ --enable-libxml2 enable XML parsing using the C library libxml2, needed
+@@ -1747,6 +1748,8 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST="
+ libxcb_shm
+ libxcb_shape
+ libxcb_xfixes
++ libpipewire
++ libgio_unix
+ lzma
+ mediafoundation
+ metal
+@@ -3709,6 +3712,7 @@ pad_opencl_filter_deps="opencl"
+ pan_filter_deps="swresample"
+ perspective_filter_deps="gpl"
+ phase_filter_deps="gpl"
++pipewiregrab_filter_deps="libpipewire libgio_unix pthreads"
+ pp7_filter_deps="gpl"
+ pp_filter_deps="gpl postproc"
+ prewitt_opencl_filter_deps="opencl"
+@@ -6928,6 +6932,18 @@ if enabled libxcb; then
+ enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
+ fi
+
++# Starting with version 0.3.52, PipeWire's spa library uses the __LOCALE_C_ONLY macro to determine
++# whether the locale_t type (introduced in POSIX.1-2008) and some related functions are available (see
++# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2390 for more information).
++# Unfortunately, this macro is specific to uclibc, which can cause build issues on systems that use a
++# different implementation of libc if POSIX 2008 support isn't enabled (which is the case for FFmpeg currently).
++# As a workaround for this problem, we add a compilation flag to ensure that __LOCALE_C_ONLY is always defined.
++add_cppflags -D__LOCALE_C_ONLY
++enabled libpipewire && check_pkg_config libpipewire "libpipewire-0.3 >= 0.3.40" pipewire/pipewire.h pw_init
++if enabled libpipewire; then
++ enabled libgio_unix && check_pkg_config libgio_unix gio-unix-2.0 gio/gio.h g_main_loop_new
++fi
++
+ check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
+
+ # d3d11va requires linking directly to dxgi and d3d11 if not building for
+diff --git a/libavfilter/Makefile b/libavfilter/Makefile
+index b3d3d981dd..abe7c3cd0d 100644
+--- a/libavfilter/Makefile
++++ b/libavfilter/Makefile
+@@ -583,6 +583,7 @@ OBJS-$(CONFIG_NULLSRC_FILTER) += vsrc_testsrc.o
+ OBJS-$(CONFIG_OPENCLSRC_FILTER) += vf_program_opencl.o opencl.o
+ OBJS-$(CONFIG_PAL75BARS_FILTER) += vsrc_testsrc.o
+ OBJS-$(CONFIG_PAL100BARS_FILTER) += vsrc_testsrc.o
++OBJS-$(CONFIG_PIPEWIREGRAB_FILTER) += vsrc_pipewiregrab.o
+ OBJS-$(CONFIG_RGBTESTSRC_FILTER) += vsrc_testsrc.o
+ OBJS-$(CONFIG_SIERPINSKI_FILTER) += vsrc_sierpinski.o
+ OBJS-$(CONFIG_SMPTEBARS_FILTER) += vsrc_testsrc.o
+diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
+index d7db46c2af..87204fec71 100644
+--- a/libavfilter/allfilters.c
++++ b/libavfilter/allfilters.c
+@@ -548,6 +548,7 @@ extern const AVFilter ff_vsrc_nullsrc;
+ extern const AVFilter ff_vsrc_openclsrc;
+ extern const AVFilter ff_vsrc_pal75bars;
+ extern const AVFilter ff_vsrc_pal100bars;
++extern const AVFilter ff_vsrc_pipewiregrab;
+ extern const AVFilter ff_vsrc_rgbtestsrc;
+ extern const AVFilter ff_vsrc_sierpinski;
+ extern const AVFilter ff_vsrc_smptebars;
+diff --git a/libavfilter/vsrc_pipewiregrab.c b/libavfilter/vsrc_pipewiregrab.c
+new file mode 100644
+index 0000000000..ff9c3468ab
+--- /dev/null
++++ b/libavfilter/vsrc_pipewiregrab.c
+@@ -0,0 +1,1373 @@
++/*
++ * PipeWire input grabber (ScreenCast)
++ * Copyright (C) 2024 Savoir-faire Linux, Inc.
++ *
++ * This file is part of FFmpeg.
++ *
++ * FFmpeg is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2.1 of the License, or (at your option) any later version.
++ *
++ * FFmpeg is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with FFmpeg; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
++ */
++
++/**
++ * @file
++ * PipeWireGrab video source
++ * @author Firas Ashkar <firas.ashkar at savoirfairelinux.com>
++ * @author Abhishek Ojha <abhishek.ojha at savoirfairelinux.com>
++ * @author François-Simon Fauteux-Chapleau <francois-simon.fauteux-chapleau at savoirfairelinux.com>
++ */
++
++#include "config.h"
++
++#include <fcntl.h>
++#include <linux/dma-buf.h>
++#include <math.h>
++#include <pthread.h>
++#include <stdatomic.h>
++#include <stdlib.h>
++#include <string.h>
++#include <sys/mman.h>
++#include <sys/queue.h>
++
++#include "libavutil/internal.h"
++#include "libavutil/mathematics.h"
++#include "libavutil/opt.h"
++#include "libavutil/parseutils.h"
++#include "libavutil/time.h"
++#include "libavutil/avstring.h"
++#include "libavformat/avformat.h"
++#include "libavformat/internal.h"
++#include "libavutil/avassert.h"
++#include "avfilter.h"
++#include "internal.h"
++
++#include <pipewire/pipewire.h>
++#include <pipewire/thread-loop.h>
++#include <spa/debug/types.h>
++#include <spa/param/video/format-utils.h>
++#include <spa/param/video/raw.h>
++#include <spa/param/video/type-info.h>
++
++#include <gio/gio.h>
++#include <gio/gunixfdlist.h>
++
++#ifndef __USE_XOPEN2K8
++#define F_DUPFD_CLOEXEC \
++ 1030 /* Duplicate file descriptor with close-on-exit set. */
++#endif
++
++#define REQUEST_PATH "/org/freedesktop/portal/desktop/request/%s/%s"
++#define BYTES_PER_PIXEL 4 /* currently all formats assume 4 bytes per pixel */
++#define MAX_SPA_PARAM 4 /* max number of params for spa pod */
++
++#define CURSOR_META_SIZE(width, height) \
++ (sizeof(struct spa_meta_cursor) + sizeof(struct spa_meta_bitmap) + \
++ width * height * 4)
++
++/**
++ * PipeWire capture types
++ */
++typedef enum {
++ DESKTOP_CAPTURE = 1,
++ WINDOW_CAPTURE = 2,
++} pw_capture_type;
++
++/**
++ * XDG Desktop Portal supported cursor modes
++ */
++enum PortalCursorMode {
++ PORTAL_CURSOR_MODE_HIDDEN = 1 << 0,
++ PORTAL_CURSOR_MODE_EMBEDDED = 1 << 1,
++};
++
++typedef struct PipewireGrabContext {
++ const AVClass *class;
++
++ pthread_cond_t pipewire_initialization_cond_var;
++ pthread_mutex_t pipewire_initialization_mutex;
++ atomic_int pipewire_initialization_over;
++
++ int pw_init_called;
++
++ pthread_mutex_t current_frame_mutex;
++ AVFrame *current_frame;
++
++ GDBusConnection *connection;
++ GDBusProxy *proxy;
++ GCancellable *cancellable;
++
++ char *sender_name;
++ char *session_handle;
++
++ uint64_t pipewire_external_node; // only needed because FFmpeg doesn't have a uint32 AVOption type
++ uint32_t pipewire_node;
++ int pipewire_fd;
++
++ uint32_t available_cursor_modes;
++
++ GMainLoop *glib_main_loop;
++ struct pw_thread_loop *thread_loop;
++ struct pw_context *context;
++
++ struct pw_core *core;
++ struct spa_hook core_listener;
++
++ struct pw_stream *stream;
++ struct spa_hook stream_listener;
++ struct spa_video_info format;
++
++ pw_capture_type capture_type;
++
++ int draw_mouse;
++
++ uint32_t width, height;
++
++ size_t frame_size;
++ uint8_t Bpp;
++ enum AVPixelFormat av_pxl_format;
++
++ int64_t time_frame;
++ int64_t frame_duration;
++
++ AVRational framerate;
++
++ int portal_error;
++ int pipewire_error;
++} PipewireGrabContext;
++
++/**
++ * DBus method/event marshalling structure
++ */
++struct DbusCallData {
++ AVFilterContext *ctx;
++ char *request_path;
++ guint signal_id;
++ gulong cancelled_id;
++};
++
++
++#define OFFSET(x) offsetof(PipewireGrabContext, x)
++#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
++static const AVOption pipewiregrab_options[] = {
++ { "framerate", "set video frame rate", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, { .str = "ntsc" }, 0, INT_MAX, FLAGS },
++ { "draw_mouse", "draw the mouse pointer", OFFSET(draw_mouse), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, FLAGS },
++ { "capture_type", "set the capture type (1 for screen, 2 for window)", OFFSET(capture_type), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 2, FLAGS },
++ { "fd", "set file descriptor to be used by PipeWire", OFFSET(pipewire_fd), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
++ { "node", "set PipeWire node", OFFSET(pipewire_external_node), AV_OPT_TYPE_UINT64, { .i64 = 0 }, 0, 0xffffffff, FLAGS },
++ { NULL },
++};
++
++AVFILTER_DEFINE_CLASS(pipewiregrab);
++
++/**
++ * Helper function to allow portal_init_screencast to stop and return an error
++ * code if a DBus operation/callback fails.
++ *
++ * @param ctx
++ * @param error error code
++ * @param message error message
++ */
++static void portal_abort(AVFilterContext *ctx, int error, const char *message)
++{
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ pw_ctx->portal_error = error;
++ av_log(ctx, AV_LOG_ERROR, "Aborting: %s\n", message);
++
++ if (pw_ctx->glib_main_loop &&
++ g_main_loop_is_running(pw_ctx->glib_main_loop))
++ g_main_loop_quit(pw_ctx->glib_main_loop);
++}
++
++/**
++ * Callback to handle PipeWire core info events
++ *
++ * @param user_data pointer to the filter's AVFilterContext
++ * @param info pw_core_info
++ */
++static void on_core_info_callback(void *user_data, const struct pw_core_info *info)
++{
++ AVFilterContext *ctx = user_data;
++ av_log(ctx, AV_LOG_DEBUG, "Server version: %s\n", info->version);
++ av_log(ctx, AV_LOG_INFO, "Library version: %s\n", pw_get_library_version());
++ av_log(ctx, AV_LOG_DEBUG, "Header version: %s\n", pw_get_headers_version());
++}
++
++/**
++ * Callback to handle PipeWire core done events
++ *
++ * @param user_data pointer to the filter's AVFilterContext
++ * @param id PipeWire object id of calling
++ * @param seq PipeWire object sequence
++ */
++static void on_core_done_callback(void *user_data, uint32_t id, int seq)
++{
++ AVFilterContext *ctx = user_data;
++ PipewireGrabContext *pw_ctx;
++
++ if (!ctx || !ctx->priv)
++ return;
++
++ pw_ctx = ctx->priv;
++
++ if (id == PW_ID_CORE)
++ pw_thread_loop_signal(pw_ctx->thread_loop, false);
++}
++
++/**
++ * Callback to handle Pipewire core error events
++ *
++ * @param user_data pointer to the filter's AVFilterContext
++ * @param id PipeWire object id of calling
++ * @param seq PipeWire object sequence
++ * @param res error number
++ * @param message error message
++ */
++static void on_core_error_callback(void *user_data, uint32_t id, int seq,
++ int res, const char *message)
++{
++ AVFilterContext *ctx = user_data;
++ PipewireGrabContext *pw_ctx;
++
++ if (!ctx)
++ return;
++
++ av_log(ctx, AV_LOG_ERROR,
++ "PipeWire core error: %s (id=%u, seq=%d, res=%d: %s)\n",
++ message, id, seq, res, g_strerror(-res));
++
++ pw_ctx = ctx->priv;
++ if (!pw_ctx) {
++ av_log(ctx, AV_LOG_ERROR,
++ "Invalid private context data\n");
++ return;
++ }
++
++ pw_thread_loop_signal(pw_ctx->thread_loop, false);
++
++ pw_ctx->pipewire_error = res;
++ atomic_store(&pw_ctx->pipewire_initialization_over, 1);
++ pthread_cond_signal(&pw_ctx->pipewire_initialization_cond_var);
++}
++
++/**
++ * PipeWire core events callbacks
++ */
++static const struct pw_core_events core_events = {
++ PW_VERSION_CORE_EVENTS,
++ .info = on_core_info_callback,
++ .done = on_core_done_callback,
++ .error = on_core_error_callback,
++};
++
++/**
++ * Helper function: convert spa video format to AVPixelFormat
++ *
++ * @param video_format spa video format to convert
++ * @return the corresponding AVPixelFormat
++ */
++static enum AVPixelFormat
++spa_video_format_to_av_pixel_format(enum spa_video_format video_format)
++{
++ switch (video_format) {
++ case SPA_VIDEO_FORMAT_RGBA:
++ case SPA_VIDEO_FORMAT_RGBx:
++ return AV_PIX_FMT_RGBA;
++
++ case SPA_VIDEO_FORMAT_BGRA:
++ case SPA_VIDEO_FORMAT_BGRx:
++ return AV_PIX_FMT_BGRA;
++
++ default:
++ return AV_PIX_FMT_NONE;
++ }
++}
++
++/**
++ * Callback to free a DbusCallData object's memory and unsubscribe from the
++ * associated dbus signal.
++ *
++ * @param ptr_dbus_call_data DBus marshalling structure
++ */
++static void dbus_call_data_free(struct DbusCallData *ptr_dbus_call_data)
++{
++ AVFilterContext *ctx;
++ PipewireGrabContext *pw_ctx;
++
++ if (!ptr_dbus_call_data)
++ return;
++
++ ctx = ptr_dbus_call_data->ctx;
++ if (!ctx || !ctx->priv)
++ return;
++
++ pw_ctx = ctx->priv;
++
++ if (ptr_dbus_call_data->signal_id)
++ g_dbus_connection_signal_unsubscribe(pw_ctx->connection,
++ ptr_dbus_call_data->signal_id);
++
++ if (ptr_dbus_call_data->cancelled_id > 0)
++ g_signal_handler_disconnect(pw_ctx->cancellable,
++ ptr_dbus_call_data->cancelled_id);
++
++ g_clear_pointer(&ptr_dbus_call_data->request_path, g_free);
++ av_free(ptr_dbus_call_data);
++}
++
++/**
++ * DBus callback of cancelled events
++ *
++ * @param cancellable (not used)
++ * @param user_data DBus marshalling structure
++ */
++static void on_cancelled_callback(GCancellable *cancellable, gpointer user_data)
++{
++ struct DbusCallData *ptr_dbus_call_data = user_data;
++ AVFilterContext *ctx = ptr_dbus_call_data->ctx;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ if (!pw_ctx)
++ return;
++
++ g_dbus_connection_call(pw_ctx->connection, "org.freedesktop.portal.Desktop",
++ ptr_dbus_call_data->request_path,
++ "org.freedesktop.portal.Request", "Close", NULL,
++ NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
++
++ av_log(ctx, AV_LOG_WARNING, "Portal request cancelled\n");
++
++ pw_ctx->portal_error = ECANCELED;
++ g_main_loop_quit(pw_ctx->glib_main_loop);
++}
++
++/**
++ * PipeWire callback of parameters changed events
++ *
++ * @param user_data DBus marshalling structure
++ * @param id contains chan param type
++ * @param param pointer to changed param structure
++ */
++static void on_stream_param_changed_callback(void *user_data, uint32_t id,
++ const struct spa_pod *param)
++{
++ struct spa_pod_builder pod_builder;
++ const struct spa_pod *params[MAX_SPA_PARAM];
++ uint32_t n_params = 0;
++ uint8_t params_buffer[4096];
++ int result;
++ PipewireGrabContext *pw_ctx;
++ AVFilterContext *ctx = user_data;
++
++ if (!ctx || !ctx->priv || !param)
++ return;
++
++ if (id != SPA_PARAM_Format) {
++ av_log(ctx, AV_LOG_WARNING,
++ "Ignoring non-Format param change\n");
++ return;
++ }
++
++ pw_ctx = ctx->priv;
++
++ result = spa_format_parse(param, &pw_ctx->format.media_type,
++ &pw_ctx->format.media_subtype);
++ if (result < 0) {
++ av_log(ctx, AV_LOG_ERROR, "Unable to parse media type\n");
++ pw_ctx->pipewire_error = AVERROR(EINVAL);
++ goto end;
++ }
++
++ if (pw_ctx->format.media_type != SPA_MEDIA_TYPE_video ||
++ pw_ctx->format.media_subtype != SPA_MEDIA_SUBTYPE_raw) {
++ av_log(ctx, AV_LOG_ERROR, "Unexpected media type\n");
++ pw_ctx->pipewire_error = AVERROR(EINVAL);
++ goto end;
++ }
++
++ spa_format_video_raw_parse(param, &pw_ctx->format.info.raw);
++
++ av_log(ctx, AV_LOG_INFO, "Negotiated format:\n");
++
++ av_log(ctx, AV_LOG_INFO, "Format: %d (%s)\n",
++ pw_ctx->format.info.raw.format,
++ spa_debug_type_find_name(spa_type_video_format,
++ pw_ctx->format.info.raw.format));
++ av_log(ctx, AV_LOG_INFO, "Size: %dx%d\n",
++ pw_ctx->format.info.raw.size.width,
++ pw_ctx->format.info.raw.size.height);
++ av_log(ctx, AV_LOG_INFO, "Framerate: %d/%d\n",
++ pw_ctx->format.info.raw.framerate.num,
++ pw_ctx->format.info.raw.framerate.denom);
++
++ pw_ctx->width = pw_ctx->format.info.raw.size.width;
++ pw_ctx->height = pw_ctx->format.info.raw.size.height;
++ pw_ctx->Bpp = BYTES_PER_PIXEL;
++ pw_ctx->frame_size = pw_ctx->width * pw_ctx->height * pw_ctx->Bpp;
++ if (pw_ctx->frame_size + AV_INPUT_BUFFER_PADDING_SIZE > INT_MAX) {
++ av_log(ctx, AV_LOG_ERROR, "Captured area is too large\n");
++ pw_ctx->pipewire_error = AVERROR(EINVAL);
++ goto end;
++ }
++
++ pw_ctx->av_pxl_format =
++ spa_video_format_to_av_pixel_format(pw_ctx->format.info.raw.format);
++ if (pw_ctx->av_pxl_format == AV_PIX_FMT_NONE) {
++ av_log(ctx, AV_LOG_ERROR,
++ "Unsupported buffer format: %d\n", pw_ctx->format.info.raw.format);
++ pw_ctx->pipewire_error = AVERROR(EINVAL);
++ goto end;
++ }
++
++ /* Video crop */
++ pod_builder = SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
++ params[n_params++] = spa_pod_builder_add_object(
++ &pod_builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
++ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_VideoCrop),
++ SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_region)));
++
++ /* Cursor */
++ params[n_params++] = spa_pod_builder_add_object(
++ &pod_builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
++ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Cursor), SPA_PARAM_META_size,
++ SPA_POD_CHOICE_RANGE_Int(CURSOR_META_SIZE(64, 64),
++ CURSOR_META_SIZE(1, 1),
++ CURSOR_META_SIZE(1024, 1024)));
++
++ /* Buffer options */
++ params[n_params++] = spa_pod_builder_add_object(
++ &pod_builder, SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
++ SPA_PARAM_BUFFERS_dataType,
++ SPA_POD_Int((1 << SPA_DATA_MemPtr) | (1 << SPA_DATA_MemFd)));
++
++ /* Meta header */
++ params[n_params++] = spa_pod_builder_add_object(
++ &pod_builder, SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
++ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
++ SPA_PARAM_META_size,
++ SPA_POD_Int(sizeof(struct spa_meta_header)));
++
++ pw_stream_update_params(pw_ctx->stream, params, n_params);
++
++end:
++ // Signal pipewiregrab_init that PipeWire initialization is over (either
++ // because it was completed successfully or because there was an error, in
++ // which case pw_ctx->pipewire_error will have been set to a nonzero value).
++ atomic_store(&pw_ctx->pipewire_initialization_over, 1);
++ pthread_cond_signal(&pw_ctx->pipewire_initialization_cond_var);
++}
++
++/**
++ * PipeWire callback of state changed events
++ *
++ * @param user_data DBus marshalling structure
++ * @param old PipeWire stream old state
++ * @param state PipeWire stream current state
++ * @param error received error information
++ */
++static void on_stream_state_changed_callback(void *user_data,
++ enum pw_stream_state old,
++ enum pw_stream_state state,
++ const char *error)
++{
++ AVFilterContext *ctx = user_data;
++ if (!ctx)
++ return;
++
++ av_log(ctx, AV_LOG_INFO, "stream state: \"%s\"\n",
++ pw_stream_state_as_string(state));
++}
++
++/**
++ * Find most recent buffer received in a PipeWire stream
++ *
++ * @param stream stream to get buffer from
++ * @return most recent buffer in the stream
++ */
++static struct pw_buffer *find_most_recent_buffer_and_recycle_olders(struct pw_stream *stream)
++{
++ struct pw_buffer *pw_buf = NULL;
++ while (1) {
++ struct pw_buffer *aux = pw_stream_dequeue_buffer(stream);
++ if (!aux)
++ break;
++ if (pw_buf)
++ pw_stream_queue_buffer(stream, pw_buf);
++ pw_buf = aux;
++ }
++ return pw_buf;
++}
++
++/**
++ * Our data processing function
++ *
++ * @param user_data DBus marshalling structure
++ */
++static void on_stream_process_callback(void *user_data)
++{
++ struct spa_buffer *spa_buf = NULL;
++ struct pw_buffer *pw_buf = NULL;
++ uint8_t *map = NULL;
++ void *sdata = NULL;
++ struct spa_meta_header *header = NULL;
++ struct spa_meta_region *frame_region;
++ uint32_t frame_width;
++ uint32_t frame_height;
++ AVFilterContext *ctx = user_data;
++ PipewireGrabContext *pw_ctx = NULL;
++
++ if (!ctx || !ctx->priv)
++ return;
++
++ pw_ctx = ctx->priv;
++
++ // We need to wait for pw_ctx->current_frame to have been allocated before
++ // we can use it to get frames from the PipeWire thread to FFmpeg
++ pthread_mutex_lock(&pw_ctx->current_frame_mutex);
++ if (!pw_ctx->current_frame) {
++ pthread_mutex_unlock(&pw_ctx->current_frame_mutex);
++ return;
++ }
++ pthread_mutex_unlock(&pw_ctx->current_frame_mutex);
++
++ // Get a buffer from PipeWire
++ pw_buf = find_most_recent_buffer_and_recycle_olders(pw_ctx->stream);
++ if (!pw_buf) {
++ av_log(ctx, AV_LOG_ERROR, "Out of buffers\n");
++ return;
++ }
++
++ // Check whether the buffer is corrupted
++ spa_buf = pw_buf->buffer;
++ header = spa_buffer_find_meta_data(spa_buf,
++ SPA_META_Header, sizeof(*header));
++ if (header && (header->flags & SPA_META_HEADER_FLAG_CORRUPTED)) {
++ av_log(ctx, AV_LOG_ERROR, "Corrupted PipeWire buffer\n");
++ goto end;
++ }
++
++ // Get a pointer to the buffer's data
++ if (spa_buf->datas[0].type == SPA_DATA_MemFd ) {
++ map = mmap(NULL, spa_buf->datas[0].maxsize + spa_buf->datas[0].mapoffset,
++ PROT_READ, MAP_PRIVATE, spa_buf->datas[0].fd, 0);
++ if (map == MAP_FAILED) {
++ av_log(ctx, AV_LOG_ERROR, "mmap failed! error %s\n", g_strerror(errno));
++ goto end;
++ }
++ sdata = SPA_PTROFF(map, spa_buf->datas[0].mapoffset, uint8_t);
++ } else if (spa_buf->datas[0].type == SPA_DATA_MemPtr) {
++ if (spa_buf->datas[0].data == NULL) {
++ av_log(ctx, AV_LOG_ERROR, "No data\n");
++ goto end;
++ }
++ map = NULL;
++ sdata = spa_buf->datas[0].data;
++ } else {
++ av_log(ctx, AV_LOG_ERROR, "Buffer is not valid\n");
++ goto end;
++ }
++
++ if ((frame_region = spa_buffer_find_meta_data(spa_buf, SPA_META_VideoCrop,
++ sizeof(*frame_region)))
++ && spa_meta_region_is_valid(frame_region)) {
++ frame_width = frame_region->region.size.width;
++ frame_height = frame_region->region.size.height;
++ } else {
++ frame_width = pw_ctx->width;
++ frame_height = pw_ctx->height;
++ }
++
++ // Update current_frame with the new data
++ pthread_mutex_lock(&pw_ctx->current_frame_mutex);
++ memcpy(pw_ctx->current_frame->data[0], sdata, spa_buf->datas[0].chunk->size);
++ pw_ctx->current_frame->width = frame_width;
++ pw_ctx->current_frame->height = frame_height;
++ pthread_mutex_unlock(&pw_ctx->current_frame_mutex);
++
++ // Cleanup
++ if (spa_buf->datas[0].type == SPA_DATA_MemFd)
++ munmap(map, spa_buf->datas[0].maxsize + spa_buf->datas[0].mapoffset);
++end:
++ pw_stream_queue_buffer(pw_ctx->stream, pw_buf);
++ return;
++}
++
++static const struct pw_stream_events stream_events = {
++ PW_VERSION_STREAM_EVENTS,
++ .state_changed = on_stream_state_changed_callback,
++ .param_changed = on_stream_param_changed_callback,
++ .process = on_stream_process_callback,
++};
++
++static struct DbusCallData *subscribe_to_signal(AVFilterContext *ctx,
++ const char *path,
++ GDBusSignalCallback callback)
++{
++ struct DbusCallData *ptr_dbus_call_data;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ ptr_dbus_call_data = (struct DbusCallData *)av_mallocz(sizeof(struct DbusCallData));
++ if (!ptr_dbus_call_data)
++ return NULL;
++
++ ptr_dbus_call_data->ctx = ctx;
++ ptr_dbus_call_data->request_path = g_strdup(path);
++ ptr_dbus_call_data->cancelled_id =
++ g_signal_connect(pw_ctx->cancellable, "cancelled",
++ G_CALLBACK(on_cancelled_callback),
++ ptr_dbus_call_data /* user_data */);
++ ptr_dbus_call_data->signal_id = g_dbus_connection_signal_subscribe(
++ pw_ctx->connection, "org.freedesktop.portal.Desktop" /*sender*/,
++ "org.freedesktop.portal.Request" /*interface_name*/,
++ "Response" /*member: dbus signal name*/,
++ ptr_dbus_call_data->request_path /*object_path*/, NULL,
++ G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE, callback, ptr_dbus_call_data, NULL);
++
++ return ptr_dbus_call_data;
++}
++
++static int play_pipewire_stream(AVFilterContext *ctx)
++{
++ int ret;
++ const struct spa_pod *ptr_spa_pod;
++ uint8_t buffer[4096];
++ struct spa_pod_builder spa_pod_bldr = {
++ 0,
++ };
++
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ pw_init(NULL, NULL);
++ pw_ctx->pw_init_called = 1;
++
++ pw_ctx->thread_loop =
++ pw_thread_loop_new("thread loop", NULL);
++ if (!pw_ctx->thread_loop) {
++ av_log(ctx, AV_LOG_ERROR, "pw_thread_loop_new failed\n");
++ return AVERROR(ENOMEM);
++ }
++
++ pw_ctx->context =
++ pw_context_new(pw_thread_loop_get_loop(pw_ctx->thread_loop), NULL, 0);
++ if (!pw_ctx->context) {
++ av_log(ctx, AV_LOG_ERROR, "pw_context_new failed\n");
++ ret = AVERROR(ENOMEM);
++ goto fail;
++ }
++
++ if (pw_thread_loop_start(pw_ctx->thread_loop) < 0) {
++ av_log(ctx, AV_LOG_ERROR, "pw_thread_loop_start failed\n");
++ ret = AVERROR(EFAULT);
++ goto fail;
++ }
++
++ pw_thread_loop_lock(pw_ctx->thread_loop);
++
++ // Core
++ pw_ctx->core =
++ pw_context_connect_fd(pw_ctx->context,
++ fcntl(pw_ctx->pipewire_fd, F_DUPFD_CLOEXEC, 3),
++ NULL, 0);
++ if (!pw_ctx->core) {
++ ret = AVERROR(errno);
++ av_log(ctx, AV_LOG_ERROR, "pw_context_connect_fd failed\n");
++ pw_thread_loop_unlock(pw_ctx->thread_loop);
++ goto fail;
++ }
++
++ pw_core_add_listener(pw_ctx->core, &pw_ctx->core_listener, &core_events,
++ ctx /* user_data */);
++
++ // Stream
++ pw_ctx->stream = pw_stream_new(
++ pw_ctx->core, "wayland grab",
++ pw_properties_new(PW_KEY_MEDIA_TYPE, "Video", PW_KEY_MEDIA_CATEGORY,
++ "Capture", PW_KEY_MEDIA_ROLE, "Screen", NULL));
++
++ if (!pw_ctx->stream) {
++ av_log(ctx, AV_LOG_ERROR, "pw_stream_new failed\n");
++ ret = AVERROR(ENOMEM);
++ pw_thread_loop_unlock(pw_ctx->thread_loop);
++ goto fail;
++ }
++
++ pw_stream_add_listener(pw_ctx->stream, &pw_ctx->stream_listener,
++ &stream_events, ctx /* user_data */);
++
++ // Stream parameters
++ spa_pod_bldr = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
++ ptr_spa_pod = spa_pod_builder_add_object(
++ &spa_pod_bldr, SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
++ SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
++ SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
++ SPA_FORMAT_VIDEO_format,
++ SPA_POD_CHOICE_ENUM_Id(4, SPA_VIDEO_FORMAT_RGBA, SPA_VIDEO_FORMAT_RGBx,
++ SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA),
++ SPA_FORMAT_VIDEO_size,
++ SPA_POD_CHOICE_RANGE_Rectangle(&SPA_RECTANGLE(320, 240),
++ &SPA_RECTANGLE(1, 1),
++ &SPA_RECTANGLE(4096, 4096)),
++ SPA_FORMAT_VIDEO_framerate,
++ SPA_POD_CHOICE_RANGE_Fraction(
++ &SPA_FRACTION(pw_ctx->framerate.num,
++ pw_ctx->framerate.den),
++ &SPA_FRACTION(0, 1), &SPA_FRACTION(144, 1)));
++
++ ret = pw_stream_connect(
++ pw_ctx->stream, PW_DIRECTION_INPUT, pw_ctx->pipewire_node,
++ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_MAP_BUFFERS, &ptr_spa_pod, 1);
++ if (ret != 0) {
++ av_log(ctx, AV_LOG_ERROR, "pw_stream_connect failed\n");
++ pw_thread_loop_unlock(pw_ctx->thread_loop);
++ goto fail;
++ }
++
++ av_log(ctx, AV_LOG_INFO, "Starting screen capture ...\n");
++ pw_thread_loop_unlock(pw_ctx->thread_loop);
++ return 0;
++
++fail:
++ if (pw_ctx->core) {
++ pw_core_disconnect(pw_ctx->core);
++ pw_ctx->core = NULL;
++ }
++ if (pw_ctx->context) {
++ pw_context_destroy(pw_ctx->context);
++ pw_ctx->context = NULL;
++ }
++ if (pw_ctx->thread_loop) {
++ pw_thread_loop_destroy(pw_ctx->thread_loop);
++ pw_ctx->thread_loop = NULL;
++ }
++
++ return ret;
++}
++
++static void portal_open_pipewire_remote(AVFilterContext *ctx)
++{
++ GUnixFDList* fd_list = NULL;
++ GVariant* result = NULL;
++ GError* error = NULL;
++ int fd_index;
++ GVariantBuilder builder;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
++
++ result = g_dbus_proxy_call_with_unix_fd_list_sync(
++ pw_ctx->proxy, "OpenPipeWireRemote",
++ g_variant_new("(oa{sv})", pw_ctx->session_handle, &builder),
++ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &fd_list, pw_ctx->cancellable,
++ &error);
++ if (error)
++ goto fail;
++
++ g_variant_get(result, "(h)", &fd_index);
++ g_variant_unref(result);
++
++ pw_ctx->pipewire_fd = g_unix_fd_list_get(fd_list, fd_index, &error);
++ g_object_unref(fd_list);
++ if (error)
++ goto fail;
++
++ g_main_loop_quit(pw_ctx->glib_main_loop);
++ return;
++
++fail:
++ av_log(ctx, AV_LOG_ERROR,
++ "Error retrieving PipeWire fd: %s\n", error->message);
++ g_error_free(error);
++ portal_abort(ctx, EIO, "Failed to open PipeWire remote");
++}
++
++static void on_start_response_received_callback(
++ GDBusConnection *connection, const char *sender_name,
++ const char *object_path, const char *interface_name,
++ const char *signal_name, GVariant *parameters, gpointer user_data)
++{
++ GVariant* stream_properties = NULL;
++ GVariant* streams = NULL;
++ GVariant* result = NULL;
++ GVariantIter iter;
++ uint32_t response;
++
++ struct DbusCallData *ptr_dbus_call_data = user_data;
++ AVFilterContext *ctx = ptr_dbus_call_data->ctx;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ if (!pw_ctx) {
++ portal_abort(ctx, EINVAL, "Invalid private context data");
++ return;
++ }
++
++ g_clear_pointer(&ptr_dbus_call_data, dbus_call_data_free);
++
++ g_variant_get(parameters, "(u@a{sv})", &response, &result);
++
++ if (response) {
++ g_variant_unref(result);
++ portal_abort(
++ ctx, EACCES, "Failed to start screencast, denied or cancelled by user");
++ return;
++ }
++
++ streams = g_variant_lookup_value(result, "streams", G_VARIANT_TYPE_ARRAY);
++
++ g_variant_iter_init(&iter, streams);
++ av_assert0(g_variant_iter_n_children(&iter) == 1);
++
++ g_variant_iter_loop(&iter, "(u@a{sv})", &pw_ctx->pipewire_node,
++ &stream_properties);
++
++ av_log(ctx, AV_LOG_INFO, "Monitor selected, setting up screencast\n\n");
++
++ g_variant_unref(result);
++ g_variant_unref(streams);
++ g_variant_unref(stream_properties);
++
++ portal_open_pipewire_remote(ctx);
++}
++
++static int portal_call_dbus_method(AVFilterContext *ctx,
++ const gchar *method_name, GVariant *parameters)
++{
++ GVariant* result;
++ GError* error = NULL;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ result = g_dbus_proxy_call_sync(pw_ctx->proxy, method_name, parameters,
++ G_DBUS_CALL_FLAGS_NONE, -1,
++ pw_ctx->cancellable, &error);
++ if (error) {
++ av_log(ctx, AV_LOG_ERROR,
++ "Call to DBus method '%s' failed: %s\n",
++ method_name, error->message);
++ g_error_free(error);
++ return EIO;
++ }
++ g_variant_unref(result);
++ return 0;
++}
++
++static void portal_start(AVFilterContext *ctx)
++{
++ int ret;
++ const char *request_token;
++ g_autofree char *request_path;
++ GVariantBuilder builder;
++ GVariant *parameters;
++ struct DbusCallData *ptr_dbus_call_data;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ if (!pw_ctx) {
++ portal_abort(ctx, EINVAL, "Invalid private context data");
++ return;
++ }
++
++ request_token = "pipewiregrabStart";
++ request_path = g_strdup_printf(REQUEST_PATH, pw_ctx->sender_name, request_token);
++
++ av_log(ctx, AV_LOG_INFO, "Asking for monitor…\n");
++
++ ptr_dbus_call_data = subscribe_to_signal(ctx, request_path,
++ on_start_response_received_callback);
++ if (!ptr_dbus_call_data) {
++ portal_abort(ctx, ENOMEM, "Failed to allocate DBus call data");
++ return;
++ }
++
++ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
++ g_variant_builder_add(&builder, "{sv}", "handle_token",
++ g_variant_new_string(request_token));
++ parameters = g_variant_new("(osa{sv})", pw_ctx->session_handle, "", &builder);
++
++ ret = portal_call_dbus_method(ctx, "Start", parameters);
++ if (ret != 0)
++ portal_abort(ctx, ret, "Failed to start screen cast session");
++}
++
++static void on_select_sources_response_received_callback(
++ GDBusConnection *connection, const char *sender_name,
++ const char *object_path, const char *interface_name,
++ const char *signal_name, GVariant *parameters, gpointer user_data)
++{
++ GVariant* ret = NULL;
++ uint32_t response;
++ struct DbusCallData *ptr_dbus_call_data = user_data;
++ AVFilterContext *ctx = ptr_dbus_call_data->ctx;
++
++ av_log(ctx, AV_LOG_INFO,
++ "Response to select source received\n");
++
++ g_clear_pointer(&ptr_dbus_call_data, dbus_call_data_free);
++
++ g_variant_get(parameters, "(u@a{sv})", &response, &ret);
++ g_variant_unref(ret);
++ if (response) {
++ portal_abort(
++ ctx, EACCES, "Failed to select screencast sources, denied or cancelled by user");
++ return;
++ }
++
++ portal_start(ctx);
++}
++
++static void portal_select_sources(AVFilterContext *ctx)
++{
++ int ret;
++ const char *request_token;
++ g_autofree char *request_path;
++ GVariantBuilder builder;
++ GVariant *parameters;
++ struct DbusCallData *ptr_dbus_call_data;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ request_token = "pipewiregrabSelectSources";
++ request_path = g_strdup_printf(REQUEST_PATH, pw_ctx->sender_name, request_token);
++
++ ptr_dbus_call_data = subscribe_to_signal(ctx, request_path,
++ on_select_sources_response_received_callback);
++ if (!ptr_dbus_call_data) {
++ portal_abort(ctx, ENOMEM, "Failed to allocate DBus call data");
++ return;
++ }
++
++ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
++ g_variant_builder_add(&builder, "{sv}", "types",
++ g_variant_new_uint32(pw_ctx->capture_type));
++ g_variant_builder_add(&builder, "{sv}", "multiple",
++ g_variant_new_boolean(FALSE));
++ g_variant_builder_add(&builder, "{sv}", "handle_token",
++ g_variant_new_string(request_token));
++
++ if ((pw_ctx->available_cursor_modes & PORTAL_CURSOR_MODE_EMBEDDED)
++ && pw_ctx->draw_mouse)
++ g_variant_builder_add(&builder, "{sv}", "cursor_mode",
++ g_variant_new_uint32(PORTAL_CURSOR_MODE_EMBEDDED));
++ else
++ g_variant_builder_add(&builder, "{sv}", "cursor_mode",
++ g_variant_new_uint32(PORTAL_CURSOR_MODE_HIDDEN));
++ parameters = g_variant_new("(oa{sv})", pw_ctx->session_handle, &builder);
++
++ ret = portal_call_dbus_method(ctx, "SelectSources", parameters);
++ if (ret != 0)
++ portal_abort(ctx, ret, "Failed to select sources for screen cast session");
++}
++
++static void on_create_session_response_received_callback(
++ GDBusConnection *connection, const char *sender_name,
++ const char *object_path, const char *interface_name,
++ const char *signal_name, GVariant *parameters, gpointer user_data)
++{
++ uint32_t response;
++ GVariant* result = NULL;
++ struct DbusCallData *ptr_dbus_call_data = user_data;
++ AVFilterContext *ctx = ptr_dbus_call_data->ctx;
++
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ if (!pw_ctx) {
++ portal_abort(ctx, EINVAL, "Invalid private context data");
++ return;
++ }
++
++ g_clear_pointer(&ptr_dbus_call_data, dbus_call_data_free);
++
++ g_variant_get(parameters, "(u@a{sv})", &response, &result);
++
++ if (response != 0) {
++ g_variant_unref(result);
++ portal_abort(
++ ctx, EACCES, "Failed to create screencast session, denied or cancelled by user");
++ return;
++ }
++
++ av_log(ctx, AV_LOG_DEBUG, "Screencast session created\n");
++
++ g_variant_lookup(result, "session_handle", "s", &pw_ctx->session_handle);
++ g_variant_unref(result);
++
++ portal_select_sources(ctx);
++}
++
++/**
++ * Function to create a screen cast session
++ *
++ * @param ctx
++ */
++static void portal_create_session(AVFilterContext *ctx)
++{
++ int ret;
++ GVariantBuilder builder;
++ GVariant *parameters;
++ const char *request_token;
++ g_autofree char *request_path;
++ struct DbusCallData *ptr_dbus_call_data;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ request_token = "pipewiregrabCreateSession";
++ request_path = g_strdup_printf(REQUEST_PATH, pw_ctx->sender_name, request_token);
++
++ ptr_dbus_call_data = subscribe_to_signal(ctx, request_path,
++ on_create_session_response_received_callback);
++ if (!ptr_dbus_call_data) {
++ portal_abort(ctx, ENOMEM, "Failed to allocate DBus call data");
++ return;
++ }
++
++ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
++ g_variant_builder_add(&builder, "{sv}", "handle_token",
++ g_variant_new_string(request_token));
++ g_variant_builder_add(&builder, "{sv}", "session_handle_token",
++ g_variant_new_string("pipewiregrab"));
++ parameters = g_variant_new("(a{sv})", &builder);
++
++ ret = portal_call_dbus_method(ctx, "CreateSession", parameters);
++ if (ret != 0)
++ portal_abort(ctx, ret, "Failed to create screen cast session");
++}
++
++/**
++ * Helper function: get available cursor modes and update the
++ * PipewireGrabContext accordingly
++ *
++ * @param ctx
++ */
++static void portal_update_available_cursor_modes(AVFilterContext *ctx)
++{
++ GVariant* cached_cursor_modes = NULL;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ cached_cursor_modes =
++ g_dbus_proxy_get_cached_property(pw_ctx->proxy, "AvailableCursorModes");
++
++ pw_ctx->available_cursor_modes =
++ cached_cursor_modes ? g_variant_get_uint32(cached_cursor_modes) : 0;
++
++ g_variant_unref(cached_cursor_modes);
++}
++
++static int create_dbus_proxy(AVFilterContext *ctx)
++{
++ GError* error = NULL;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ pw_ctx->proxy = g_dbus_proxy_new_sync(
++ pw_ctx->connection, G_DBUS_PROXY_FLAGS_NONE, NULL,
++ "org.freedesktop.portal.Desktop",
++ "/org/freedesktop/portal/desktop",
++ "org.freedesktop.portal.ScreenCast", NULL, &error);
++ if (error) {
++ av_log(ctx, AV_LOG_ERROR,
++ "Error creating proxy: %s\n", error->message);
++ g_error_free(error);
++ return EPERM;
++ }
++ return 0;
++}
++
++/**
++ * Create DBus connection and related objects
++ *
++ * @param ctx
++ */
++static int create_dbus_connection(AVFilterContext *ctx)
++{
++ char *aux;
++ GError* error = NULL;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++
++ pw_ctx->cancellable = g_cancellable_new();
++
++ pw_ctx->connection = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
++ if (error) {
++ av_log(ctx, AV_LOG_ERROR,
++ "Error getting session bus: %s\n", error->message);
++ g_error_free(error);
++ return EPERM;
++ }
++
++ aux = g_strdup(g_dbus_connection_get_unique_name(pw_ctx->connection) + 1);
++ pw_ctx->sender_name = av_strireplace(aux, ".", "_");
++ av_log(ctx, AV_LOG_DEBUG, "Initialized (sender name: %s)\n",
++ pw_ctx->sender_name);
++ return 0;
++}
++
++
++/**
++ * Use XDG Desktop Portal's ScreenCast interface to open a file descriptor that
++ * can be used by PipeWire to access the screen cast streams.
++ * (https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.ScreenCast.html)
++ *
++ * @param ctx
++ */
++static int portal_init_screencast(AVFilterContext *ctx)
++{
++ int ret = 0;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ GMainContext *glib_main_context;
++
++ // Create a new GLib context and set it as the default for the current thread.
++ // This ensures that the callbacks from DBus operations started in this thread are
++ // handled by the GLib main loop defined below, even if pipewiregrab_init was
++ // called by a program which also uses GLib and already had its own main loop running.
++ glib_main_context = g_main_context_new();
++ g_main_context_push_thread_default(glib_main_context);
++ pw_ctx->glib_main_loop = g_main_loop_new(glib_main_context, FALSE);
++ if (!pw_ctx->glib_main_loop) {
++ av_log(ctx, AV_LOG_ERROR, "g_main_loop_new failed\n");
++ ret = ENOMEM;
++ }
++
++ ret = create_dbus_connection(ctx);
++ if (ret != 0)
++ goto exit_glib_loop;
++
++ ret = create_dbus_proxy(ctx);
++ if (ret != 0)
++ goto exit_glib_loop;
++
++ portal_update_available_cursor_modes(ctx);
++ portal_create_session(ctx);
++ if (pw_ctx->portal_error) {
++ ret = pw_ctx->portal_error;
++ goto exit_glib_loop;
++ }
++
++ g_main_loop_run(pw_ctx->glib_main_loop);
++ // The main loop will run until it's stopped by portal_open_pipewire_remote (if
++ // all DBus method calls were successfully), portal_abort (in case of error) or
++ // on_cancelled_callback (if a DBus request is cancelled).
++ // In the latter two cases, pw_ctx->portal_error gets set to a nonzero value.
++ if (pw_ctx->portal_error)
++ ret = pw_ctx->portal_error;
++
++exit_glib_loop:
++ g_main_loop_unref(pw_ctx->glib_main_loop);
++ pw_ctx->glib_main_loop = NULL;
++ g_main_context_pop_thread_default(glib_main_context);
++ g_main_context_unref(glib_main_context);
++
++ return AVERROR(ret);
++}
++
++static av_cold int pipewiregrab_init(AVFilterContext *ctx)
++{
++ int ret;
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ if (!pw_ctx) {
++ av_log(ctx, AV_LOG_ERROR,
++ "Invalid private context data!\n");
++ return AVERROR(EINVAL);
++ }
++
++ atomic_init(&pw_ctx->pipewire_initialization_over, 0);
++ pthread_cond_init(&pw_ctx->pipewire_initialization_cond_var, NULL);
++ pthread_mutex_init(&pw_ctx->pipewire_initialization_mutex, NULL);
++ pthread_mutex_init(&pw_ctx->current_frame_mutex, NULL);
++
++ pw_ctx->pipewire_node = pw_ctx->pipewire_external_node;
++ if (pw_ctx->pipewire_fd == 0) {
++ ret = portal_init_screencast(ctx);
++ if (ret != 0) {
++ atomic_store(&pw_ctx->pipewire_initialization_over, 1);
++ pthread_cond_signal(&pw_ctx->pipewire_initialization_cond_var);
++ return ret;
++ }
++ }
++
++ ret = play_pipewire_stream(ctx);
++ if (ret != 0)
++ return ret;
++
++ // Wait until PipeWire initialization is over
++ pthread_mutex_lock(&pw_ctx->pipewire_initialization_mutex);
++ while (!atomic_load(&pw_ctx->pipewire_initialization_over)) {
++ pthread_cond_wait(&pw_ctx->pipewire_initialization_cond_var,
++ &pw_ctx->pipewire_initialization_mutex);
++ }
++ pthread_mutex_unlock(&pw_ctx->pipewire_initialization_mutex);
++
++ if (pw_ctx->pipewire_error)
++ return pw_ctx->pipewire_error;
++
++ return 0;
++}
++
++static void pipewiregrab_uninit(AVFilterContext *ctx)
++{
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ if (!pw_ctx)
++ return;
++
++ if (pw_ctx->glib_main_loop &&
++ g_main_loop_is_running(pw_ctx->glib_main_loop)) {
++ // Cancel ongoing DBus operation, if any
++ g_cancellable_cancel(pw_ctx->cancellable);
++ pthread_mutex_lock(&pw_ctx->pipewire_initialization_mutex);
++ while (!atomic_load(&pw_ctx->pipewire_initialization_over)) {
++ pthread_cond_wait(&pw_ctx->pipewire_initialization_cond_var,
++ &pw_ctx->pipewire_initialization_mutex);
++ }
++ pthread_mutex_unlock(&pw_ctx->pipewire_initialization_mutex);
++ }
++ g_clear_object(&pw_ctx->cancellable);
++
++ // PipeWire cleanup
++ if (pw_ctx->thread_loop) {
++ pw_thread_loop_signal(pw_ctx->thread_loop, false);
++ pw_thread_loop_unlock(pw_ctx->thread_loop);
++ pw_thread_loop_stop(pw_ctx->thread_loop);
++ }
++ if (pw_ctx->stream) {
++ pw_stream_disconnect(pw_ctx->stream);
++ g_clear_pointer(&pw_ctx->stream, pw_stream_destroy);
++ pw_ctx->stream = NULL;
++ }
++ if (pw_ctx->core){
++ pw_core_disconnect(pw_ctx->core);
++ pw_ctx->core = NULL;
++ }
++ if (pw_ctx->context) {
++ pw_context_destroy(pw_ctx->context);
++ pw_ctx->context = NULL;
++ }
++ if (pw_ctx->thread_loop) {
++ pw_thread_loop_destroy(pw_ctx->thread_loop);
++ pw_ctx->thread_loop = NULL;
++ }
++ if (pw_ctx->pw_init_called) {
++ pw_deinit();
++ pw_ctx->pw_init_called = 0;
++ }
++ if (pw_ctx->pipewire_fd > 0) {
++ close(pw_ctx->pipewire_fd);
++ pw_ctx->pipewire_fd = 0;
++ }
++ av_frame_free(&pw_ctx->current_frame);
++
++ // DBus cleanup
++ if (pw_ctx->session_handle) {
++ g_dbus_connection_call(
++ pw_ctx->connection, "org.freedesktop.portal.Desktop",
++ pw_ctx->session_handle, "org.freedesktop.portal.Session", "Close",
++ NULL, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
++
++ g_clear_pointer(&pw_ctx->session_handle, g_free);
++ }
++ g_clear_object(&pw_ctx->connection);
++ g_clear_object(&pw_ctx->proxy);
++ g_clear_pointer(&pw_ctx->sender_name, g_free);
++}
++
++static int pipewiregrab_config_props(AVFilterLink *outlink)
++{
++ AVFrame *frame;
++ PipewireGrabContext *pw_ctx = outlink->src->priv;
++
++ AVRational time_base = av_inv_q(pw_ctx->framerate);
++ pw_ctx->frame_duration = av_rescale_q(1, time_base, AV_TIME_BASE_Q);
++ pw_ctx->time_frame = av_gettime_relative();
++
++ outlink->w = pw_ctx->width;
++ outlink->h = pw_ctx->height;
++ outlink->time_base = AV_TIME_BASE_Q;
++ outlink->frame_rate = pw_ctx->framerate;
++
++ frame = ff_get_video_buffer(outlink, pw_ctx->width, pw_ctx->height);
++ if (!frame)
++ return AVERROR(ENOMEM);
++ pthread_mutex_lock(&pw_ctx->current_frame_mutex);
++ pw_ctx->current_frame = frame;
++ pthread_mutex_unlock(&pw_ctx->current_frame_mutex);
++
++ return 0;
++}
++
++/**
++ * Helper function: calculate the wait time based
++ * on the frame duration
++ *
++ * @param pw_ctx
++ * @return current time
++ */
++static int64_t wait_frame(PipewireGrabContext *pw_ctx)
++{
++ int64_t curtime, delay;
++
++ /* Calculate the time of the next frame */
++ pw_ctx->time_frame += pw_ctx->frame_duration;
++
++ /* wait based on the frame rate */
++ while (1) {
++ curtime = av_gettime_relative();
++ delay = pw_ctx->time_frame - curtime;
++ if (delay <= 0)
++ break;
++ av_usleep(delay);
++ }
++
++ return curtime;
++}
++
++static int pipewiregrab_request_frame(AVFilterLink *outlink)
++{
++ int ret;
++ PipewireGrabContext *pw_ctx = outlink->src->priv;
++ AVFrame *frame = av_frame_alloc();
++ if (!frame)
++ return AVERROR(ENOMEM);
++
++ wait_frame(pw_ctx);
++
++ pthread_mutex_lock(&pw_ctx->current_frame_mutex);
++ ret = av_frame_ref(frame, pw_ctx->current_frame);
++ pthread_mutex_unlock(&pw_ctx->current_frame_mutex);
++ if (ret < 0) {
++ av_frame_free(&frame);
++ return ret;
++ }
++
++ frame->pts = av_gettime();
++ frame->duration = pw_ctx->frame_duration;
++ frame->sample_aspect_ratio = (AVRational) {1, 1};
++ frame->format = pw_ctx->av_pxl_format;
++
++ return ff_filter_frame(outlink, frame);
++}
++
++static int pipewiregrab_query_formats(AVFilterContext *ctx)
++{
++ PipewireGrabContext *pw_ctx = ctx->priv;
++ enum AVPixelFormat pix_fmts[] = {pw_ctx->av_pxl_format, AV_PIX_FMT_NONE};
++
++ return ff_set_common_formats_from_list(ctx, pix_fmts);
++}
++
++static const AVFilterPad pipewiregrab_outputs[] = {
++ {
++ .name = "default",
++ .type = AVMEDIA_TYPE_VIDEO,
++ .request_frame = pipewiregrab_request_frame,
++ .config_props = pipewiregrab_config_props,
++ },
++};
++
++const AVFilter ff_vsrc_pipewiregrab= {
++ .name = "pipewiregrab",
++ .description = NULL_IF_CONFIG_SMALL("Capture screen or window using PipeWire."),
++ .priv_size = sizeof(struct PipewireGrabContext),
++ .priv_class = &pipewiregrab_class,
++ .init = pipewiregrab_init,
++ .uninit = pipewiregrab_uninit,
++ .inputs = NULL,
++ FILTER_OUTPUTS(pipewiregrab_outputs),
++ FILTER_QUERY_FUNC(pipewiregrab_query_formats),
++};
diff --git a/gnu/packages/patches/gcc-13-cross-system-header-dir.patch b/gnu/packages/patches/gcc-13-cross-system-header-dir.patch
new file mode 100644
index 0000000000..75f80ea9d2
--- /dev/null
+++ b/gnu/packages/patches/gcc-13-cross-system-header-dir.patch
@@ -0,0 +1,32 @@
+From 8b001f38cc713190642194b55e02a56346f51494 Mon Sep 17 00:00:00 2001
+From: Jean-Pierre De Jesus DIAZ <jean@foundation.xyz>
+Date: Fri, 12 Apr 2024 12:18:24 +0200
+Subject: [PATCH] Fix CROSS_SYSTEM_HEADER_DIR value for Guix.
+
+* gcc/Makefile.in (CROSS_SYSTEM_HEADER_DIR): Always use default value.
+---
+ gcc/Makefile.in | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 775aaa1b3c4..06d192fa9ed 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+ NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+-ifeq (@includedir@,$(prefix)/include)
+- CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+-else
+- CROSS_SYSTEM_HEADER_DIR = @includedir@
+-endif
++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+ # Purge it of unnecessary internal relative paths
+
+base-commit: c891d8dc23e1a46ad9f3e757d09e57b500d40044
+--
+2.41.0
+
diff --git a/gnu/packages/patches/gdm-elogind-support.patch b/gnu/packages/patches/gdm-elogind-support.patch
index 5c8e3bd610..b27e000585 100644
--- a/gnu/packages/patches/gdm-elogind-support.patch
+++ b/gnu/packages/patches/gdm-elogind-support.patch
@@ -18,10 +18,10 @@ system and user units.
meson_options.txt | 5 +-
6 files changed, 66 insertions(+), 42 deletions(-)
-diff --git a/common/meson.build b/common/meson.build
-index 074dd92e..bca58f7c 100644
---- a/common/meson.build
-+++ b/common/meson.build
+Index: gdm-44.1/common/meson.build
+===================================================================
+--- gdm-44.1.orig/common/meson.build
++++ gdm-44.1/common/meson.build
@@ -11,7 +11,7 @@ libgdmcommon_src = files(
)
@@ -31,10 +31,10 @@ index 074dd92e..bca58f7c 100644
gobject_dep,
gio_dep,
gio_unix_dep,
-diff --git a/data/meson.build b/data/meson.build
-index 2dec4c23..c3452e1c 100644
---- a/data/meson.build
-+++ b/data/meson.build
+Index: gdm-44.1/data/meson.build
+===================================================================
+--- gdm-44.1.orig/data/meson.build
++++ gdm-44.1/data/meson.build
@@ -164,41 +164,53 @@ else
service_config.set('PLYMOUTH_QUIT_SERVICE', '')
endif
@@ -114,10 +114,10 @@ index 2dec4c23..c3452e1c 100644
# XSession
if get_option('gdm-xsession')
-diff --git a/libgdm/meson.build b/libgdm/meson.build
-index 3f8cafbb..83e95151 100644
---- a/libgdm/meson.build
-+++ b/libgdm/meson.build
+Index: gdm-44.1/libgdm/meson.build
+===================================================================
+--- gdm-44.1.orig/libgdm/meson.build
++++ gdm-44.1/libgdm/meson.build
@@ -56,7 +56,7 @@ libgdm_deps = [
glib_dep,
gio_dep,
@@ -127,55 +127,46 @@ index 3f8cafbb..83e95151 100644
libgdmcommon_dep,
]
-diff --git a/meson.build b/meson.build
-index 845f673e..d0ca41ef 100644
---- a/meson.build
-+++ b/meson.build
-@@ -96,21 +96,30 @@ xdmcp_dep = cc.find_library('Xdmcp', required: get_option('xdmcp'))
- if xdmcp_dep.found() and get_option('tcp-wrappers')
+Index: gdm-44.1/meson.build
+===================================================================
+--- gdm-44.1.orig/meson.build
++++ gdm-44.1/meson.build
+@@ -100,16 +100,24 @@ if xdmcp_dep.found() and get_option('tcp
libwrap_dep = cc.find_library('wrap')
endif
--# systemd
+ # systemd
-systemd_dep = dependency('systemd')
-libsystemd_dep = dependency('libsystemd')
--if meson.version().version_compare('>= 0.53')
-- systemd_multiseat_x = find_program('systemd-multi-seat-x',
-- required: false,
-- dirs: [
-- systemd_dep.get_pkgconfig_variable('systemdutildir'),
-- '/lib/systemd',
-- '/usr/lib/systemd',
-- ])
-+
+-systemd_multiseat_x = find_program('systemd-multi-seat-x',
+- required: false,
+- dirs: [
+- systemd_dep.get_pkgconfig_variable('systemdutildir'),
+- '/lib/systemd',
+- '/usr/lib/systemd',
+- ])
+-systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x'
+logind_provider = get_option('logind-provider')
+systemd_dep = dependency('systemd', required: false)
+if logind_provider == 'systemd'
+ libsystemd_dep = dependency('libsystemd')
+ logind_dep = libsystemd_dep
-+ if meson.version().version_compare('>= 0.53')
-+ systemd_multiseat_x = find_program('systemd-multi-seat-x',
-+ required: false,
-+ dirs: [
-+ systemd_dep.get_pkgconfig_variable('systemdutildir'),
-+ '/lib/systemd',
-+ '/usr/lib/systemd',
-+ ])
-+ else
-+ systemd_multiseat_x = find_program('systemd-multi-seat-x', required: false)
-+ endif
++ systemd_multiseat_x = find_program('systemd-multi-seat-x',
++ required: false,
++ dirs: [
++ systemd_dep.get_pkgconfig_variable('systemdutildir'),
++ '/lib/systemd',
++ '/usr/lib/systemd',
++ ])
+ systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x'
- else
-- systemd_multiseat_x = find_program('systemd-multi-seat-x', required: false)
++else
+ elogind_dep = dependency('libelogind')
+ logind_dep = elogind_dep
+ systemd_x_server = 'disabled'
- endif
--systemd_x_server = systemd_multiseat_x.found()? systemd_multiseat_x.path() : '/lib/systemd/systemd-multi-seat-x'
-+
++endif
# Plymouth
plymouth_dep = dependency('ply-boot-client', required: get_option('plymouth'))
# Check for Solaris auditing API (ADT)
-@@ -319,6 +328,7 @@ summary({
+@@ -319,6 +327,7 @@ summary({
'PAM Syslog': have_pam_syslog,
'Supports PAM Extensions': pam_extensions_supported,
'SeLinux': libselinux_dep.found(),
@@ -183,11 +174,11 @@ index 845f673e..d0ca41ef 100644
'Use GDM Xsession': get_option('gdm-xsession'),
'Use UserDisplayServer': get_option('user-display-server'),
'Use SystemdJournal': get_option('systemd-journal'),
-diff --git a/meson_options.txt b/meson_options.txt
-index 14e0b908..5135d7d6 100644
---- a/meson_options.txt
-+++ b/meson_options.txt
-@@ -12,6 +12,7 @@ option('initial-vt', type: 'integer', value: 1, description: 'Initial virtual te
+Index: gdm-44.1/meson_options.txt
+===================================================================
+--- gdm-44.1.orig/meson_options.txt
++++ gdm-44.1/meson_options.txt
+@@ -12,6 +12,7 @@ option('initial-vt', type: 'integer', va
option('ipv6', type: 'boolean', value: false, description: 'Enables compilation of IPv6 code.')
option('lang-file', type: 'string', value: '', description: 'File containing default language settings.')
option('libaudit', type: 'feature', value: 'auto', description: 'Add Linux audit support.')
@@ -195,7 +186,7 @@ index 14e0b908..5135d7d6 100644
option('log-dir', type: 'string', value: '/var/log/gdm', description: 'Log directory.')
option('pam-mod-dir', type: 'string', value: '', description: 'Directory to install PAM modules in.')
option('pam-prefix', type: 'string', value: '', description: 'Specify where PAM files go.')
-@@ -27,8 +28,8 @@ option('solaris', type: 'boolean', value: false, description: 'Build for Solaris
+@@ -27,8 +28,8 @@ option('solaris', type: 'boolean', value
option('split-authentication', type: 'boolean', value: true, description: 'Enable multiple simultaneous PAM conversations during login.')
option('sysconfsubdir', type: 'string', value: 'gdm', description: 'Directory name used under sysconfdir.')
option('systemd-journal', type: 'boolean', value: true, description: 'Use journald support.')
diff --git a/gnu/packages/patches/gegl-compatibility-old-librsvg.patch b/gnu/packages/patches/gegl-compatibility-old-librsvg.patch
new file mode 100644
index 0000000000..3e5733f9fd
--- /dev/null
+++ b/gnu/packages/patches/gegl-compatibility-old-librsvg.patch
@@ -0,0 +1,80 @@
+From a99a93e5c9013bd4101f5058cdee7d0cf30234fe Mon Sep 17 00:00:00 2001
+Message-ID: <a99a93e5c9013bd4101f5058cdee7d0cf30234fe.1694554961.git.vivien@planete-kraus.eu>
+From: Jehan <jehan@girinstud.io>
+Date: Wed, 5 Jul 2023 21:18:19 +0200
+Subject: [PATCH] Issue #333: continuing to support librsvg 2.40.x (C
+ versions).
+
+Commit 9beeefcbe uses too new functions of librsvg. We could just bump
+the minimum required version but there are issues with Rust not being
+available on every platform yet. So instead, let's add some conditional
+code paths, so that it still builds with librsvg 2.40.x (which was the
+last versions fully in C) while we use newer code and no warnings when
+using newer versions.
+---
+ operations/external/svg-load.c | 25 ++++++++++++++++++++-----
+ 1 file changed, 20 insertions(+), 5 deletions(-)
+
+diff --git a/operations/external/svg-load.c b/operations/external/svg-load.c
+index 3312a0c0a..15c0b30b7 100644
+--- a/operations/external/svg-load.c
++++ b/operations/external/svg-load.c
+@@ -76,16 +76,25 @@ query_svg (GeglOperation *operation)
+ {
+ GeglProperties *o = GEGL_PROPERTIES (operation);
+ Priv *p = (Priv*) o->user_data;
++#if LIBRSVG_CHECK_VERSION(2, 52, 0)
+ gdouble out_width, out_height;
++#else
++ RsvgDimensionData dimensions;
++#endif
+
+ g_return_val_if_fail (p->handle != NULL, FALSE);
+
+- rsvg_handle_get_intrinsic_size_in_pixels (p->handle, &out_width, &out_height);
+-
+ p->format = babl_format ("R'G'B'A u8");
+
++#if LIBRSVG_CHECK_VERSION(2, 52, 0)
++ rsvg_handle_get_intrinsic_size_in_pixels (p->handle, &out_width, &out_height);
+ p->height = out_height;
+- p->width = out_width;
++ p->width = out_width;
++#else
++ rsvg_handle_get_dimensions (p->handle, &dimensions);
++ p->height = dimensions.height;
++ p->width = dimensions.width;
++#endif
+
+ return TRUE;
+ }
+@@ -98,10 +107,12 @@ load_svg (GeglOperation *operation,
+ {
+ GeglProperties *o = GEGL_PROPERTIES (operation);
+ Priv *p = (Priv*) o->user_data;
+- RsvgRectangle svg_rect = {0.0, 0.0, width, height};
+ cairo_surface_t *surface;
+ cairo_t *cr;
+- GError *error = NULL;
++#if LIBRSVG_CHECK_VERSION(2, 52, 0)
++ GError *error = NULL;
++ RsvgRectangle svg_rect = {0.0, 0.0, width, height};
++#endif
+
+ g_return_val_if_fail (p->handle != NULL, -1);
+
+@@ -115,7 +126,11 @@ load_svg (GeglOperation *operation,
+ (double)height / (double)p->height);
+ }
+
++#if LIBRSVG_CHECK_VERSION(2, 52, 0)
+ rsvg_handle_render_document (p->handle, cr, &svg_rect, &error);
++#else
++ rsvg_handle_render_cairo (p->handle, cr);
++#endif
+
+ cairo_surface_flush (surface);
+
+--
+2.41.0
+
diff --git a/gnu/packages/patches/gitg-fix-positional-argument.patch b/gnu/packages/patches/gitg-fix-positional-argument.patch
deleted file mode 100644
index 1d3513921c..0000000000
--- a/gnu/packages/patches/gitg-fix-positional-argument.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 1978973b12848741b08695ec2020bac98584d636 Mon Sep 17 00:00:00 2001
-From: Jan Beich <jbeich@FreeBSD.org>
-Date: Mon, 24 Jan 2022 12:17:52 +0000
-Subject: [PATCH] meson: drop unused argument for i18n.merge_file()
-
-Ignored in Meson < 0.60.0, deprecated since 0.60.1 and fatal since 0.61.0.
-
-data/meson.build:8:0: ERROR: Function does not take positional arguments.
-data/meson.build:44:0: ERROR: Function does not take positional arguments.
----
- data/meson.build | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/data/meson.build b/data/meson.build
-index a8b90fd1..2413531d 100644
---- a/data/meson.build
-+++ b/data/meson.build
-@@ -6,7 +6,6 @@ desktop_config = configuration_data()
- desktop_config.set('icon', application_id)
- desktop_config.set('binary', gitg_name)
- i18n.merge_file(
-- desktop,
- type: 'desktop',
- input: configure_file(
- input: desktop + '.in.in',
-@@ -42,7 +41,6 @@ appdata_config = configuration_data()
- appdata_config.set('app-id', application_id)
- appdata_config.set('gettext', gitg_name)
- i18n.merge_file(
-- appdata,
- type: 'xml',
- input: configure_file(
- input: appdata + '.in.in',
---
-GitLab
-
diff --git a/gnu/packages/patches/glib-networking-gnutls-binding.patch b/gnu/packages/patches/glib-networking-gnutls-binding.patch
deleted file mode 100644
index 91d0743056..0000000000
--- a/gnu/packages/patches/glib-networking-gnutls-binding.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Skip failing test in 'test_connection_binding_match_tls_unique'
-in 'tls/tests/connection.c' when building glib-networking against
-GnuTLS 3.7.2. The failure stems from the fact that
-'gnutls_session_channel_binding' returns GNUTLS_E_INVALID_REQUEST
-is known upstream:
-
- https://gitlab.gnome.org/GNOME/glib-networking/-/issues/164
-
-diff --git a/tls/tests/connection.c b/tls/tests/connection.c
-index 036df04..347c7a4 100644
---- a/tls/tests/connection.c
-+++ b/tls/tests/connection.c
-@@ -3037,8 +3037,6 @@ main (int argc,
- setup_connection, test_connection_missing_server_identity, teardown_connection);
- g_test_add ("/tls/" BACKEND "/connection/peer-certificate-notify", TestConnection, NULL,
- setup_connection, test_peer_certificate_notify, teardown_connection);
-- g_test_add ("/tls/" BACKEND "/connection/binding/match-tls-unique", TestConnection, NULL,
-- setup_connection, test_connection_binding_match_tls_unique, teardown_connection);
- g_test_add ("/tls/" BACKEND "/connection/binding/match-tls-server-end-point", TestConnection, NULL,
- setup_connection, test_connection_binding_match_tls_server_end_point, teardown_connection);
- g_test_add ("/tls/" BACKEND "/connection/binding/match-tls-exporter", TestConnection, NULL,
diff --git a/gnu/packages/patches/glib-skip-failing-test.patch b/gnu/packages/patches/glib-skip-failing-test.patch
index c7706aaa74..3fde5cb1e2 100644
--- a/gnu/packages/patches/glib-skip-failing-test.patch
+++ b/gnu/packages/patches/glib-skip-failing-test.patch
@@ -10,12 +10,13 @@ diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index a926ae0..4fdbe7a 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
-@@ -317,10 +317,6 @@ if host_machine.system() != 'windows'
+@@ -317,11 +317,6 @@ if host_machine.system() != 'windows'
'extra_sources' : [extra_sources, gdbus_test_codegen_generated, gdbus_test_codegen_generated_interface_info],
'c_args' : ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32'],
},
- 'gdbus-threading' : {
- 'extra_sources' : extra_sources,
+- 'extra_programs': extra_programs,
- 'suite' : ['slow'],
- },
'gmenumodel' : {
diff --git a/gnu/packages/patches/glslang-install-static-libs.patch b/gnu/packages/patches/glslang-install-static-libs.patch
deleted file mode 100644
index a155dde30e..0000000000
--- a/gnu/packages/patches/glslang-install-static-libs.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-Install OGLCompiler et.al. even when building shared libraries. Also fix
-CMake file locations.
-
-Patch taken from Gentoo:
-
- https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-util/glslang/files/glslang-1.3.231-Install-static-libs.patch
-
-diff --git a/OGLCompilersDLL/CMakeLists.txt b/OGLCompilersDLL/CMakeLists.txt
---- a/OGLCompilersDLL/CMakeLists.txt
-+++ b/OGLCompilersDLL/CMakeLists.txt
-@@ -41,7 +41,7 @@ if(WIN32)
- source_group("Source" FILES ${SOURCES})
- endif(WIN32)
-
--if(ENABLE_GLSLANG_INSTALL AND NOT BUILD_SHARED_LIBS)
-+if(ENABLE_GLSLANG_INSTALL)
- install(TARGETS OGLCompiler EXPORT glslang-targets)
-
- # Backward compatibility
-@@ -49,7 +49,7 @@ if(ENABLE_GLSLANG_INSTALL AND NOT BUILD_SHARED_LIBS)
- message(WARNING \"Using `OGLCompilerTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.\")
-
- if (NOT TARGET glslang::OGLCompiler)
-- include(\"\${CMAKE_CURRENT_LIST_DIR}/../../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/glslang-targets.cmake\")
-+ include(\"\${CMAKE_CURRENT_LIST_DIR}/../../${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/glslang-targets.cmake\")
- endif()
-
- add_library(OGLCompiler ALIAS glslang::OGLCompiler)
-diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt
---- a/glslang/CMakeLists.txt
-+++ b/glslang/CMakeLists.txt
-@@ -203,7 +203,7 @@ endif()
- ################################################################################
- if(ENABLE_GLSLANG_INSTALL)
- install(TARGETS glslang EXPORT glslang-targets)
-- if(NOT BUILD_SHARED_LIBS)
-+ if(BUILD_SHARED_LIBS)
- install(TARGETS MachineIndependent EXPORT glslang-targets)
- install(TARGETS GenericCodeGen EXPORT glslang-targets)
-
-diff --git a/glslang/OSDependent/Unix/CMakeLists.txt b/glslang/OSDependent/Unix/CMakeLists.txt
---- a/glslang/OSDependent/Unix/CMakeLists.txt
-+++ b/glslang/OSDependent/Unix/CMakeLists.txt
-@@ -52,7 +52,7 @@ else()
- target_link_libraries(OSDependent Threads::Threads)
- endif()
-
--if(ENABLE_GLSLANG_INSTALL AND NOT BUILD_SHARED_LIBS)
-+if(ENABLE_GLSLANG_INSTALL)
- install(TARGETS OSDependent EXPORT glslang-targets)
-
- # Backward compatibility
-@@ -60,7 +60,7 @@ if(ENABLE_GLSLANG_INSTALL AND NOT BUILD_SHARED_LIBS)
- message(WARNING \"Using `OSDependentTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.\")
-
- if (NOT TARGET glslang::OSDependent)
-- include(\"\${CMAKE_CURRENT_LIST_DIR}/../../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/glslang-targets.cmake\")
-+ include(\"\${CMAKE_CURRENT_LIST_DIR}/../../${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/glslang-targets.cmake\")
- endif()
-
- add_library(OSDependent ALIAS glslang::OSDependent)
diff --git a/gnu/packages/patches/gmobile-make-it-installable.patch b/gnu/packages/patches/gmobile-make-it-installable.patch
new file mode 100644
index 0000000000..9db6554877
--- /dev/null
+++ b/gnu/packages/patches/gmobile-make-it-installable.patch
@@ -0,0 +1,89 @@
+From c1ea43a45f4588f21752b0ad679c43350a9c8905 Mon Sep 17 00:00:00 2001
+Message-ID: <c1ea43a45f4588f21752b0ad679c43350a9c8905.1698604357.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sun, 29 Oct 2023 19:00:44 +0100
+Subject: [PATCH] Install gmobile as a shared library.
+
+Tracked at https://gitlab.gnome.org/guidog/gmobile/-/issues/1
+
+* src/meson.build: Install the header files. Import pkgconfig.
+Generate a pkg-config definition.
+(gm_lib): use "library", not "static_library". Install it.
+(gmobile_gir): Install it.
+* meson.build: Install gm-config.h.
+---
+ meson.build | 1 +
+ src/meson.build | 22 +++++++++++++++++++---
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index e9f6c62..51ebeac 100644
+--- a/meson.build
++++ b/meson.build
+@@ -83,6 +83,7 @@ root_inc = include_directories('.')
+ configure_file(
+ output: 'gm-config.h',
+ configuration: config_h,
++ install_dir: get_option('includedir')
+ )
+
+ subdir('data')
+diff --git a/src/meson.build b/src/meson.build
+index ee98a39..3dedbe4 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -1,3 +1,5 @@
++pkg = import('pkgconfig')
++
+ gm_deps = [
+ gio_dep,
+ glib_dep,
+@@ -37,18 +39,33 @@ gm_c_args = [
+ '-DG_LOG_DOMAIN="gmobile"',
+ ]
+
+-gm_lib = static_library(
++gm_lib = library(
+ 'gmobile',
+ gm_sources,
+ include_directories: root_inc,
+ c_args: gm_c_args,
+- dependencies: gm_deps)
++ dependencies: gm_deps,
++ install: true)
++
++pkg.generate(gm_lib)
+
+ gmobile_dep = declare_dependency(
+ include_directories: [root_inc, include_directories('.')],
+ dependencies: gm_deps,
+ link_with: gm_lib)
+
++install_headers(
++ 'gmobile.h',
++ 'gm-cutout.h',
++ 'gm-device-info.h',
++ 'gm-device-tree.h',
++ 'gm-display-panel.h',
++ 'gm-error.h',
++ 'gm-main.h',
++ 'gm-rect.h',
++ 'gm-svg-path.h',
++ 'gm-timeout.h')
++
+ if get_option('gtk_doc')
+ gmobile_gir_extra_args = [
+ '--c-include=gmobile.h',
+@@ -66,7 +83,6 @@ if get_option('gtk_doc')
+ identifier_prefix: 'Gm',
+ link_with: gm_lib,
+ includes: ['Gio-2.0'],
+- install: false,
+ extra_args: gmobile_gir_extra_args,
+ )
+ endif
+
+base-commit: 382fc89472176d2f1d435517cad53d969d8b8eff
+--
+2.41.0
+
diff --git a/gnu/packages/patches/gnome-control-center-firmware-security.patch b/gnu/packages/patches/gnome-control-center-firmware-security.patch
new file mode 100644
index 0000000000..fd9d7b8ff4
--- /dev/null
+++ b/gnu/packages/patches/gnome-control-center-firmware-security.patch
@@ -0,0 +1,33 @@
+From: Jeremy Bicha <jeremy.bicha@canonical.com>
+Date: Mon, 22 Aug 2022 08:31:15 -0400
+Subject: firmware-security: Disable
+
+Not yet useful enough to justify its inclusion by default here
+
+You can get the same info by running
+fwupdmgr security
+
+If you drop this patch, add a Depends: fwupd [linux-any]
+
+https://launchpad.net/bugs/1987162
+
+https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1938
+
+[Stolen from the debian package]
+---
+ shell/cc-panel-loader.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
+index 17f9601..1b819a5 100644
+--- a/shell/cc-panel-loader.c
++++ b/shell/cc-panel-loader.c
+@@ -113,7 +113,7 @@ static CcPanelLoaderVtable default_panels[] =
+ PANEL_TYPE("info-overview", cc_info_overview_panel_get_type, NULL),
+ PANEL_TYPE("keyboard", cc_keyboard_panel_get_type, NULL),
+ PANEL_TYPE("location", cc_location_panel_get_type, NULL),
+- PANEL_TYPE("firmware-security",cc_firmware_security_panel_get_type, cc_firmware_security_panel_static_init_func),
++ // PANEL_TYPE("firmware-security",cc_firmware_security_panel_get_type, cc_firmware_security_panel_static_init_func),
+ PANEL_TYPE("microphone", cc_microphone_panel_get_type, NULL),
+ PANEL_TYPE("mouse", cc_mouse_panel_get_type, NULL),
+ PANEL_TYPE("multitasking", cc_multitasking_panel_get_type, NULL),
diff --git a/gnu/packages/patches/gtk2-harden-list-store.patch b/gnu/packages/patches/gtk2-harden-list-store.patch
new file mode 100644
index 0000000000..f49dc3bc77
--- /dev/null
+++ b/gnu/packages/patches/gtk2-harden-list-store.patch
@@ -0,0 +1,42 @@
+Backport the implementation of gtk_list_store_iter_is_valid from gtk+-3.
+
+Index: gtk+-2.24.33/gtk/gtkliststore.c
+===================================================================
+--- gtk+-2.24.33.orig/gtk/gtkliststore.c
++++ gtk+-2.24.33/gtk/gtkliststore.c
+@@ -1195,16 +1195,31 @@ gboolean
+ gtk_list_store_iter_is_valid (GtkListStore *list_store,
+ GtkTreeIter *iter)
+ {
++ GSequenceIter *seq_iter;
++
+ g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), FALSE);
+ g_return_val_if_fail (iter != NULL, FALSE);
+
+- if (!VALID_ITER (iter, list_store))
+- return FALSE;
++ /* can't use VALID_ITER() here, because iter might point
++ * to random memory.
++ *
++ * We MUST NOT dereference it.
++ */
+
+- if (g_sequence_iter_get_sequence (iter->user_data) != list_store->seq)
++ if (iter == NULL ||
++ iter->user_data == NULL ||
++ list_store->stamp != iter->stamp)
+ return FALSE;
+
+- return TRUE;
++ for (seq_iter = g_sequence_get_begin_iter (list_store->seq);
++ !g_sequence_iter_is_end (seq_iter);
++ seq_iter = g_sequence_iter_next (seq_iter))
++ {
++ if (seq_iter == iter->user_data)
++ return TRUE;
++ }
++
++ return FALSE;
+ }
+
+ static gboolean real_gtk_list_store_row_draggable (GtkTreeDragSource *drag_source,
diff --git a/gnu/packages/patches/gwenview-kimageannotator.patch b/gnu/packages/patches/gwenview-kimageannotator.patch
new file mode 100644
index 0000000000..92b994a0b5
--- /dev/null
+++ b/gnu/packages/patches/gwenview-kimageannotator.patch
@@ -0,0 +1,29 @@
+Submitted By: Douglas R. Reno <renodr at linuxfromscratch dot org>
+Date: 2024-02-26
+Initial Package Version: 23.08.5
+Upstream Status: Rejected (Qt6 port is primary now)
+Origin: Self
+Description: Fixes building Gwenview with recent kImageAnnotator
+ and kColorPicker versions by adjusting their paths
+ and FOUND variables so that the correct libraries are
+ selected.
+
+--- gwenview-23.08.5.orig/CMakeLists.txt 2024-02-26 15:02:29.702754535 -0600
++++ gwenview-23.08.5/CMakeLists.txt 2024-02-26 15:09:48.012866877 -0600
+@@ -166,11 +166,11 @@ if(NOT WITHOUT_X11)
+ endif()
+
+ if (QT_MAJOR_VERSION STREQUAL "5")
+- find_package(kImageAnnotator)
+- set_package_properties(kImageAnnotator PROPERTIES URL "https://github.com/ksnip/kImageAnnotator" DESCRIPTION "The kImageAnnotator library provides tools to annotate" TYPE REQUIRED)
+- if(kImageAnnotator_FOUND)
+- set(KIMAGEANNOTATOR_FOUND 1)
+- find_package(kColorPicker REQUIRED)
++ find_package(kImageAnnotator-Qt5)
++ set_package_properties(kImageAnnotator-Qt5 PROPERTIES URL "https://github.com/ksnip/kImageAnnotator" DESCRIPTION "The kImageAnnotator library provides tools to annotate" TYPE REQUIRED)
++ if(kImageAnnotator-Qt5_FOUND)
++ set(kImageAnnotator_FOUND 1)
++ find_package(kColorPicker-Qt5 REQUIRED)
+ if(NOT kImageAnnotator_VERSION VERSION_LESS 0.5.0)
+ set(KIMAGEANNOTATOR_CAN_LOAD_TRANSLATIONS 1)
+ endif()
diff --git a/gnu/packages/patches/jami-qml-tests-discovery.patch b/gnu/packages/patches/jami-qml-tests-discovery.patch
deleted file mode 100644
index 11fd69571c..0000000000
--- a/gnu/packages/patches/jami-qml-tests-discovery.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Upstream status: https://review.jami.net/c/jami-client-qt/+/25640
-
-diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
-index d50908cf..587c9d15 100644
---- a/tests/CMakeLists.txt
-+++ b/tests/CMakeLists.txt
-@@ -73,6 +73,8 @@ endif()
-
- string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
-
-+set(QUICK_TEST_SOURCE_DIR "${CMAKE_SOURCE_DIR}tests/qml/src")
-+
- set(QML_TESTS_SOURCE_FILES
- ${CMAKE_SOURCE_DIR}/tests/qml/main.cpp
- ${TEST_QML_RESOURCES}
diff --git a/gnu/packages/patches/jami-qwindowkit.patch b/gnu/packages/patches/jami-qwindowkit.patch
new file mode 100644
index 0000000000..65248a6940
--- /dev/null
+++ b/gnu/packages/patches/jami-qwindowkit.patch
@@ -0,0 +1,37 @@
+Upstream-status: https://lists.gnu.org/archive/html/jami/2024-03/msg00008.html
+
+This makes it possible to use the system-provided qwindowkit library.
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6d2dccfb..8dedff50 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -100,13 +100,13 @@ endif()
+
+ # qwindowkit (frameless window)
+ add_fetch_content(
+- TARGET qwindowkit
++ TARGET QWindowKit
+ URL https://github.com/stdware/qwindowkit.git
+ BRANCH 79b1f3110754f9c21af2d7dacbd07b1a9dbaf6ef
+ PATCHES ${QWINDOWKIT_PATCHES}
+ OPTIONS ${QWINDOWKIT_OPTIONS}
+ )
+-list(APPEND CLIENT_INCLUDE_DIRS ${QWindowKit_BINARY_DIR}/include)
++
+ list(APPEND CLIENT_LIBS QWindowKit::Quick)
+
+ set(CMAKE_AUTOMOC ON)
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index b2730b71..4960899e 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -48,7 +48,7 @@ target_include_directories(test_common_obj PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/src)
+ target_link_directories(test_common_obj PRIVATE ${CLIENT_LINK_DIRS})
+-target_link_libraries(test_common_obj ${QML_TEST_LIBS})
++target_link_libraries(test_common_obj ${QML_TEST_LIBS} ${CLIENT_LIBS})
+ target_compile_definitions(test_common_obj PRIVATE BUILD_TESTING="ON")
+
+ set(COMMON_TESTS_SOURCES
diff --git a/gnu/packages/patches/jami-tests-qtwebengine-ifdef-to-if.patch b/gnu/packages/patches/jami-tests-qtwebengine-ifdef-to-if.patch
new file mode 100644
index 0000000000..63bfde6af0
--- /dev/null
+++ b/gnu/packages/patches/jami-tests-qtwebengine-ifdef-to-if.patch
@@ -0,0 +1,26 @@
+Upstream-status: https://lists.gnu.org/archive/html/jami/2024-03/msg00005.html
+
+Fix macro value checking.
+
+diff --git a/tests/qml/main.cpp b/tests/qml/main.cpp
+index 2fbecebe..8cb3de69 100644
+--- a/tests/qml/main.cpp
++++ b/tests/qml/main.cpp
+@@ -35,7 +35,7 @@
+ #include <QtQuickTest/quicktest.h>
+ #include <QSignalSpy>
+
+-#ifdef WITH_WEBENGINE
++#if WITH_WEBENGINE
+ #include <QtWebEngineCore>
+ #include <QtWebEngineQuick>
+ #endif
+@@ -192,7 +192,7 @@ main(int argc, char** argv)
+ // Allow the user to enable fatal warnings for certain tests.
+ Utils::remove_argument(argv, argc, "--failonwarn", [&]() { qputenv("QT_FATAL_WARNINGS", "1"); });
+
+-#ifdef WITH_WEBENGINE
++#if WITH_WEBENGINE
+ QtWebEngineQuick::initialize();
+ #endif
+ QTEST_SET_MAIN_SOURCE_PATH
diff --git a/gnu/packages/patches/jami-unbundle-dependencies.patch b/gnu/packages/patches/jami-unbundle-dependencies.patch
index dab82b26cb..2732087daf 100644
--- a/gnu/packages/patches/jami-unbundle-dependencies.patch
+++ b/gnu/packages/patches/jami-unbundle-dependencies.patch
@@ -16,13 +16,14 @@ Change-Id: I637959fefce6a21b0ee73a793acb6c3c42dcdce0
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 38e7a4e2..3f1bd599 100644
+index e802357f..6d2dccfb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -545,19 +545,33 @@ add_subdirectory(3rdparty/SortFilterProxyModel)
+@@ -600,20 +600,34 @@ add_subdirectory(3rdparty/SortFilterProxyModel)
set(SFPM_OBJECTS $<TARGET_OBJECTS:SortFilterProxyModel>)
# md4c
+-set(BUILD_MD2HTML_EXECUTABLE OFF CACHE BOOL "Don't build md2html executable" FORCE)
-set(BUILD_SHARED_LIBS OFF CACHE BOOL "Don't build shared md4c library" FORCE)
-add_subdirectory(3rdparty/md4c EXCLUDE_FROM_ALL)
-list(APPEND CLIENT_LINK_DIRS ${MD4C_BINARY_DIR}/src)
@@ -34,6 +35,7 @@ index 38e7a4e2..3f1bd599 100644
+ list(APPEND CLIENT_LIBS md4c::md4c-html)
+else()
+ message("Using bundled md4c-html library")
++ set(BUILD_MD2HTML_EXECUTABLE OFF CACHE BOOL "Don't build md2html executable" FORCE)
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Don't build shared md4c library" FORCE)
+ add_subdirectory(3rdparty/md4c EXCLUDE_FROM_ALL)
+ list(APPEND CLIENT_LINK_DIRS ${MD4C_BINARY_DIR}/src)
diff --git a/gnu/packages/patches/libarchive-remove-potential-backdoor.patch b/gnu/packages/patches/libarchive-remove-potential-backdoor.patch
new file mode 100644
index 0000000000..2b9a9e2ffe
--- /dev/null
+++ b/gnu/packages/patches/libarchive-remove-potential-backdoor.patch
@@ -0,0 +1,47 @@
+Remove code added by 'JiaT75', the malicious actor that backdoored `xz`:
+
+https://github.com/libarchive/libarchive/pull/2101
+
+At libarchive, they are reviewing all code contributed by this actor:
+
+https://github.com/libarchive/libarchive/issues/2103
+
+See the original disclosure and subsequent discussion for more
+information about this incident:
+
+https://seclists.org/oss-sec/2024/q1/268
+
+Patch copied from upstream source repository:
+
+https://github.com/libarchive/libarchive/pull/2101/commits/e200fd8abfb4cf895a1cab4d89b67e6eefe83942
+
+From 6110e9c82d8ba830c3440f36b990483ceaaea52c Mon Sep 17 00:00:00 2001
+From: Ed Maste <emaste@freebsd.org>
+Date: Fri, 29 Mar 2024 18:02:06 -0400
+Subject: [PATCH] tar: make error reporting more robust and use correct errno
+ (#2101)
+
+As discussed in #1609.
+---
+ tar/read.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/tar/read.c b/tar/read.c
+index af3d3f42..a7f14a07 100644
+--- a/tar/read.c
++++ b/tar/read.c
+@@ -371,8 +371,9 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer)
+ if (r != ARCHIVE_OK) {
+ if (!bsdtar->verbose)
+ safe_fprintf(stderr, "%s", archive_entry_pathname(entry));
+- fprintf(stderr, ": %s: ", archive_error_string(a));
+- fprintf(stderr, "%s", strerror(errno));
++ safe_fprintf(stderr, ": %s: %s",
++ archive_error_string(a),
++ strerror(archive_errno(a)));
+ if (!bsdtar->verbose)
+ fprintf(stderr, "\n");
+ bsdtar->return_value = 1;
+--
+2.41.0
+
diff --git a/gnu/packages/patches/libcall-ui-make-it-installable.patch b/gnu/packages/patches/libcall-ui-make-it-installable.patch
new file mode 100644
index 0000000000..078422913d
--- /dev/null
+++ b/gnu/packages/patches/libcall-ui-make-it-installable.patch
@@ -0,0 +1,81 @@
+From 1a79c18e85232a6f56a58ec99271b92d5b0e6dca Mon Sep 17 00:00:00 2001
+Message-ID: <1a79c18e85232a6f56a58ec99271b92d5b0e6dca.1698606228.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sun, 29 Oct 2023 19:42:55 +0100
+Subject: [PATCH] Install libcall-ui.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Tracked at https://gitlab.gnome.org/World/Phosh/libcall-ui/-/issues/27
+
+* src/meson.build: Require pkgconfig. Install a pkg-config
+definition. Install the headers.
+(call_ui_lib): Install it. Use “library”, not “static_library”.
+* meson.build (config_h): Install the config.h file.
+(call_ui_enum_sources): Install the header file.
+---
+ meson.build | 1 +
+ src/meson.build | 22 +++++++++++++++++++---
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 6d96178..80514ba 100644
+--- a/meson.build
++++ b/meson.build
+@@ -93,6 +93,7 @@ configure_file(
+ input: 'cui-config.h.in',
+ output: 'cui-config.h',
+ configuration: config_h,
++ install_dir: get_option('includedir')
+ )
+
+ #subdir('data')
+diff --git a/src/meson.build b/src/meson.build
+index bdb347c..2f9fa0c 100644
+--- a/src/meson.build
++++ b/src/meson.build
+@@ -1,7 +1,11 @@
++pkg = import('pkgconfig')
++
+ call_ui_enum_headers = files(['cui-call.h',
+ ])
+ call_ui_enum_sources = gnome.mkenums_simple('cui-enums',
+- sources : call_ui_enum_headers)
++ sources : call_ui_enum_headers,
++ install_header: true,
++ install_dir: get_option('includedir'))
+
+ call_ui_resources = gnome.compile_resources(
+ 'cui-resources',
+@@ -50,11 +54,23 @@ call_ui_c_args = [
+ '-DG_LOG_DOMAIN="Cui"',
+ ]
+
+-call_ui_lib = static_library('call-ui',
++call_ui_lib = library('call-ui',
+ call_ui_sources,
+ c_args: call_ui_c_args,
+ include_directories: [ root_inc, src_inc ],
+- dependencies: call_ui_deps)
++ dependencies: call_ui_deps,
++ install: true)
++
++pkg.generate(call_ui_lib)
++
++install_headers(
++ 'call-ui.h',
++ 'cui-call.h',
++ 'cui-call-display.h',
++ 'cui-main.h',
++ 'cui-dialpad.h',
++ 'cui-keypad.h',
++)
+
+ libcall_ui_dep = declare_dependency(
+ sources: call_ui_enum_sources,
+
+base-commit: 817d770cfa6876d37c4a6d09b00c9bdedfdce8b7
+--
+2.41.0
+
diff --git a/gnu/packages/patches/libgda-disable-data-proxy-test.patch b/gnu/packages/patches/libgda-disable-data-proxy-test.patch
new file mode 100644
index 0000000000..b93f9d3f9b
--- /dev/null
+++ b/gnu/packages/patches/libgda-disable-data-proxy-test.patch
@@ -0,0 +1,59 @@
+From c0bb1ed662011207ee13d5a20a70f9b55166aa13 Mon Sep 17 00:00:00 2001
+From: Daniel Espinosa <esodan@gmail.com>
+Date: Wed, 1 Nov 2023 15:00:40 -0500
+Subject: [PATCH] GdaDataProxy: is no thread save so disabling its test
+
+Has been difficutl to reproduce the problem when this test
+is running in Ci, so disabling until we can re-implement it
+is the better choice
+---
+ libgda/gda-data-proxy.h | 4 +++-
+ tests/data-models/meson.build | 17 +++++++++--------
+ 2 files changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/libgda/gda-data-proxy.h b/libgda/gda-data-proxy.h
+index 4c31ab69b..ba0fa72b3 100644
+--- a/libgda/gda-data-proxy.h
++++ b/libgda/gda-data-proxy.h
+@@ -77,7 +77,9 @@ struct _GdaDataProxyClass
+ * @stability: Stable
+ * @see_also: #GdaDataModel
+ *
+- * This object stores modifications to be made to a #GdaDataModel object which is proxied until the modifications are actually
++ * This object, is no thread save, so use with care.
++ *
++ * This object stores modifications to be made to a #GdaDataModel object which is proxied until the modifications are actually
+ * written to the #GdaDataModel, it can also filter the proxied data model to show only a subset (a defined number of continuous
+ * rows or by a filter to apply).
+ *
+diff --git a/tests/data-models/meson.build b/tests/data-models/meson.build
+index a8c6a29d8..e0ec8692a 100644
+--- a/tests/data-models/meson.build
++++ b/tests/data-models/meson.build
+@@ -61,14 +61,15 @@ tchkdp = executable('check_data_proxy',
+ ],
+ install: false
+ )
+-test('DataProxy', tchkdp,
+- timeout: 100,
+- workdir: meson.current_build_dir(),
+- env: [
+- 'GDA_TOP_SRC_DIR='+gda_top_src,
+- 'GDA_TOP_BUILD_DIR='+gda_top_build
+- ]
+- )
++# This test is no thread save so disabling
++#test('DataProxy', tchkdp,
++# timeout: 100,
++# workdir: meson.current_build_dir(),
++# env: [
++# 'GDA_TOP_SRC_DIR='+gda_top_src,
++# 'GDA_TOP_BUILD_DIR='+gda_top_build
++# ]
++# )
+
+ tchkmc = executable('check_model_copy',
+ ['check_model_copy.c'] + common_sources,
+--
+GitLab
+
diff --git a/gnu/packages/patches/librecad-support-for-boost-1.76.patch b/gnu/packages/patches/librecad-support-for-boost-1.76.patch
deleted file mode 100644
index aa352e669f..0000000000
--- a/gnu/packages/patches/librecad-support-for-boost-1.76.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Upstream commit e02f3580311d50b617427652ff77988f6bd62d9d adding Boost 1.76
-compatibility.
-
-diff --git a/librecad/src/lib/engine/rs_ellipse.cpp b/librecad/src/lib/engine/rs_ellipse.cpp
-index 291f734ea..d47bf6ca4 100644
---- a/librecad/src/lib/engine/rs_ellipse.cpp
-+++ b/librecad/src/lib/engine/rs_ellipse.cpp
-@@ -48,6 +48,9 @@
- #include <boost/version.hpp>
- #include <boost/math/tools/roots.hpp>
- #include <boost/math/special_functions/ellint_2.hpp>
-+#if BOOST_VERSION > 104500
-+#include <boost/math/tools/tuple.hpp>
-+#endif
- #endif
-
- namespace{
diff --git a/gnu/packages/patches/mm-common-reproducible-tarball.patch b/gnu/packages/patches/mm-common-reproducible-tarball.patch
deleted file mode 100644
index f0890aaf57..0000000000
--- a/gnu/packages/patches/mm-common-reproducible-tarball.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 024c121c844a4ec920133eb3f7e6b6ee8044c0b6 Mon Sep 17 00:00:00 2001
-From: Vagrant Cascadian <vagrant@reproducible-builds.org>
-Date: Sat, 12 Dec 2020 04:05:56 +0000
-Original-Patch: https://bugs.debian.org/977177
-Subject: [PATCH] Set uid, username, gid, and group name on files in
- generated tarball.
-
-The user and group may otherwise vary between builds on different systems.
-
----
- util/meson_aux/skeletonmm-tarball.py | 16 +++++++++++++++-
- 1 file changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/util/meson_aux/skeletonmm-tarball.py b/util/meson_aux/skeletonmm-tarball.py
-index db9e650..89049b6 100755
---- a/util/meson_aux/skeletonmm-tarball.py
-+++ b/util/meson_aux/skeletonmm-tarball.py
-@@ -39,10 +39,18 @@ elif output_file.endswith('.gz'):
- else:
- mode = 'w'
-
-+def reproducible(tarinfo):
-+ # Set consistent user and group on files in the tar archive
-+ tarinfo.uid = 0
-+ tarinfo.uname = 'root'
-+ tarinfo.gid = 0
-+ tarinfo.gname = 'root'
-+ return tarinfo
-+
- with tarfile.open(output_file, mode=mode) as tar_file:
- os.chdir(source_dir) # Input filenames are relative to source_dir.
- for file in sys.argv[3:]:
-- tar_file.add(file)
-+ tar_file.add(file, filter=reproducible)
- # Errors raise exceptions. If an exception is raised, Meson+ninja will notice
- # that the command failed, despite exit(0).
- sys.exit(0)
---
-2.29.2
-
diff --git a/gnu/packages/patches/mutter-fix-inverted-test.patch b/gnu/packages/patches/mutter-fix-inverted-test.patch
deleted file mode 100644
index 3676b31def..0000000000
--- a/gnu/packages/patches/mutter-fix-inverted-test.patch
+++ /dev/null
@@ -1,290 +0,0 @@
-From 5a83e8ef8250526a40e8e69c6398f990ab482b2f Mon Sep 17 00:00:00 2001
-From: Olivier Fourdan <ofourdan@redhat.com>
-Date: Fri, 2 Jun 2023 14:42:51 +0200
-Subject: [PATCH 1/5] cogl/gl-framebuffer: Fix spurious trailing spaces
-
-Purely cosmetic fix, no functional change.
-
-Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
----
- cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 12 ++++++------
- cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 12 ++++++------
- 2 files changed, 12 insertions(+), 12 deletions(-)
-
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-index d6609bb2074..8d76f1578bf 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-@@ -72,32 +72,32 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
- GLenum attachment, pname;
- size_t offset;
- } params[] = {
-- {
-+ {
- .attachment = GL_BACK_LEFT,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
- .offset = offsetof (CoglFramebufferBits, red),
- },
-- {
-+ {
- .attachment = GL_BACK_LEFT,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
- .offset = offsetof (CoglFramebufferBits, green),
- },
-- {
-+ {
- .attachment = GL_BACK_LEFT,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
- .offset = offsetof (CoglFramebufferBits, blue),
- },
-- {
-+ {
- .attachment = GL_BACK_LEFT,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
- .offset = offsetof (CoglFramebufferBits, alpha),
- },
-- {
-+ {
- .attachment = GL_DEPTH,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
- .offset = offsetof (CoglFramebufferBits, depth),
- },
-- {
-+ {
- .attachment = GL_STENCIL,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
- .offset = offsetof (CoglFramebufferBits, stencil),
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-index c8db6a23a29..1ffc1d53509 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-@@ -82,32 +82,32 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
- GLenum attachment, pname;
- size_t offset;
- } params[] = {
-- {
-+ {
- .attachment = GL_COLOR_ATTACHMENT0,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE,
- .offset = offsetof (CoglFramebufferBits, red),
- },
-- {
-+ {
- .attachment = GL_COLOR_ATTACHMENT0,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE,
- .offset = offsetof (CoglFramebufferBits, green),
- },
-- {
-+ {
- .attachment = GL_COLOR_ATTACHMENT0,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE,
- .offset = offsetof (CoglFramebufferBits, blue),
- },
-- {
-+ {
- .attachment = GL_COLOR_ATTACHMENT0,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
- .offset = offsetof (CoglFramebufferBits, alpha),
- },
-- {
-+ {
- .attachment = GL_DEPTH_ATTACHMENT,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
- .offset = offsetof (CoglFramebufferBits, depth),
- },
-- {
-+ {
- .attachment = GL_STENCIL_ATTACHMENT,
- .pname = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE,
- .offset = offsetof (CoglFramebufferBits, stencil),
---
-GitLab
-
-
-From a2203df9f43b9e501a972d23b3d5584005c03ce6 Mon Sep 17 00:00:00 2001
-From: Olivier Fourdan <ofourdan@redhat.com>
-Date: Fri, 2 Jun 2023 11:54:58 +0200
-Subject: [PATCH 2/5] cogl/gl-framebuffer: Fix inverted test in
- ensure_bits_initialized()
-
-Cogl's feature COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS is required
-to use the GL_FRAMEBUFFER_ATTACHMENT_* queries.
-
-Unfortunately, the test for the availability of the private feature is
-actually inverted in ensure_bits_initialized() which causes that whole
-portion of code to be ignored, falling back to the glGetIntegerv()
-method which isn't supported in core profiles.
-
-As Mesa has recently started to be more strict about these, this causes
-the CI tests to fail in mutter.
-
-Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
----
- cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-index 1ffc1d53509..75a8b0c1fe2 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-@@ -76,7 +76,7 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
- COGL_FRAMEBUFFER_STATE_BIND);
-
- #ifdef HAVE_COGL_GL
-- if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
-+ if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
- {
- const struct {
- GLenum attachment, pname;
---
-GitLab
-
-
-From fad240f437d6b11f664c9c09aecabe5f5e703eca Mon Sep 17 00:00:00 2001
-From: Olivier Fourdan <ofourdan@redhat.com>
-Date: Mon, 5 Jun 2023 10:31:38 +0200
-Subject: [PATCH 3/5] cogl/gl-framebuffer: Match testing features
-
-The function ensure_bits_initialized() in cogl-gl-framebuffer-fbo.c
-checks for COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS whereas the same
-in cogl-gl-framebuffer-back.c simply checks for the driver being
-COGL_DRIVER_GL3.
-
-Change the later to use the COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS
-flag as well.
-
-Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
----
- cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-index 8d76f1578bf..f6a17e8f070 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-@@ -66,7 +66,7 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
- COGL_FRAMEBUFFER_STATE_BIND);
-
- #ifdef HAVE_COGL_GL
-- if (ctx->driver == COGL_DRIVER_GL3)
-+ if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
- {
- const struct {
- GLenum attachment, pname;
---
-GitLab
-
-
-From c3af4c1b1571b05f67d48b90d9ea7313f3ca6003 Mon Sep 17 00:00:00 2001
-From: Olivier Fourdan <ofourdan@redhat.com>
-Date: Fri, 2 Jun 2023 14:27:29 +0200
-Subject: [PATCH 4/5] cogl/gl-framebuffer: Fail without QUERY_FRAMEBUFFER_BITS
-
-glGetIntegerv() with GL_RED_BITS/GL_GREEN_BITS/GL_BLUE_BITS/etc. is not
-supported with the GL core context, so there is no point in falling back
-to that without supporting COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS,
-as this will cause an GL error.
-
-Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
----
- cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 7 +------
- cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 7 +------
- 2 files changed, 2 insertions(+), 12 deletions(-)
-
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-index f6a17e8f070..0ccd2324077 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-@@ -119,12 +119,7 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
- else
- #endif /* HAVE_COGL_GL */
- {
-- GE (ctx, glGetIntegerv (GL_RED_BITS, &bits->red));
-- GE (ctx, glGetIntegerv (GL_GREEN_BITS, &bits->green));
-- GE (ctx, glGetIntegerv (GL_BLUE_BITS, &bits->blue));
-- GE (ctx, glGetIntegerv (GL_ALPHA_BITS, &bits->alpha));
-- GE (ctx, glGetIntegerv (GL_DEPTH_BITS, &bits->depth));
-- GE (ctx, glGetIntegerv (GL_STENCIL_BITS, &bits->stencil));
-+ return FALSE;
- }
-
- COGL_NOTE (FRAMEBUFFER,
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-index 75a8b0c1fe2..524196207f5 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-@@ -129,12 +129,7 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
- else
- #endif /* HAVE_COGL_GL */
- {
-- GE (ctx, glGetIntegerv (GL_RED_BITS, &bits->red));
-- GE (ctx, glGetIntegerv (GL_GREEN_BITS, &bits->green));
-- GE (ctx, glGetIntegerv (GL_BLUE_BITS, &bits->blue));
-- GE (ctx, glGetIntegerv (GL_ALPHA_BITS, &bits->alpha));
-- GE (ctx, glGetIntegerv (GL_DEPTH_BITS, &bits->depth));
-- GE (ctx, glGetIntegerv (GL_STENCIL_BITS, &bits->stencil));
-+ return FALSE;
- }
-
- if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) &&
---
-GitLab
-
-
-From d65883e0d7d70987e3888b86222b109c35f5a7a2 Mon Sep 17 00:00:00 2001
-From: Olivier Fourdan <ofourdan@redhat.com>
-Date: Mon, 5 Jun 2023 10:38:41 +0200
-Subject: [PATCH 5/5] cogl/gl-framebuffer: Remove conditional on HAVE_COGL_GL
-
-By testing the features flag, we can get rid of the conditional build
-on HAVE_COGL_GL entirely.
-
-Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3047>
----
- cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c | 2 --
- cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c | 2 --
- 2 files changed, 4 deletions(-)
-
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-index 0ccd2324077..94154d48efb 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.c
-@@ -65,7 +65,6 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
- framebuffer,
- COGL_FRAMEBUFFER_STATE_BIND);
-
--#ifdef HAVE_COGL_GL
- if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
- {
- const struct {
-@@ -117,7 +116,6 @@ ensure_bits_initialized (CoglGlFramebufferBack *gl_framebuffer_back)
- }
- }
- else
--#endif /* HAVE_COGL_GL */
- {
- return FALSE;
- }
-diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-index 524196207f5..3ea133d3143 100644
---- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-+++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.c
-@@ -75,7 +75,6 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
- framebuffer,
- COGL_FRAMEBUFFER_STATE_BIND);
-
--#ifdef HAVE_COGL_GL
- if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS))
- {
- const struct {
-@@ -127,7 +126,6 @@ ensure_bits_initialized (CoglGlFramebufferFbo *gl_framebuffer_fbo)
- }
- }
- else
--#endif /* HAVE_COGL_GL */
- {
- return FALSE;
- }
---
-GitLab
-
diff --git a/gnu/packages/patches/nautilus-extension-search-path.patch b/gnu/packages/patches/nautilus-extension-search-path.patch
index d5dc35b241..1394956315 100644
--- a/gnu/packages/patches/nautilus-extension-search-path.patch
+++ b/gnu/packages/patches/nautilus-extension-search-path.patch
@@ -1,54 +1,62 @@
Allow Nautilus to search for extensions in the directories listed
in $NAUTILUS_EXTENSION_PATH.
-diff --git a/src/nautilus-module.c b/src/nautilus-module.c
-index bf474bd..42e2a4e 100644
---- a/src/nautilus-module.c
-+++ b/src/nautilus-module.c
-@@ -211,6 +211,10 @@ static void
+Index: nautilus-44.2/src/nautilus-module.c
+===================================================================
+--- nautilus-44.2.orig/src/nautilus-module.c
++++ nautilus-44.2/src/nautilus-module.c
+@@ -220,8 +220,16 @@ static void
load_module_dir (const char *dirname)
{
GDir *dir;
+-
+ static GHashTable *loaded = NULL;
+ g_autoptr (GStrvBuilder) installed_module_name_builder = g_strv_builder_new ();
++
++ if (installed_module_names != NULL)
++ g_strv_builder_addv (installed_module_name_builder,
++ (const gchar **)installed_module_names);
+
+ if (loaded == NULL)
+ loaded = g_hash_table_new (g_str_hash, g_str_equal);
-
++
dir = g_dir_open (dirname, 0, NULL);
-@@ -221,15 +225,22 @@ load_module_dir (const char *dirname)
- while ((name = g_dir_read_name (dir)))
+ if (dir)
+@@ -232,16 +240,24 @@ load_module_dir (const char *dirname)
{
if (g_str_has_suffix (name, "." G_MODULE_SUFFIX))
-- {
+ {
- char *filename;
-
- filename = g_build_filename (dirname,
- name,
- NULL);
-- nautilus_module_load_file (filename);
+- nautilus_module_load_file (filename, installed_module_name_builder);
- g_free (filename);
-- }
-+ {
-+ /* Make sure each module is loaded only twice or this could
-+ lead to a crash. Double loading can occur if DIRNAME
-+ occurs more than once in $NAUTILUS_EXTENSION_PATH. */
-+ if (!g_hash_table_contains (loaded, name))
-+ {
-+ char *filename;
++ /* Make sure each module is loaded only twice or this could
++ lead to a crash. Double loading can occur if DIRNAME
++ occurs more than once in $NAUTILUS_EXTENSION_PATH. */
++ if (!g_hash_table_contains (loaded, name))
++ {
++ char *filename;
+
-+ filename = g_build_filename (dirname,
-+ name,
-+ NULL);
-+ nautilus_module_load_file (filename);
-+ g_hash_table_add (loaded, g_strdup (name));
-+ g_free (filename);
-+ }
-+ }
- }
++ filename = g_build_filename (dirname,
++ name,
++ NULL);
++ nautilus_module_load_file (filename,
++ installed_module_name_builder);
++ g_hash_table_add (loaded, g_strdup (name));
++ g_free (filename);
++ }
+ }
+- }
++ }
g_dir_close (dir);
-@@ -257,10 +268,24 @@ nautilus_module_setup (void)
+ }
+
+@@ -278,10 +294,24 @@ nautilus_module_setup (void)
if (!initialized)
{
diff --git a/gnu/packages/patches/opencolorio-fix-build-with-gcc11.patch b/gnu/packages/patches/opencolorio-fix-build-with-gcc11.patch
deleted file mode 100644
index 06507db206..0000000000
--- a/gnu/packages/patches/opencolorio-fix-build-with-gcc11.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Fix build failure with GCC 11:
-
-------
-[...]
-/tmp/guix-build-opencolorio-1.1.1.drv-0/source/src/core/ImageDesc.cpp:60:51: error: ‘this’ pointer is null [-Werror=nonnull]
- 60 | os << "width=" << packedImg->getWidth() << ", ";
- | ^
-/tmp/guix-build-opencolorio-1.1.1.drv-0/source/src/core/ImageDesc.cpp:274:10: note: in a call to non-static member function ‘long int OpenColorIO::v1::PackedImageDesc::getWidth() const’
- 274 | long PackedImageDesc::getWidth() const
- | ^~~~~~~~~~~~~~~
-/tmp/guix-build-opencolorio-1.1.1.drv-0/source/src/core/ImageDesc.cpp:61:53: error: ‘this’ pointer is null [-Werror=nonnull]
- 61 | os << "height=" << packedImg->getHeight() << ", ";
- | ^
-/tmp/guix-build-opencolorio-1.1.1.drv-0/source/src/core/ImageDesc.cpp:279:10: note: in a call to non-static member function ‘long int OpenColorIO::v1::PackedImageDesc::getHeight() const’
- 279 | long PackedImageDesc::getHeight() const
- | ^~~~~~~~~~~~~~~
-cc1plus: all warnings being treated as errors
-[...]
-------
-
-Patch copied from Gentoo:
-
-https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e726d850502018b6760da78dbd4a419603016b8
-
-diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
-index 1eb691b6..cff9bd83 100644
---- a/src/core/CMakeLists.txt
-+++ b/src/core/CMakeLists.txt
-@@ -23,8 +23,6 @@ if(WIN32)
- if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} /WX")
- endif()
--else()
-- set(EXTERNAL_COMPILE_FLAGS "${EXTERNAL_COMPILE_FLAGS} -Werror")
- endif()
-
- # SHARED
diff --git a/gnu/packages/patches/openssh-gcc-13-ppc64le-fzero-call-used-regs.patch b/gnu/packages/patches/openssh-gcc-13-ppc64le-fzero-call-used-regs.patch
deleted file mode 100644
index 1af9868b9a..0000000000
--- a/gnu/packages/patches/openssh-gcc-13-ppc64le-fzero-call-used-regs.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 1036d77b34a5fa15e56f516b81b9928006848cbd Mon Sep 17 00:00:00 2001
-From: Damien Miller <djm@mindrot.org>
-Date: Fri, 22 Dec 2023 17:56:26 +1100
-Subject: [PATCH] better detection of broken -fzero-call-used-regs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-gcc 13.2.0 on ppc64le refuses to compile some function, including
-cipher.c:compression_alg_list() with an error:
-
-> sorry, unimplemented: argument ‘used’ is not supportedcw
-> for ‘-fzero-call-used-regs’ on this target
-
-This extends the autoconf will-it-work test with a similarly-
-structured function that seems to catch this.
-
-Spotted/tested by Colin Watson; bz3645
----
-
-Taken from upsteam, and for Guix by jackhill@jackhill.us
-Thanks Marcel van der Boom for noticing: https://issues.guix.gnu.org/67948#2
-
-m4/openssh.m4 | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/m4/openssh.m4 b/m4/openssh.m4
-index 5d4c56280..033df501c 100644
---- a/m4/openssh.m4
-+++ b/m4/openssh.m4
-@@ -20,18 +20,24 @@ char *f2(char *s, ...) {
- va_end(args);
- return strdup(ret);
- }
-+const char *f3(int s) {
-+ return s ? "good" : "gooder";
-+}
- int main(int argc, char **argv) {
-- (void)argv;
- char b[256], *cp;
-+ const char *s;
- /* Some math to catch -ftrapv problems in the toolchain */
- int i = 123 * argc, j = 456 + argc, k = 789 - argc;
- float l = i * 2.1;
- double m = l / 0.5;
- long long int n = argc * 12345LL, o = 12345LL * (long long int)argc;
-+ (void)argv;
- f(1);
-- snprintf(b, sizeof b, "%d %d %d %f %f %lld %lld\n", i,j,k,l,m,n,o);
-+ s = f3(f(2));
-+ snprintf(b, sizeof b, "%d %d %d %f %f %lld %lld %s\n", i,j,k,l,m,n,o,s);
- if (write(1, b, 0) == -1) exit(0);
-- cp = f2("%d %d %d %f %f %lld %lld\n", i,j,k,l,m,n,o);
-+ cp = f2("%d %d %d %f %f %lld %lld %s\n", i,j,k,l,m,n,o,s);
-+ if (write(1, cp, 0) == -1) exit(0);
- free(cp);
- /*
- * Test fallthrough behaviour. clang 10's -Wimplicit-fallthrough does
---
-2.41.0
-
diff --git a/gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch b/gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch
new file mode 100644
index 0000000000..377c09d0a5
--- /dev/null
+++ b/gnu/packages/patches/orbit2-fix-array-allocation-32bit.patch
@@ -0,0 +1,40 @@
+From 28067b88ad91e794675734bc92bd9c8653b4a46a Mon Sep 17 00:00:00 2001
+Message-ID: <28067b88ad91e794675734bc92bd9c8653b4a46a.1709973702.git.vivien@planete-kraus.eu>
+From: Vivien Kraus <vivien@planete-kraus.eu>
+Date: Sat, 9 Mar 2024 09:36:56 +0100
+Subject: [PATCH] corba-loc: Do not allocate more tokens than necessary.
+
+To split the list of locations, the code calls g_strsplit with the
+last argument set to G_MAXINT. It means that g_strsplit will try to
+allocate a huge array (G_MAXINT + 1, for the final NULL), mostly
+filled with NULL. Unfortunately, on 32-bit systems, this is one past
+the authorized length for an array. Previous versions of glib would
+not care, but the new version now raises an error if this happens.
+
+To get an array of the appropriate size, we can just pass -1 to the
+last argument.
+
+* src/orb/orb-core/corba-loc.c (ORBit_corbaloc_parse): Replace
+G_MAXINT with -1.
+---
+ src/orb/orb-core/corba-loc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/orb/orb-core/corba-loc.c b/src/orb/orb-core/corba-loc.c
+index abfcaa29..6492d392 100644
+--- a/src/orb/orb-core/corba-loc.c
++++ b/src/orb/orb-core/corba-loc.c
+@@ -309,7 +309,7 @@ ORBit_corbaloc_parse (const gchar *corbaloc)
+ if (!(objkey = orbit_url_decode (okey)))
+ goto ret_error;
+
+- if (!(token = g_strsplit (loc, ",", G_MAXINT)))
++ if (!(token = g_strsplit (loc, ",", -1)))
+ goto ret_error;
+
+ /* [ 'iiop' ] ':' [ '//' ] [ version '@' ] host [ ':' port ] */
+
+base-commit: 144be2e9860286c83f009e7689250e0af977cc5e
+--
+2.41.0
+
diff --git a/gnu/packages/patches/pdfpc-build-with-vala-0.56.patch b/gnu/packages/patches/pdfpc-build-with-vala-0.56.patch
new file mode 100644
index 0000000000..e9a4060248
--- /dev/null
+++ b/gnu/packages/patches/pdfpc-build-with-vala-0.56.patch
@@ -0,0 +1,40 @@
+From 18beaecbbcc066e0d4c889b3aa3ecaa7351f7768 Mon Sep 17 00:00:00 2001
+Message-ID: <18beaecbbcc066e0d4c889b3aa3ecaa7351f7768.1711183363.git.vivien@planete-kraus.eu>
+From: Evgeny Stambulchik <fnevgeny@gmail.com>
+Date: Tue, 25 Apr 2023 16:11:25 +0300
+Subject: [PATCH] Create Lists of nullable types
+
+---
+This is the pull request for issue 686, merged in master, not released
+yet.
+
+ src/classes/drawings/drawing_commands.vala | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/classes/drawings/drawing_commands.vala b/src/classes/drawings/drawing_commands.vala
+index 77e56e6..c305a8c 100644
+--- a/src/classes/drawings/drawing_commands.vala
++++ b/src/classes/drawings/drawing_commands.vala
+@@ -54,8 +54,8 @@ namespace pdfpc {
+ }
+
+ public void clear() {
+- this.drawing_commands = new List<DrawingCommand>();
+- this.redo_commands = new List<DrawingCommand>();
++ this.drawing_commands = new List<DrawingCommand?>();
++ this.redo_commands = new List<DrawingCommand?>();
+ }
+
+ public void add_line(bool is_eraser,
+@@ -70,7 +70,7 @@ namespace pdfpc {
+
+ // After adding a new line you can no longer redo the old
+ // path.
+- this.redo_commands = new List<DrawingCommand>(); // clear
++ this.redo_commands = new List<DrawingCommand?>(); // clear
+
+ bool new_path = true;
+ double epsilon = 1e-4; // Less than 0.1 pixel for a 1000x1000 img
+--
+2.41.0
+
diff --git a/gnu/packages/patches/qtbase-find-tools-in-PATH.patch b/gnu/packages/patches/qtbase-find-tools-in-PATH.patch
new file mode 100644
index 0000000000..d5e38b09be
--- /dev/null
+++ b/gnu/packages/patches/qtbase-find-tools-in-PATH.patch
@@ -0,0 +1,49 @@
+Patch retrieved from NixOS
+
+https://github.com/NixOS/nixpkgs/blob/93ecdaa1f34354c9476062dc4fe323b442c087d5/pkgs/development/libraries/qt-6/patches/0006-qtbase-find-tools-in-PATH.patch
+
+From a8b9fae710a2bd5e743f5e16364eaa8c38dbd784 Mon Sep 17 00:00:00 2001
+From: rewine <luhongxu@deepin.org>
+Date: Wed, 29 Mar 2023 11:51:33 +0800
+Subject: [PATCH 06/11] qtbase-find-tools-in-PATH
+
+1. find qt's tools in `QTTOOLSPATH` env
+ qt assumes that all components use the same install prefix
+ we can't get the real prefix for qttools when build qtbase
+ we will add /libexec to `QTTOOLSPATH` in qtToolsHook
+ find_path will also search in 'PATH' by default
+ see `CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`
+
+2. disable tool_dependencies_enabled
+ We can guarantee the build order of qt components in nixpkgs
+ tools in qttools always build before qtdoc
+ qdoc_bin is not a build target now, since we find it in `QTTOOLSPATH`
+---
+ cmake/QtDocsHelpers.cmake | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/cmake/QtDocsHelpers.cmake b/cmake/QtDocsHelpers.cmake
+index 48ed5a324bf..91d8d41fb1f 100644
+--- a/cmake/QtDocsHelpers.cmake
++++ b/cmake/QtDocsHelpers.cmake
+@@ -47,9 +47,14 @@ function(qt_internal_add_docs)
+ set(doc_tools_libexec "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}")
+ endif()
+
+- set(qdoc_bin "${doc_tools_bin}/qdoc${CMAKE_EXECUTABLE_SUFFIX}")
+- set(qtattributionsscanner_bin "${doc_tools_libexec}/qtattributionsscanner${CMAKE_EXECUTABLE_SUFFIX}")
+- set(qhelpgenerator_bin "${doc_tools_libexec}/qhelpgenerator${CMAKE_EXECUTABLE_SUFFIX}")
++ set(tool_dependencies_enabled FALSE)
++
++ find_path(qdoc_path name qdoc PATHS ENV QTTOOLSPATH)
++ find_path(qtattributionsscanner_path name qtattributionsscanner PATHS ENV QTTOOLSPATH)
++ find_path(qhelpgenerator_path name qhelpgenerator PATHS ENV QTTOOLSPATH)
++ set(qdoc_bin "${qdoc_path}/qdoc${CMAKE_EXECUTABLE_SUFFIX}")
++ set(qtattributionsscanner_bin "${qtattributionsscanner_path}/qtattributionsscanner${CMAKE_EXECUTABLE_SUFFIX}")
++ set(qhelpgenerator_bin "${qhelpgenerator_path}/qhelpgenerator${CMAKE_EXECUTABLE_SUFFIX}")
+
+ get_target_property(target_type ${target} TYPE)
+ if (NOT target_type STREQUAL "INTERFACE_LIBRARY")
+--
+2.42.0
+
diff --git a/gnu/packages/patches/qtbase-qmake-fix-includedir.patch b/gnu/packages/patches/qtbase-qmake-fix-includedir.patch
new file mode 100644
index 0000000000..766689c4fd
--- /dev/null
+++ b/gnu/packages/patches/qtbase-qmake-fix-includedir.patch
@@ -0,0 +1,29 @@
+Patch retrieved from NixOS
+https://github.com/NixOS/nixpkgs/blob/93ecdaa1f34354c9476062dc4fe323b442c087d5/pkgs/development/libraries/qt-6/patches/0003-qtbase-qmake-fix-includedir-in-generated-pkg-config.patch
+
+From 6088085d3074316dd74639fc6c1233e5862aff11 Mon Sep 17 00:00:00 2001
+From: Nick Cao <nickcao@nichi.co>
+Date: Fri, 14 Apr 2023 09:34:46 +0800
+Subject: [PATCH 03/11] qtbase: qmake: fix includedir in generated pkg-config
+
+---
+ qmake/generators/makefile.cpp | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
+index 11d2f0ff7df..c78ed0d3485 100644
+--- a/qmake/generators/makefile.cpp
++++ b/qmake/generators/makefile.cpp
+@@ -3412,8 +3412,7 @@ MakefileGenerator::writePkgConfigFile()
+ << varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ")
+ // << varGlue("DEFINES","-D"," -D"," ")
+ ;
+- if (!project->values("QMAKE_DEFAULT_INCDIRS").contains(includeDir))
+- t << "-I${includedir}";
++ t << "-I${includedir}";
+ if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")
+ && libDir != QLatin1String("/Library/Frameworks")) {
+ t << " -F${libdir}";
+--
+2.42.0
+
diff --git a/gnu/packages/patches/qtbase-qmlimportscanner-qml-import-path.patch b/gnu/packages/patches/qtbase-qmlimportscanner-qml-import-path.patch
new file mode 100644
index 0000000000..b73a1fba73
--- /dev/null
+++ b/gnu/packages/patches/qtbase-qmlimportscanner-qml-import-path.patch
@@ -0,0 +1,33 @@
+Retrieved from nixpkgs.
+Modified to use QML_IMPORT_PATH instead of QML2_IMPORT_PATH.
+
+From d7a9a3b0ecdbb1b5829f25954d763d767f1c8794 Mon Sep 17 00:00:00 2001
+From: Nick Cao <nickcao@nichi.co>
+Date: Tue, 10 Oct 2023 10:12:56 -0400
+Subject: [PATCH 07/11] qtbase: pass to qmlimportscanner the QML2_IMPORT_PATH
+
+---
+ src/tools/macdeployqt/shared/shared.cpp | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/tools/macdeployqt/shared/shared.cpp b/src/tools/macdeployqt/shared/shared.cpp
+index 2ae4f998944..ba10ae02bcd 100644
+--- a/src/tools/macdeployqt/shared/shared.cpp
++++ b/src/tools/macdeployqt/shared/shared.cpp
+@@ -1297,6 +1297,13 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
+ argumentList.append( "-importPath");
+ argumentList.append(qmlImportsPath);
+
++ // In a modularized installation of qt as we have in Nix, instead, we will
++ // read the paths from the environment, as they are spread in multiple
++ // locations and normally set in the environment like this
++ auto envQmlImportPaths = ::qgetenv("QML_IMPORT_PATH").split(':');
++ for (const QString &importPath : envQmlImportPaths)
++ argumentList << "-importPath" << importPath;
++
+ // run qmlimportscanner
+ QProcess qmlImportScanner;
+ qmlImportScanner.start(qmlImportScannerPath, argumentList);
+--
+2.42.0
+
diff --git a/gnu/packages/patches/qtbase-use-TZDIR.patch b/gnu/packages/patches/qtbase-use-TZDIR.patch
deleted file mode 100644
index 98bf7493e9..0000000000
--- a/gnu/packages/patches/qtbase-use-TZDIR.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-From 1075606f8b2f9e153c82f8e50cbd69cea9c72e87 Mon Sep 17 00:00:00 2001
-From: Edward Welbourne <edward.welbourne@qt.io>
-Date: Mon, 11 Sep 2023 11:41:39 +0200
-Subject: [PATCH] Support the TZDIR environment variable
-
-On Linux / glibc, this overrides the default system location for the
-zone info. So check for files there first. Break out a function to
-manage the trying of (now three) zoneinfo directories when opening a
-file by name relative to there.
-
-Pick-to: 6.6 6.5
-Task-number: QTBUG-116017
-Change-Id: I1f97107aabd9015c0a5543639870f1d70654ca67
----
-* Rebased on top of v6.5.2.
-
- src/corelib/time/qtimezoneprivate_tz.cpp | 73 ++++++++++++++++--------
- 1 file changed, 49 insertions(+), 24 deletions(-)
-
-diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp
-index 067191d816..a8b2fc894e 100644
---- a/src/corelib/time/qtimezoneprivate_tz.cpp
-+++ b/src/corelib/time/qtimezoneprivate_tz.cpp
-@@ -51,17 +51,41 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
-
- static bool isTzFile(const QString &name);
-
-+// Open a named file under the zone info directory:
-+static bool openZoneInfo(QString name, QFile *file)
-+{
-+ // At least on Linux / glibc (see man 3 tzset), $TZDIR overrides the system
-+ // default location for zone info:
-+ const QString tzdir = qEnvironmentVariable("TZDIR");
-+ if (!tzdir.isEmpty()) {
-+ file->setFileName(QDir(tzdir).filePath(name));
-+ if (file->open(QIODevice::ReadOnly))
-+ return true;
-+ }
-+ // Try modern system path first:
-+ constexpr auto zoneShare = "/usr/share/zoneinfo/"_L1;
-+ if (tzdir != zoneShare && tzdir != zoneShare.chopped(1)) {
-+ file->setFileName(zoneShare + name);
-+ if (file->open(QIODevice::ReadOnly))
-+ return true;
-+ }
-+ // Fall back to legacy system path:
-+ constexpr auto zoneLib = "/usr/lib/zoneinfo/"_L1;
-+ if (tzdir != zoneLib && tzdir != zoneLib.chopped(1)) {
-+ file->setFileName(zoneShare + name);
-+ if (file->open(QIODevice::ReadOnly))
-+ return true;
-+ }
-+ return false;
-+}
-+
- // Parse zone.tab table for territory information, read directories to ensure we
- // find all installed zones (many are omitted from zone.tab; even more from
- // zone1970.tab).
- static QTzTimeZoneHash loadTzTimeZones()
- {
-- QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
-- if (!QFile::exists(path))
-- path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
--
-- QFile tzif(path);
-- if (!tzif.open(QIODevice::ReadOnly))
-+ QFile tzif;
-+ if (!openZoneInfo("zone.tab"_L1, &tzif))
- return QTzTimeZoneHash();
-
- QTzTimeZoneHash zonesHash;
-@@ -91,6 +115,7 @@ static QTzTimeZoneHash loadTzTimeZones()
- }
- }
-
-+ const QString path = tzif.fileName();
- const qsizetype cut = path.lastIndexOf(u'/');
- Q_ASSERT(cut > 0);
- const QDir zoneDir = QDir(path.first(cut));
-@@ -761,20 +786,13 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId)
- tzif.setFileName(QStringLiteral("/etc/localtime"));
- if (!tzif.open(QIODevice::ReadOnly))
- return ret;
-- } else {
-- // Open named tz, try modern path first, if fails try legacy path
-- tzif.setFileName("/usr/share/zoneinfo/"_L1 + QString::fromLocal8Bit(ianaId));
-- if (!tzif.open(QIODevice::ReadOnly)) {
-- tzif.setFileName("/usr/lib/zoneinfo/"_L1 + QString::fromLocal8Bit(ianaId));
-- if (!tzif.open(QIODevice::ReadOnly)) {
-- // ianaId may be a POSIX rule, taken from $TZ or /etc/TZ
-- auto check = validatePosixRule(ianaId);
-- if (check.isValid) {
-- ret.m_hasDst = check.hasDst;
-- ret.m_posixRule = ianaId;
-- }
-- return ret;
-- }
-+ } else if (!openZoneInfo(QString::fromLocal8Bit(ianaId), &tzif)) {
-+ // ianaId may be a POSIX rule, taken from $TZ or /etc/TZ
-+ auto check = validatePosixRule(ianaId);
-+ if (check.isValid) {
-+ ret.m_hasDst = check.hasDst;
-+ ret.m_posixRule = ianaId;
-+ return ret;
- }
- }
-
-@@ -1317,7 +1335,8 @@ private:
- {
- // On most distros /etc/localtime is a symlink to a real file so extract
- // name from the path
-- const auto zoneinfo = "/zoneinfo/"_L1;
-+ const QString tzdir = qEnvironmentVariable("TZDIR");
-+ constexpr auto zoneinfo = "/zoneinfo/"_L1;
- QString path = QStringLiteral("/etc/localtime");
- long iteration = getSymloopMax();
- // Symlink may point to another symlink etc. before being under zoneinfo/
-@@ -1325,9 +1344,15 @@ private:
- // symlink, like America/Montreal pointing to America/Toronto
- do {
- path = QFile::symLinkTarget(path);
-- int index = path.indexOf(zoneinfo);
-- if (index >= 0) // Found zoneinfo file; extract zone name from path:
-- return QStringView{ path }.mid(index + zoneinfo.size()).toUtf8();
-+ // If it's a zoneinfo file, extract the zone name from its path:
-+ int index = tzdir.isEmpty() ? -1 : path.indexOf(tzdir);
-+ if (index >= 0) {
-+ const auto tail = QStringView{ path }.sliced(index + tzdir.size()).toUtf8();
-+ return tail.startsWith(u'/') ? tail.sliced(1) : tail;
-+ }
-+ index = path.indexOf(zoneinfo);
-+ if (index >= 0)
-+ return QStringView{ path }.sliced(index + zoneinfo.size()).toUtf8();
- } while (!path.isEmpty() && --iteration > 0);
-
- return QByteArray();
-
-base-commit: af457a9f0f7eb1a2a7d11f495da508faab91a442
---
-2.41.0
-
diff --git a/gnu/packages/patches/qtdeclarative-disable-qmlcache.patch b/gnu/packages/patches/qtdeclarative-disable-qmlcache.patch
index 5f06ec53b4..df76fab910 100644
--- a/gnu/packages/patches/qtdeclarative-disable-qmlcache.patch
+++ b/gnu/packages/patches/qtdeclarative-disable-qmlcache.patch
@@ -1,16 +1,31 @@
Retrieved from
https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/development/libraries/qt-6/patches/qtdeclarative-default-disable-qmlcache.patch
+From 2d561e0a80f2d123a7348187975ee845f9dcd9e0 Mon Sep 17 00:00:00 2001
+From: Nick Cao <nickcao@nichi.co>
+Date: Tue, 10 Oct 2023 11:12:27 -0400
+Subject: [PATCH] qtdeclarative: disable qml disk cache
+
+---
+ src/qml/jsruntime/qv4engine.cpp | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
-index 852cde9e..165f1b57 100644
+index d1b4c4fff6..50f8a07420 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
-@@ -2093,7 +2093,7 @@ void ExecutionEngine::registerModule(const QString &_name, const QJSValue &modul
-
- bool ExecutionEngine::diskCacheEnabled() const
+@@ -2232,11 +2232,7 @@ ExecutionEngine::DiskCacheOptions ExecutionEngine::diskCacheOptions() const
{
-- return (!disableDiskCache() && !debugger()) || forceDiskCache();
-+ return forceDiskCache();
+ if (forceDiskCache())
+ return DiskCache::Enabled;
+- if (disableDiskCache() || debugger())
+- return DiskCache::Disabled;
+- static const DiskCacheOptions options = qmlGetConfigOption<
+- DiskCacheOptions, transFormDiskCache>("QML_DISK_CACHE");
+- return options;
++ return DiskCache::Disabled;
}
void ExecutionEngine::callInContext(QV4::Function *function, QObject *self,
+--
+2.42.0
diff --git a/gnu/packages/patches/racket-backport-8.11-layered-docs.patch b/gnu/packages/patches/racket-backport-8.11-layered-docs.patch
deleted file mode 100644
index 07f105bb24..0000000000
--- a/gnu/packages/patches/racket-backport-8.11-layered-docs.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 1d8dbdf408db9e99f1382323477561d5148cd451 Mon Sep 17 00:00:00 2001
-From: Philip McGrath <philip@philipmcgrath.com>
-Date: Fri, 20 Oct 2023 17:19:50 -0400
-Subject: [PATCH] racket-index: fix release.scrbl for layered installations
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Configure the release notes page to be rendered separately at every
-installation layer. Otherwise, rendering documentation for packages
-installed in a new layer might try to write to `release/in.sxref`
-in the parent layer’s docs directory.
-
-Related to https://github.com/videolang/video/issues/67
-Related to https://issues.guix.gnu.org/56534
-
-(cherry picked from commit 85f21854c0a41564b755fbe180fe6b85de6c4730)
----
- pkgs/racket-index/scribblings/main/info.rkt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/pkgs/racket-index/scribblings/main/info.rkt b/pkgs/racket-index/scribblings/main/info.rkt
-index 75c507848a..a6a3798f7c 100644
---- a/pkgs/racket-index/scribblings/main/info.rkt
-+++ b/pkgs/racket-index/scribblings/main/info.rkt
-@@ -6,4 +6,4 @@
- ("local-redirect.scrbl" (depends-all-main no-depend-on every-main-layer) (omit) "local-redirect" 1 10)
- ("license.scrbl" () (omit))
- ("acks.scrbl" () (omit))
-- ("release.scrbl" (depends-all-main no-depend-on) (omit))))
-+ ("release.scrbl" (depends-all-main no-depend-on every-main-layer) (omit))))
-
-base-commit: c3a502c0ae9f4d615bfd85fc7d88b781826bbb09
---
-2.41.0
-
diff --git a/gnu/packages/patches/racket-backport-8.12-chez-configure.patch b/gnu/packages/patches/racket-backport-8.12-chez-configure.patch
new file mode 100644
index 0000000000..483948fec9
--- /dev/null
+++ b/gnu/packages/patches/racket-backport-8.12-chez-configure.patch
@@ -0,0 +1,423 @@
+From 82157f5b3fb9f71ad7fc978c428d423d06a4a0df Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 28 Feb 2024 19:41:22 -0500
+Subject: [PATCH 1/2] Chez Scheme: Repairs and improvements for building with
+ external dependencies
+
+* configure: support `ZUO=<zuo>`
+
+Supplying `ZUO=<zuo>` skips the submodule check in `configure`
+and configures the generated makefile not to build or remove Zuo.
+
+* configure: support `STEXLIB=<stex>`
+
+For compatibility with older scripts, when not explicitly configured,
+continue to honor the `STEXLIB` environment variable at build time.
+
+(cherry picked from commit 694fbd47a125c7fde10a328c6fda199dac19f802)
+---
+ racket/src/ChezScheme/BUILDING | 5 ++--
+ racket/src/ChezScheme/build.zuo | 13 +++++++---
+ racket/src/ChezScheme/configure | 27 ++++++++++++++++++++-
+ racket/src/ChezScheme/makefiles/Makefile.in | 6 ++---
+ 4 files changed, 40 insertions(+), 11 deletions(-)
+
+diff --git a/racket/src/ChezScheme/BUILDING b/racket/src/ChezScheme/BUILDING
+index 50fde27771..2df29b5bd8 100644
+--- a/racket/src/ChezScheme/BUILDING
++++ b/racket/src/ChezScheme/BUILDING
+@@ -155,7 +155,8 @@ information on the supported options.
+ The generated makefile mostly just ensures that a `zuo` executable is
+ built in a `bin` directory, and then it defers the actual build work
+ to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
+-you can use `zuo` directly instead of `make`. In general, instead of
++you can use `zuo` directly instead of `make`: in that case, you may
++wish to use `./configure ZUO=<zuo>`. In general, instead of
+ the command `make X` to build target `X` as described below, you can
+ use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
+
+@@ -339,7 +340,7 @@ The makefile supports several targets:
+ * `make clean`
+
+ Removes all built elements from the workarea, and then removes
+- `bin/zuo`.
++ `bin/zuo` (unless configured with `ZUO=<zuo>`).
+
+
+ WINDOWS VIA COMMAND PROMPT
+diff --git a/racket/src/ChezScheme/build.zuo b/racket/src/ChezScheme/build.zuo
+index a211632a89..432cc6e5a1 100644
+--- a/racket/src/ChezScheme/build.zuo
++++ b/racket/src/ChezScheme/build.zuo
+@@ -218,10 +218,15 @@
+ token))
+
+ (define stexlib
+- (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
+- (if found
+- (cdr found)
+- (at-source "stex"))))
++ (let ([configured (hash-ref config 'STEXLIB "")]
++ [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
++ (cond
++ [(not (equal? "" configured))
++ configured]
++ [env
++ (cdr env)]
++ [else
++ (at-source "stex")])))
+ (define stex-sources
+ (source-tree stexlib))
+
+diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
+index 721d1d1335..f88c6f7625 100755
+--- a/racket/src/ChezScheme/configure
++++ b/racket/src/ChezScheme/configure
+@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
+ CFLAGS_ADD=
+ zlibLib=
+ LZ4Lib=
++STEXLIB=
+ Kernel=KernelLib
+ buildKernelOnly=no
+ enableFrompb=yes
+@@ -102,6 +103,7 @@ empetite=no
+ moreBootFiles=
+ preloadBootFiles=
+ alwaysUseBootFile=
++zuoExternal=
+
+ CONFIG_UNAME=`uname`
+
+@@ -442,6 +444,12 @@ while [ $# != 0 ] ; do
+ LZ4=*)
+ LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
+ ;;
++ STEXLIB=*)
++ STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
++ ;;
++ ZUO=*)
++ zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
++ ;;
+ *)
+ echo "option '$1' unrecognized or missing an argument; try $0 --help"
+ exit 1
+@@ -667,6 +675,8 @@ if [ "$help" = "yes" ]; then
+ echo " STRIP=<strip> executable stripper"
+ echo " ZLIB=<lib> link to <lib> instead of own zlib"
+ echo " LZ4=<lib> link to <lib> instead of own LZ4"
++ echo " STEXLIB=<stex> build docs with <stex> instead of own stex"
++ echo " ZUO=<zuo> build with <zuo> instead of own Zuo"
+ echo ""
+ echo "Available machine types: $machs"
+ echo ""
+@@ -869,6 +879,16 @@ if [ "$addflags" = "yes" ] ; then
+ fi
+ fi
+
++if [ "${zuoExternal}" = "" ] ; then
++ ZUO="bin/zuo"
++ RM_ZUO="rm -f bin/zuo"
++ ZUO_TARGET="bin/zuo"
++else
++ ZUO="${zuoExternal}"
++ RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
++ ZUO_TARGET="DoNotBuildZuo"
++fi
++
+ # more compile and link flags for c/Mf-unix and mats/Mf-unix
+ mdinclude=
+ mdcppflags=
+@@ -1039,7 +1059,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
+ # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
+ cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
+
+-# The content of "$w/Makefile" records configuration decisions,
++# The content of "$w/Mf-config" records configuration decisions,
+ # and the Zuo build script takes it from there
+ cat > $w/Mf-config << END
+ srcdir=$srcdir
+@@ -1075,6 +1095,7 @@ cursesLib=$cursesLib
+ ncursesLib=$ncursesLib
+ zlibLib=$zlibLib
+ LZ4Lib=$LZ4Lib
++STEXLIB=$STEXLIB
+ warningFlags=$warningFlags
+ Kernel=$Kernel
+ installscriptname=$installscriptname
+@@ -1086,6 +1107,10 @@ preloadBootFiles=$preloadBootFiles
+ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+
++ZUO=$ZUO
++RM_ZUO=$RM_ZUO
++ZUO_TARGET=$ZUO_TARGET
++
+ InstallBin=$installbin
+ InstallLib=$installlib
+ InstallMan=$installman/man1
+diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
+index cfdd0230a3..4865bf2e2f 100644
+--- a/racket/src/ChezScheme/makefiles/Makefile.in
++++ b/racket/src/ChezScheme/makefiles/Makefile.in
+@@ -3,8 +3,6 @@ workarea=$(w)
+
+ include $(workarea)/Mf-config
+
+-ZUO=bin/zuo
+-
+ .PHONY: build
+ build: $(ZUO)
+ + $(ZUO) $(workarea) MAKE="$(MAKE)"
+@@ -140,9 +138,9 @@ pkg: $(ZUO)
+ .PHONY: clean
+ clean: $(ZUO)
+ + $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+- rm -f bin/zuo
++ $(RM_ZUO)
+
+ # Using `+` here means that $(ZUO) gets built even if `-n`/`--dry-run` is provided to `make`
+-$(ZUO): $(srcdir)/../zuo/zuo.c
++$(ZUO_TARGET): $(srcdir)/../zuo/zuo.c
+ + mkdir -p bin
+ + $(CC_FOR_BUILD) -DZUO_LIB_PATH='"'"$(upsrcdir)/../zuo/lib"'"' -o $(ZUO) $(srcdir)/../zuo/zuo.c
+
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
+--
+2.41.0
+
+
+From e2bc69c5ce7437dd9a1b30ac1b12b3a56872c491 Mon Sep 17 00:00:00 2001
+From: Matthew Flatt <mflatt@racket-lang.org>
+Date: Sun, 10 Mar 2024 09:13:40 -0600
+Subject: [PATCH 2/2] Chez Scheme: adjust `configure ZUO=<command>` support
+
+Continuing from 694fbd47a1, adjust the generated makefile so the
+supplied `<command>` is not a makefile dependency. That way, `ZUO=zuo`
+works if `zuo` is installed and the current build directory is not the
+source directory. (The `zuo` executable is a dependency in a real and
+relevant sense, but not in the sense of dependencies that we normally
+track in makefiles.)
+
+Also adapt the makefile for the case that `ZUO=...` is not supplied
+and the build directory is not the source directory, in which case
+`ZUO_LIB_PATH` needs to be relative to the source directory.
+
+Using `make ZUO=zuo` can also work, but in that case, `bin/zuo` is
+still built as a dependency. It's possible that some portable makefile
+magic could overcome that limitation, but it doesn't seem important.
+
+(cherry picked from commit 28157ba88d48fe645563f46f6c00d6626b3428fa)
+---
+ racket/src/ChezScheme/configure | 3 +
+ racket/src/ChezScheme/makefiles/Makefile.in | 70 +++++++++++----------
+ 2 files changed, 40 insertions(+), 33 deletions(-)
+
+diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure
+index f88c6f7625..201dbe580f 100755
+--- a/racket/src/ChezScheme/configure
++++ b/racket/src/ChezScheme/configure
+@@ -881,10 +881,12 @@ fi
+
+ if [ "${zuoExternal}" = "" ] ; then
+ ZUO="bin/zuo"
++ ZUO_DEP="${ZUO}"
+ RM_ZUO="rm -f bin/zuo"
+ ZUO_TARGET="bin/zuo"
+ else
+ ZUO="${zuoExternal}"
++ ZUO_DEP=""
+ RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
+ ZUO_TARGET="DoNotBuildZuo"
+ fi
+@@ -1108,6 +1110,7 @@ alwaysUseBootFile=$alwaysUseBootFile
+ relativeBootFiles=$relativeBootFiles
+
+ ZUO=$ZUO
++ZUO_DEP=$ZUO_DEP
+ RM_ZUO=$RM_ZUO
+ ZUO_TARGET=$ZUO_TARGET
+
+diff --git a/racket/src/ChezScheme/makefiles/Makefile.in b/racket/src/ChezScheme/makefiles/Makefile.in
+index 4865bf2e2f..5ce237178e 100644
+--- a/racket/src/ChezScheme/makefiles/Makefile.in
++++ b/racket/src/ChezScheme/makefiles/Makefile.in
+@@ -4,51 +4,55 @@ workarea=$(w)
+ include $(workarea)/Mf-config
+
+ .PHONY: build
+-build: $(ZUO)
++build: $(ZUO_DEP)
+ + $(ZUO) $(workarea) MAKE="$(MAKE)"
+
+ .PHONY: run
+-run: $(ZUO)
++run: $(ZUO_DEP)
+ + $(ZUO) $(workarea) run
+
+ .PHONY: kernel
+-kernel: $(ZUO)
++kernel: $(ZUO_DEP)
+ + $(ZUO) $(workarea) kernel MAKE="$(MAKE)"
+
+ .PHONY: install
+-install: $(ZUO)
++install: $(ZUO_DEP)
+ $(ZUO) $(workarea) install MAKE="$(MAKE)"
+
+ .PHONY: uninstall
+-uninstall: $(ZUO)
++uninstall: $(ZUO_DEP)
+ + $(ZUO) $(workarea) uninstall MAKE="$(MAKE)"
+
+-.PHONY: test
+-test: $(ZUO)
+- + $(ZUO) $(workarea) test MAKE="$(MAKE)"
++.PHONY: test-one
++test-one: $(ZUO_DEP)
++ + $(ZUO) $(workarea) test-one MAKE="$(MAKE)"
+
+ .PHONY: test-some-fast
+-test-some-fast: $(ZUO)
++test-some-fast: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test-some-fast MAKE="$(MAKE)"
+
+ .PHONY: test-some
+-test-some: $(ZUO)
++test-some: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test-some MAKE="$(MAKE)"
+
++.PHONY: test
++test: $(ZUO_DEP)
++ + $(ZUO) $(workarea) test MAKE="$(MAKE)"
++
+ .PHONY: test-more
+-test-more: $(ZUO)
++test-more: $(ZUO_DEP)
+ + $(ZUO) $(workarea) test-more MAKE="$(MAKE)"
+
+ .PHONY: coverage
+-coverage: $(ZUO)
++coverage: $(ZUO_DEP)
+ + $(ZUO) $(workarea) coverage MAKE="$(MAKE)"
+
+ .PHONY: bootfiles
+-bootfiles: $(ZUO)
++bootfiles: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootfiles MAKE="$(MAKE)"
+
+ .PHONY: reset
+-reset: $(ZUO)
++reset: $(ZUO_DEP)
+ + $(ZUO) $(workarea) reset MAKE="$(MAKE)"
+
+ # Supply XM=<machine> to build boot files for <machine>
+@@ -57,86 +61,86 @@ boot:
+ + $(ZUO) $(workarea) boot "$(XM)" MAKE="$(MAKE)"
+
+ # `<machine>.boot` as alias for `boot XM=<machine>`
+-%.boot: $(ZUO)
++%.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) boot $* MAKE="$(MAKE)"
+
+ .PHONY: auto.boot
+-auto.boot: $(ZUO)
++auto.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) boot MAKE="$(MAKE)"
+
+ SCHEME=scheme
+
+ .PHONY: cross.boot
+-cross.boot: $(ZUO)
++cross.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) boot SCHEME="$(SCHEME)" MAKE="$(MAKE)"
+
+ .PHONY: re.boot
+-re.boot: $(ZUO)
++re.boot: $(ZUO_DEP)
+ + $(ZUO) $(workarea) reboot SCHEME="$(SCHEME)"
+
+ # Supply XM=<machine> to build boot files for <machine>
+ # with o=3 d=0 for the cross compiler, and only after
+ # building the kernel for the configured machine
+ .PHONY: bootquick
+-bootquick: $(ZUO)
++bootquick: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootquick "$(XM)" MAKE="$(MAKE)"
+
+ # `<machine>.bootquick` as alias for `boot XM=<machine>`
+-%.bootquick: $(ZUO)
++%.bootquick: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootquick $* MAKE="$(MAKE)"
+
+-auto.bootquick: $(ZUO)
++auto.bootquick: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootquick MAKE="$(MAKE)"
+
+ # Supply XM=<machine>-<tag>.bootpbchunk to repackage boot files for
+ # <machine> with pbchunk sources, including additional
+ # boot files
+ .PHONY: bootpbchunk
+-bootpbchunk: $(ZUO)
++bootpbchunk: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootpbchunk "$(XM)" $(ARGS) MAKE="$(MAKE)"
+
+ # `<machine>.bootpbchunk` as alias for `pbchunk XM=<machine>`
+-%.bootpbchunk: $(ZUO)
++%.bootpbchunk: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bootpbchunk $* $(ARGS) MAKE="$(MAKE)"
+
+ .PHONY: docs
+-docs: build $(ZUO)
++docs: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) docs MAKE="$(MAKE)"
+
+ .PHONY: csug
+-csug: build $(ZUO)
++csug: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) csug MAKE="$(MAKE)"
+
+ .PHONY: release_notes
+-release_notes: build $(ZUO)
++release_notes: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) release_notes MAKE="$(MAKE)"
+
+ .PHONY: install-docs
+-install-docs: build $(ZUO)
++install-docs: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) install-docs MAKE="$(MAKE)"
+
+ .PHONY: install-csug
+-install-csug: build $(ZUO)
++install-csug: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) install-csug MAKE="$(MAKE)"
+
+ .PHONY: install-release_notes
+-install-release_notes: build $(ZUO)
++install-release_notes: build $(ZUO_DEP)
+ + $(ZUO) $(workarea) install-release_notes MAKE="$(MAKE)"
+
+ .PHONY: bintar
+-bintar: $(ZUO)
++bintar: $(ZUO_DEP)
+ + $(ZUO) $(workarea) bintar MAKE="$(MAKE)"
+
+ .PHONY: rpm
+-rpm: $(ZUO)
++rpm: $(ZUO_DEP)
+ + $(ZUO) $(workarea) rpm MAKE="$(MAKE)"
+
+ .PHONY: pkg
+-pkg: $(ZUO)
++pkg: $(ZUO_DEP)
+ + $(ZUO) $(workarea) pkg MAKE="$(MAKE)"
+
+ .PHONY: clean
+-clean: $(ZUO)
++clean: $(ZUO_DEP)
+ + $(ZUO) $(workarea) clean MAKE="$(MAKE)"
+ $(RM_ZUO)
+
+--
+2.41.0
+
diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
index 331b4f244b..e77c26f303 100644
--- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
+++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch
@@ -1,4 +1,4 @@
-From f86370295c5bb14d4bb93d0ccfa37a2b79f19f25 Mon Sep 17 00:00:00 2001
+From 5398e6d3305def343a009aba7c5f8915851c4115 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Wed, 24 Aug 2022 19:55:14 -0400
Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix
@@ -14,17 +14,22 @@ then `s_process` will call `execl` with the file specified by
`_PATH_BSHELL` instead of "/bin/sh".
Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Chez Scheme
+or executables it builds in non-Guix envoronments.
This patch does not change the behavior of `s_system`, which relies
on `system` from the C library.
---
+
+Notes:
+ See also chez-scheme-bin-sh.patch, racket-rktio-bin-sh.patch,
+ and zuo-bin-sh.patch.
+
racket/src/ChezScheme/c/prim5.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c
-index 82bbf8d687..be8f603447 100644
+index 90b087f125..284f063f8b 100644
--- a/racket/src/ChezScheme/c/prim5.c
+++ b/racket/src/ChezScheme/c/prim5.c
@@ -27,6 +27,12 @@
@@ -40,7 +45,7 @@ index 82bbf8d687..be8f603447 100644
/* locally defined functions */
static INT s_errno(void);
static IBOOL s_addr_in_heap(uptr x);
-@@ -861,6 +867,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
+@@ -875,6 +881,17 @@ static ptr s_process(char *s, IBOOL stderrp) {
INT tofds[2], fromfds[2], errfds[2];
struct sigaction act, oint_act;
@@ -58,7 +63,7 @@ index 82bbf8d687..be8f603447 100644
if (pipe(tofds)) S_error("process","cannot open pipes");
if (pipe(fromfds)) {
-@@ -897,7 +914,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
+@@ -911,7 +928,9 @@ static ptr s_process(char *s, IBOOL stderrp) {
}
}
#endif /* __GNU__ Hurd */
@@ -70,7 +75,7 @@ index 82bbf8d687..be8f603447 100644
/*NOTREACHED*/
} else {
-base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
--
-2.32.0
+2.41.0
diff --git a/gnu/packages/patches/racket-rktio-bin-sh.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch
index ec6f0d9c56..d777c0979a 100644
--- a/gnu/packages/patches/racket-rktio-bin-sh.patch
+++ b/gnu/packages/patches/racket-rktio-bin-sh.patch
@@ -1,4 +1,4 @@
-From 6a553f24439fe64fd3a2f0b5902f00590ca4241f Mon Sep 17 00:00:00 2001
+From 5e546a30789e5c9b3c94674b94cb63e16ee2e951 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Thu, 4 Mar 2021 04:11:50 -0500
Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix
@@ -28,11 +28,16 @@ Checking that the path specified by `_PATH_BSHELL` exists safeguards
against obscure errors if attempting to use stand-alone executables
built by the patched Racket in non-Guix envoronments.
---
+
+Notes:
+ See also chez-scheme-bin-sh.patch, racket-chez-scheme-bin-sh.patch,
+ and zuo-bin-sh.patch.
+
racket/src/rktio/rktio_process.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c
-index fafaf728c1..796ebc59ce 100644
+index 862850d93a..87daafef76 100644
--- a/racket/src/rktio/rktio_process.c
+++ b/racket/src/rktio/rktio_process.c
@@ -9,6 +9,7 @@
@@ -43,7 +48,7 @@ index fafaf728c1..796ebc59ce 100644
# ifdef USE_ULIMIT
# include <ulimit.h>
# endif
-@@ -1301,12 +1302,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
+@@ -1358,12 +1359,14 @@ int rktio_process_allowed_flags(rktio_t *rktio)
/*========================================================================*/
rktio_process_result_t *rktio_process(rktio_t *rktio,
@@ -59,7 +64,7 @@ index fafaf728c1..796ebc59ce 100644
rktio_process_result_t *result;
intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2];
int pid;
-@@ -1333,6 +1336,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
+@@ -1390,6 +1393,18 @@ rktio_process_result_t *rktio_process(rktio_t *rktio,
int i;
#endif
@@ -79,7 +84,7 @@ index fafaf728c1..796ebc59ce 100644
to_subprocess[0] = -1;
to_subprocess[1] = -1;
-base-commit: 9d228d16fb99c274c964e5bef93e97333888769f
+base-commit: 78fef00d4d16a79fdf6ab31924b3a80cadf4b368
--
-2.32.0
+2.41.0
diff --git a/gnu/packages/patches/shared-mime-info-xdgmime-path.patch b/gnu/packages/patches/shared-mime-info-xdgmime-path.patch
new file mode 100644
index 0000000000..27c578f3fa
--- /dev/null
+++ b/gnu/packages/patches/shared-mime-info-xdgmime-path.patch
@@ -0,0 +1,22 @@
+Adapted from <https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/182>.
+
+diff --git a/meson.build b/meson.build
+index 3c75424..7058562 100644
+--- a/meson.build
++++ b/meson.build
+@@ -26,11 +26,11 @@ xmlto = find_program('xmlto', required: false)
+ ###############################################################################
+ # Find xdgmime
+
+-xdgmime = get_option('xdgmime-path') / 'src'
++xdgmime = get_option('xdgmime-path')
+
+-xdgmime_print_mime_data = find_program(xdgmime/'print-mime-data', required: false)
+-xdgmime_test_mime_data = find_program(xdgmime/'test-mime-data', required: false)
+-xdgmime_test_mime = find_program(xdgmime/'test-mime', required: false)
++xdgmime_print_mime_data = find_program('print-mime-data', xdgmime/'print-mime-data', required: false)
++xdgmime_test_mime_data = find_program('test-mime-data', xdgmime/'test-mime-data', required: false)
++xdgmime_test_mime = find_program('test-mime', xdgmime/'test-mime', required: false)
+ xdgmime_found = (
+ xdgmime_print_mime_data.found() and
+ xdgmime_test_mime_data.found() and
diff --git a/gnu/packages/patches/xgboost-use-system-dmlc-core.patch b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch
index 6b2a1651a5..cbc0feed1c 100644
--- a/gnu/packages/patches/xgboost-use-system-dmlc-core.patch
+++ b/gnu/packages/patches/xgboost-use-system-dmlc-core.patch
@@ -1,13 +1,13 @@
-# This patch was imported from Debian: https://sources.debian.org/src/xgboost/1.5.1-1/debian/patches/cmake-dmlc-core.patch/
+# This patch was imported from Debian: https://sources.debian.org/patches/xgboost/1.7.4-1/cmake-dmlc-core.patch/
Index: xgboost/CMakeLists.txt
===================================================================
--- xgboost.orig/CMakeLists.txt
+++ xgboost/CMakeLists.txt
-@@ -164,7 +164,9 @@ endif (USE_NCCL)
-
- # dmlc-core
- msvc_use_static_runtime()
+@@ -205,7 +205,9 @@ msvc_use_static_runtime()
+ if (FORCE_SHARED_CRT)
+ set(DMLC_FORCE_SHARED_CRT ON)
+ endif ()
-add_subdirectory(${xgboost_SOURCE_DIR}/dmlc-core)
+add_library(dmlc SHARED IMPORTED)
+find_library(DMLC_LIBRARY dmlc)
@@ -15,7 +15,7 @@ Index: xgboost/CMakeLists.txt
if (MSVC)
if (TARGET dmlc_unit_tests)
-@@ -222,7 +224,7 @@ set_target_properties(runxgboost PROPERT
+@@ -267,7 +269,7 @@ set_target_properties(runxgboost PROPERT
#-- End CLI for xgboost
# Common setup for all targets
@@ -24,7 +24,7 @@ Index: xgboost/CMakeLists.txt
xgboost_target_properties(${target})
xgboost_target_link_libraries(${target})
xgboost_target_defs(${target})
-@@ -273,7 +275,7 @@ install(DIRECTORY ${xgboost_SOURCE_DIR}/
+@@ -318,7 +320,7 @@ install(DIRECTORY ${xgboost_SOURCE_DIR}/
#
# https://github.com/dmlc/xgboost/issues/6085
if (BUILD_STATIC_LIB)
diff --git a/gnu/packages/patches/zathura-use-struct-initializers.patch b/gnu/packages/patches/zathura-use-struct-initializers.patch
new file mode 100644
index 0000000000..9a808a4bc3
--- /dev/null
+++ b/gnu/packages/patches/zathura-use-struct-initializers.patch
@@ -0,0 +1,68 @@
+From c05328185292d6f6a4459024cdb563c63bfad230 Mon Sep 17 00:00:00 2001
+Message-ID: <c05328185292d6f6a4459024cdb563c63bfad230.1710315308.git.vivien@planete-kraus.eu>
+From: Sebastian Ramacher <sebastian@ramacher.at>
+Date: Mon, 29 Jan 2024 21:05:22 +0100
+Subject: [PATCH] Use struct initializers
+
+---
+ zathura/page-widget.c | 4 ++--
+ zathura/shortcuts.c | 12 +++++-------
+ 2 files changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/zathura/page-widget.c b/zathura/page-widget.c
+index 216381e..ac85dcf 100644
+--- a/zathura/page-widget.c
++++ b/zathura/page-widget.c
+@@ -1426,8 +1426,8 @@ cb_menu_image_save(GtkMenuItem* item, ZathuraPage* page)
+ }
+
+ /* set command */
+- char* export_command = g_strdup_printf(":export image-p%d-%d ", page_id, image_id);
+- girara_argument_t argument = { 0, export_command };
++ char* export_command = g_strdup_printf(":export image-p%d-%d ", page_id, image_id);
++ girara_argument_t argument = {.n = 0, .data = export_command};
+ sc_focus_inputbar(priv->zathura->ui.session, &argument, NULL, 0);
+ g_free(export_command);
+
+diff --git a/zathura/shortcuts.c b/zathura/shortcuts.c
+index 8836cd2..35b5990 100644
+--- a/zathura/shortcuts.c
++++ b/zathura/shortcuts.c
+@@ -513,7 +513,7 @@ sc_rotate(girara_session_t* session, girara_argument_t* argument,
+ zathura_document_set_rotation(zathura->document, (rotation + angle * t) % 360);
+
+ /* update scale */
+- girara_argument_t new_argument = { zathura_document_get_adjust_mode(zathura->document), NULL };
++ girara_argument_t new_argument = {.n = zathura_document_get_adjust_mode(zathura->document), .data = NULL};
+ sc_adjust_window(zathura->ui.session, &new_argument, NULL, 0);
+
+ /* render all pages again */
+@@ -1372,7 +1372,7 @@ sc_toggle_presentation(girara_session_t* session, girara_argument_t*
+ zathura->shortcut.toggle_presentation_mode.zoom = zathura_document_get_zoom(zathura->document);
+
+ /* adjust window */
+- girara_argument_t argument = { ZATHURA_ADJUST_BESTFIT, NULL };
++ girara_argument_t argument = {.n = ZATHURA_ADJUST_BESTFIT, .data = NULL};
+ sc_adjust_window(session, &argument, NULL, 0);
+
+ /* hide status and inputbar */
+@@ -1390,13 +1390,11 @@ sc_toggle_presentation(girara_session_t* session, girara_argument_t*
+ return false;
+ }
+
+-bool
+-sc_quit(girara_session_t* session, girara_argument_t* UNUSED(argument),
+- girara_event_t* UNUSED(event), unsigned int UNUSED(t))
+-{
++bool sc_quit(girara_session_t* session, girara_argument_t* UNUSED(argument), girara_event_t* UNUSED(event),
++ unsigned int UNUSED(t)) {
+ g_return_val_if_fail(session != NULL, false);
+
+- girara_argument_t arg = { GIRARA_HIDE, NULL };
++ girara_argument_t arg = {.n = GIRARA_HIDE, .data = NULL};
+ girara_isc_completion(session, &arg, NULL, 0);
+
+ cb_destroy(NULL, NULL);
+--
+2.41.0
+
diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/zuo-bin-sh.patch
index bcdcb8e963..92e3774424 100644
--- a/gnu/packages/patches/racket-zuo-bin-sh.patch
+++ b/gnu/packages/patches/zuo-bin-sh.patch
@@ -1,7 +1,7 @@
-From 73d9b77a11b4516905caf579abb559736f715ea6 Mon Sep 17 00:00:00 2001
+From cd6bed5d22ea9cb7bae2be134d5d04433fc8e313 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Mon, 11 Apr 2022 20:43:18 -0400
-Subject: [PATCH] Zuo: patch zuo_process for "/bin/sh" on Guix
+Subject: [PATCH] patch zuo_process for "/bin/sh" on Guix
If:
@@ -16,17 +16,22 @@ then `zuo_process` will execute the file specified by `_PATH_BSHELL`
instead of "/bin/sh".
Checking that the path specified by `_PATH_BSHELL` exists safeguards
-against obscure errors if attempting to use stand-alone executables
-built by the patched Racket in non-Guix envoronments.
+against obscure errors if attempting to use the patched Zuo
+or derived executables in non-Guix envoronments.
---
- racket/src/zuo/zuo.c | 20 ++++++++++++++++++--
+
+Notes:
+ See also chez-scheme-bin-sh.patch, racket-chez-scheme-bin-sh.patch,
+ racket-rktio-bin-sh.patch.
+
+ zuo.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
-diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c
-index 17f161826d..c4fb3929bb 100644
---- a/racket/src/zuo/zuo.c
-+++ b/racket/src/zuo/zuo.c
-@@ -15,6 +15,7 @@
+diff --git a/zuo.c b/zuo.c
+index d4163eb..bfc5484 100644
+--- a/zuo.c
++++ b/zuo.c
+@@ -16,6 +16,7 @@
#include <string.h>
#include <ctype.h>
#ifdef ZUO_UNIX
@@ -34,7 +39,7 @@ index 17f161826d..c4fb3929bb 100644
# include <fcntl.h>
# include <unistd.h>
# include <errno.h>
-@@ -5730,7 +5731,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w)
+@@ -5949,7 +5950,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w)
zuo_t *zuo_process(zuo_t *command_and_args)
{
const char *who = "process";
@@ -46,7 +51,7 @@ index 17f161826d..c4fb3929bb 100644
zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null;
zuo_t *options = z.o_empty_hash, *opt;
zuo_t *dir, *l, *p_handle, *result;
-@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args)
+@@ -5960,7 +5964,19 @@ zuo_t *zuo_process(zuo_t *command_and_args)
void *env;
int as_child, exact_cmdline;
@@ -68,7 +73,7 @@ index 17f161826d..c4fb3929bb 100644
zuo_t *a = _zuo_car(l);
if (a == z.o_null) {
-base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085
+base-commit: a0faa82c8383d206aa38d21462ca4ae699851a0b
--
-2.32.0
+2.41.0