gtk2: Use quartz backend on darwin

This commit is contained in:
Johannes Bornhold 2016-12-23 22:18:25 +01:00
parent 9f31633a50
commit 5a572f8018
2 changed files with 14 additions and 5 deletions

View File

@ -2,11 +2,15 @@
, gdk_pixbuf, libintlOrEmpty, xlibsWrapper , gdk_pixbuf, libintlOrEmpty, xlibsWrapper
, xineramaSupport ? stdenv.isLinux , xineramaSupport ? stdenv.isLinux
, cupsSupport ? true, cups ? null , cupsSupport ? true, cups ? null
, gdktarget ? "x11"
, AppKit, Cocoa
}: }:
assert xineramaSupport -> xorg.libXinerama != null; assert xineramaSupport -> xorg.libXinerama != null;
assert cupsSupport -> cups != null; assert cupsSupport -> cups != null;
with stdenv.lib;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "gtk+-2.24.31"; name = "gtk+-2.24.31";
@ -20,7 +24,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (libintlOrEmpty != []) "-lintl"; NIX_CFLAGS_COMPILE = optionalString (libintlOrEmpty != []) "-lintl";
setupHook = ./setup-hook.sh; setupHook = ./setup-hook.sh;
@ -28,7 +32,7 @@ stdenv.mkDerivation rec {
patches = [ ./2.0-immodules.cache.patch ]; patches = [ ./2.0-immodules.cache.patch ];
propagatedBuildInputs = with xorg; with stdenv.lib; propagatedBuildInputs = with xorg;
[ glib cairo pango gdk_pixbuf atk ] [ glib cairo pango gdk_pixbuf atk ]
++ optionals (stdenv.isLinux || stdenv.isDarwin) [ ++ optionals (stdenv.isLinux || stdenv.isDarwin) [
libXrandr libXrender libXcomposite libXi libXcursor libXrandr libXrender libXcomposite libXi libXcursor
@ -36,11 +40,13 @@ stdenv.mkDerivation rec {
++ optionals stdenv.isDarwin [ xlibsWrapper libXdamage ] ++ optionals stdenv.isDarwin [ xlibsWrapper libXdamage ]
++ libintlOrEmpty ++ libintlOrEmpty
++ optional xineramaSupport libXinerama ++ optional xineramaSupport libXinerama
++ optionals cupsSupport [ cups ]; ++ optionals cupsSupport [ cups ]
++ optionals (gdktarget == "quartz") [ AppKit Cocoa ];
configureFlags = [ configureFlags = [
"--with-gdktarget=${gdktarget}"
"--with-xinput=yes" "--with-xinput=yes"
] ++ stdenv.lib.optionals stdenv.isDarwin [ ] ++ optionals stdenv.isDarwin [
"--disable-glibtest" "--disable-glibtest"
"--disable-introspection" "--disable-introspection"
"--disable-visibility" "--disable-visibility"
@ -57,9 +63,10 @@ stdenv.mkDerivation rec {
rm $out/lib/gtk-2.0/2.10.0/immodules.cache 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 $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 */ ''; ''; # 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"; description = "A multi-platform toolkit for creating graphical user interfaces";
homepage = http://www.gtk.org/; homepage = http://www.gtk.org/;
license = licenses.lgpl2Plus; license = licenses.lgpl2Plus;

View File

@ -7488,6 +7488,8 @@ in
gtk2 = callPackage ../development/libraries/gtk+/2.x.nix { gtk2 = callPackage ../development/libraries/gtk+/2.x.nix {
cupsSupport = config.gtk2.cups or stdenv.isLinux; 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 { }; gtk3 = callPackage ../development/libraries/gtk+/3.x.nix { };