summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJohannes Bornhold <johannes@bornhold.name>2016-12-23 22:18:25 +0100
committerJohannes Bornhold <johannes@bornhold.name>2017-01-07 17:35:09 +0100
commit5a572f80185b2ad2a06ca42ed61bbe08cd14198b (patch)
tree0501f5782c18a97422ca518ef9e9fe545cdf90ab /pkgs
parent9f31633a5006c511c97df77dcc025138b4c38e48 (diff)
downloadnixpkgs-5a572f80185b2ad2a06ca42ed61bbe08cd14198b.tar
nixpkgs-5a572f80185b2ad2a06ca42ed61bbe08cd14198b.tar.gz
nixpkgs-5a572f80185b2ad2a06ca42ed61bbe08cd14198b.tar.bz2
nixpkgs-5a572f80185b2ad2a06ca42ed61bbe08cd14198b.tar.lz
nixpkgs-5a572f80185b2ad2a06ca42ed61bbe08cd14198b.tar.xz
nixpkgs-5a572f80185b2ad2a06ca42ed61bbe08cd14198b.tar.zst
nixpkgs-5a572f80185b2ad2a06ca42ed61bbe08cd14198b.zip
gtk2: Use quartz backend on darwin
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/gtk+/2.x.nix17
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 14 insertions, 5 deletions
diff --git a/pkgs/development/libraries/gtk+/2.x.nix b/pkgs/development/libraries/gtk+/2.x.nix
index ba12b4eea93..bcbbecd242d 100644
--- a/pkgs/development/libraries/gtk+/2.x.nix
+++ b/pkgs/development/libraries/gtk+/2.x.nix
@@ -2,11 +2,15 @@
 , gdk_pixbuf, libintlOrEmpty, xlibsWrapper
 , xineramaSupport ? stdenv.isLinux
 , cupsSupport ? true, cups ? null
+, gdktarget ? "x11"
+, AppKit, Cocoa
 }:
 
 assert xineramaSupport -> xorg.libXinerama != null;
 assert cupsSupport -> cups != null;
 
+with stdenv.lib;
+
 stdenv.mkDerivation rec {
   name = "gtk+-2.24.31";
 
@@ -20,7 +24,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (libintlOrEmpty != []) "-lintl";
+  NIX_CFLAGS_COMPILE = optionalString (libintlOrEmpty != []) "-lintl";
 
   setupHook = ./setup-hook.sh;
 
@@ -28,7 +32,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./2.0-immodules.cache.patch ];
 
-  propagatedBuildInputs = with xorg; with stdenv.lib;
+  propagatedBuildInputs = with xorg;
     [ glib cairo pango gdk_pixbuf atk ]
     ++ optionals (stdenv.isLinux || stdenv.isDarwin) [
          libXrandr libXrender libXcomposite libXi libXcursor
@@ -36,11 +40,13 @@ stdenv.mkDerivation rec {
     ++ optionals stdenv.isDarwin [ xlibsWrapper libXdamage ]
     ++ libintlOrEmpty
     ++ optional xineramaSupport libXinerama
-    ++ optionals cupsSupport [ cups ];
+    ++ optionals cupsSupport [ cups ]
+    ++ optionals (gdktarget == "quartz") [ AppKit Cocoa ];
 
   configureFlags = [
+    "--with-gdktarget=${gdktarget}"
     "--with-xinput=yes"
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+  ] ++ optionals stdenv.isDarwin [
     "--disable-glibtest"
     "--disable-introspection"
     "--disable-visibility"
@@ -57,9 +63,10 @@ stdenv.mkDerivation rec {
       rm $out/lib/gtk-2.0/2.10.0/immodules.cache
       $out/bin/gtk-query-immodules-2.0 $out/lib/gtk-2.0/2.10.0/immodules/*.so > $out/lib/gtk-2.0/2.10.0/immodules.cache
     ''; # workaround for bug of nix-mode for Emacs */ '';
+    inherit gdktarget;
   };
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "A multi-platform toolkit for creating graphical user interfaces";
     homepage    = http://www.gtk.org/;
     license     = licenses.lgpl2Plus;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 4d538e21d24..ba5358f1906 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7488,6 +7488,8 @@ in
 
   gtk2 = callPackage ../development/libraries/gtk+/2.x.nix {
     cupsSupport = config.gtk2.cups or stdenv.isLinux;
+    gdktarget = if stdenv.isDarwin then "quartz" else "x11";
+    inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
   };
 
   gtk3 = callPackage ../development/libraries/gtk+/3.x.nix { };