summary refs log tree commit diff
path: root/pkgs/development/libraries/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/gtk')
-rw-r--r--pkgs/development/libraries/gtk/2.x.nix2
-rw-r--r--pkgs/development/libraries/gtk/3.x.nix9
-rw-r--r--pkgs/development/libraries/gtk/4.x.nix9
-rw-r--r--pkgs/development/libraries/gtk/patches/2.0-clang.patch49
4 files changed, 67 insertions, 2 deletions
diff --git a/pkgs/development/libraries/gtk/2.x.nix b/pkgs/development/libraries/gtk/2.x.nix
index 539cfc37051..b2afb21b621 100644
--- a/pkgs/development/libraries/gtk/2.x.nix
+++ b/pkgs/development/libraries/gtk/2.x.nix
@@ -66,6 +66,8 @@ stdenv.mkDerivation (finalAttrs: {
   ] ++ lib.optionals stdenv.isDarwin [
     ./patches/2.0-gnome_bugzilla_557780_306776_freeciv_darwin.patch
     ./patches/2.0-darwin-x11.patch
+    # Fixes an incompatible function pointer conversion and implicit int errors with clang 16.
+    ./patches/2.0-clang.patch
   ];
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix
index a527faf5a8b..27afba7833e 100644
--- a/pkgs/development/libraries/gtk/3.x.nix
+++ b/pkgs/development/libraries/gtk/3.x.nix
@@ -23,7 +23,8 @@
 , at-spi2-atk
 , gobject-introspection
 , buildPackages
-, withIntrospection ? stdenv.hostPlatform.emulatorAvailable buildPackages
+, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
+, compileSchemas ? stdenv.hostPlatform.emulatorAvailable buildPackages
 , fribidi
 , xorg
 , libepoxy
@@ -110,7 +111,7 @@ stdenv.mkDerivation (finalAttrs: {
     gtk-doc
     # For xmllint
     libxml2
-  ] ++ lib.optionals (withIntrospection && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
+  ] ++ lib.optionals ((withIntrospection || compileSchemas) && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
     mesonEmulatorHook
   ] ++ lib.optionals waylandSupport [
     wayland-scanner
@@ -183,6 +184,10 @@ stdenv.mkDerivation (finalAttrs: {
     substituteInPlace meson.build \
       --replace "x11_enabled = false" ""
 
+    # this conditional gates the installation of share/gsettings-schemas/.../glib-2.0/schemas/gschemas.compiled.
+    substituteInPlace meson.build \
+      --replace 'if not meson.is_cross_build()' 'if ${lib.boolToString compileSchemas}'
+
     files=(
       build-aux/meson/post-install.py
       demos/gtk-demo/geninclude.py
diff --git a/pkgs/development/libraries/gtk/4.x.nix b/pkgs/development/libraries/gtk/4.x.nix
index b7e8c13ccca..0503ac199f9 100644
--- a/pkgs/development/libraries/gtk/4.x.nix
+++ b/pkgs/development/libraries/gtk/4.x.nix
@@ -1,5 +1,6 @@
 { lib
 , stdenv
+, buildPackages
 , substituteAll
 , fetchurl
 , pkg-config
@@ -7,6 +8,7 @@
 , graphene
 , gi-docgen
 , meson
+, mesonEmulatorHook
 , ninja
 , python3
 , makeWrapper
@@ -45,6 +47,7 @@
 , wayland-scanner
 , xineramaSupport ? stdenv.isLinux
 , cupsSupport ? stdenv.isLinux
+, compileSchemas ? stdenv.hostPlatform.emulatorAvailable buildPackages
 , cups
 , AppKit
 , Cocoa
@@ -99,6 +102,8 @@ stdenv.mkDerivation rec {
     sassc
     gi-docgen
     libxml2 # for xmllint
+  ] ++ lib.optionals (compileSchemas && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
+    mesonEmulatorHook
   ] ++ lib.optionals waylandSupport [
     wayland-scanner
   ] ++ setupHooks;
@@ -190,6 +195,10 @@ stdenv.mkDerivation rec {
   };
 
   postPatch = ''
+    # this conditional gates the installation of share/gsettings-schemas/.../glib-2.0/schemas/gschemas.compiled.
+    substituteInPlace meson.build \
+      --replace 'if not meson.is_cross_build()' 'if ${lib.boolToString compileSchemas}'
+
     files=(
       build-aux/meson/gen-demo-header.py
       demos/gtk-demo/geninclude.py
diff --git a/pkgs/development/libraries/gtk/patches/2.0-clang.patch b/pkgs/development/libraries/gtk/patches/2.0-clang.patch
new file mode 100644
index 00000000000..1e2e73b9833
--- /dev/null
+++ b/pkgs/development/libraries/gtk/patches/2.0-clang.patch
@@ -0,0 +1,49 @@
+diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
+index 4317523fb8..3c09cd3ae8 100644
+--- a/gtk/gtkscale.c
++++ b/gtk/gtkscale.c
+@@ -1471,7 +1471,7 @@ gtk_scale_add_mark (GtkScale        *scale,
+   mark->position = position;
+  
+   priv->marks = g_slist_insert_sorted_with_data (priv->marks, mark,
+-                                                 (GCompareFunc) compare_marks,
++                                                 (GCompareDataFunc) compare_marks,
+                                                  GINT_TO_POINTER (
+                                                    gtk_range_get_inverted (GTK_RANGE (scale)) 
+                                                    ));
+diff --git a/tests/testmenubars.c b/tests/testmenubars.c
+index 416a939861..c65e82be26 100644
+--- a/tests/testmenubars.c
++++ b/tests/testmenubars.c
+@@ -21,7 +21,7 @@
+ #include <gtk/gtk.h>
+ 
+ static GtkWidget *
+-create_menu (depth)
++create_menu (int depth, gboolean _unused)
+ {
+     GtkWidget *menu;
+     GtkWidget *menuitem;
+@@ -35,19 +35,19 @@ create_menu (depth)
+     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+     gtk_widget_show (menuitem);
+     gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem),
+-			       create_menu (depth - 1));
++			       create_menu (depth - 1, _unused));
+ 
+     menuitem = gtk_menu_item_new_with_mnemonic ("Two");
+     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+     gtk_widget_show (menuitem);
+     gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem),
+-			       create_menu (depth - 1));
++			       create_menu (depth - 1, _unused));
+ 
+     menuitem = gtk_menu_item_new_with_mnemonic ("Three");
+     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
+     gtk_widget_show (menuitem);
+     gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem),
+-			       create_menu (depth - 1));
++			       create_menu (depth - 1, _unused));
+ 
+     return menu;
+ }