From 96fb05e4e28958e762174d84ad25df502c424029 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Sun, 9 Apr 2023 17:17:27 +0800 Subject: [PATCH] gtk4: Fix darwin build --- pkgs/development/libraries/gtk/4.x.nix | 5 +++ .../gtk/patches/4.0-fix-darwin-build.patch | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/development/libraries/gtk/patches/4.0-fix-darwin-build.patch diff --git a/pkgs/development/libraries/gtk/4.x.nix b/pkgs/development/libraries/gtk/4.x.nix index 9283ec59a30d..d90abc0068dd 100644 --- a/pkgs/development/libraries/gtk/4.x.nix +++ b/pkgs/development/libraries/gtk/4.x.nix @@ -78,6 +78,11 @@ stdenv.mkDerivation rec { sha256 = "6PysBLx3FbnaZnyRGl7o8mLiANHWpQrfI2RcqM/NAxE="; }; + patches = [ + # https://github.com/NixOS/nixpkgs/pull/218143#issuecomment-1501059486 + ./patches/4.0-fix-darwin-build.patch + ]; + depsBuildBuild = [ pkg-config ]; diff --git a/pkgs/development/libraries/gtk/patches/4.0-fix-darwin-build.patch b/pkgs/development/libraries/gtk/patches/4.0-fix-darwin-build.patch new file mode 100644 index 000000000000..01f4377aa0a7 --- /dev/null +++ b/pkgs/development/libraries/gtk/patches/4.0-fix-darwin-build.patch @@ -0,0 +1,31 @@ +diff --git a/gdk/macos/gdkmacospasteboard-private.h b/gdk/macos/gdkmacospasteboard-private.h +index fdeb936..c4b8666 100644 +--- a/gdk/macos/gdkmacospasteboard-private.h ++++ b/gdk/macos/gdkmacospasteboard-private.h +@@ -27,6 +27,10 @@ + + G_BEGIN_DECLS + ++#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER ++typedef NSString *NSPasteboardType; ++#endif ++ + @interface GdkMacosPasteboardItemDataProvider : NSObject + { + GdkContentProvider *_contentProvider; +diff --git a/gdk/macos/gdkmacospasteboard.c b/gdk/macos/gdkmacospasteboard.c +index 66b3c9f..b9e0d8a 100644 +--- a/gdk/macos/gdkmacospasteboard.c ++++ b/gdk/macos/gdkmacospasteboard.c +@@ -400,7 +400,11 @@ _gdk_macos_pasteboard_register_drag_types (NSWindow *window) + gdk_content_formats_get_gtypes (formats, &n_gtypes); + + if (n_gtypes) ++#ifdef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER + [ret addObject:NSPasteboardTypeURL]; ++#else ++ [ret addObject:[[NSString alloc] initWithUTF8String:"public.url"]]; ++#endif + + gdk_content_formats_unref (formats); + }