summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk3
-rw-r--r--gnu/packages/gnome.scm1
-rw-r--r--gnu/packages/patches/gnome-shell-polkit-autocleanup.patch50
3 files changed, 53 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 2a26a3879b..027cb8e3cb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1211,7 +1211,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/gnome-online-miners-tracker-3.patch	\
   %D%/packages/patches/gnome-screenshot-meson-0.60.patch	\
   %D%/packages/patches/gnome-settings-daemon-gc.patch		\
-  %D%/packages/patches/gnome-session-support-elogind.patch      \
+  %D%/packages/patches/gnome-session-support-elogind.patch	\
+  %D%/packages/patches/gnome-shell-polkit-autocleanup.patch	\
   %D%/packages/patches/gnome-todo-libportal.patch		\
   %D%/packages/patches/gnome-tweaks-search-paths.patch		\
   %D%/packages/patches/gnupg-CVE-2022-34903.patch		\
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index f028eb7611..251d08ae01 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -8701,6 +8701,7 @@ properties, screen resolution, and other GNOME parameters.")
               (uri (string-append "mirror://gnome/sources/" name "/"
                                   (version-major version) "/"
                                   name "-" version ".tar.xz"))
+              (patches (search-patches "gnome-shell-polkit-autocleanup.patch"))
               (sha256
                (base32
                 "0ragmcln210zvzhc2br33yprbkj9drjzd7inp5sdxra0a7l73yaj"))))
diff --git a/gnu/packages/patches/gnome-shell-polkit-autocleanup.patch b/gnu/packages/patches/gnome-shell-polkit-autocleanup.patch
new file mode 100644
index 0000000000..08968b83a1
--- /dev/null
+++ b/gnu/packages/patches/gnome-shell-polkit-autocleanup.patch
@@ -0,0 +1,50 @@
+Don't redefine G_DEFINE_AUTOPTR_CLEANUP_FUNC when available in polkit.
+
+Taken from upstream:
+
+  https://gitlab.gnome.org/GNOME/gnome-shell/-/commit/1d0a08b5e25fea7b0e792ec9798e68a7c5606a75
+
+diff --git a/config.h.meson b/config.h.meson
+index b93fda8727..ff355d3062 100644
+--- a/config.h.meson
++++ b/config.h.meson
+@@ -33,3 +33,6 @@
+ 
+ /* Define if fdwalk is available in libc */
+ #mesondefine HAVE_FDWALK
++
++/* Define if polkit defines autocleanup functions */
++#mesondefine HAVE_POLKIT_AUTOCLEANUP
+diff --git a/meson.build b/meson.build
+index 42ec01c566..778a34c6ef 100644
+--- a/meson.build
++++ b/meson.build
+@@ -169,6 +169,13 @@ cdata.set('HAVE_FDWALK',
+           cc.has_function('fdwalk')
+ )
+ 
++polkit_has_autocleanup = cc.compiles(
++  '#define POLKIT_AGENT_I_KNOW_API_IS_SUBJECT_TO_CHANGE
++  #include <polkitagent/polkitagent.h>
++  void main(void) { g_autoptr(PolkitAgentListener) agent = NULL; }',
++  dependencies: polkit_dep)
++cdata.set('HAVE_POLKIT_AUTOCLEANUP', polkit_has_autocleanup)
++
+ buildtype = get_option('buildtype')
+ if buildtype != 'plain'
+   all_warnings = [
+diff --git a/src/shell-polkit-authentication-agent.h b/src/shell-polkit-authentication-agent.h
+index 55b46af110..4f14749563 100644
+--- a/src/shell-polkit-authentication-agent.h
++++ b/src/shell-polkit-authentication-agent.h
+@@ -14,8 +14,10 @@
+ 
+ G_BEGIN_DECLS
+ 
++#ifndef HAVE_POLKIT_AUTOCLEANUP
+ /* Polkit doesn't have g_autoptr support, thus we have to manually set the autoptr function here */
+ G_DEFINE_AUTOPTR_CLEANUP_FUNC (PolkitAgentListener, g_object_unref)
++#endif
+ 
+ #define SHELL_TYPE_POLKIT_AUTHENTICATION_AGENT (shell_polkit_authentication_agent_get_type())
+