From bbdca635cf0b2e1f7f0b33eebc07686cfcebf975 Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Fri, 23 Dec 2016 22:10:06 +0100 Subject: [PATCH 1/8] cairo: Add CoreText for darwin This helps so that fonts are properly rendered in gtk when used with the backend "quartz". --- pkgs/development/libraries/cairo/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix index 5d201c52312..7df72bc0560 100644 --- a/pkgs/development/libraries/cairo/default.nix +++ b/pkgs/development/libraries/cairo/default.nix @@ -47,6 +47,7 @@ stdenv.mkDerivation rec { libiconv ] ++ libintlOrEmpty ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ CoreGraphics + CoreText ApplicationServices Carbon ]); From 354c91df2e40e2f61719e33b7186fe089d2219e7 Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Fri, 23 Dec 2016 22:14:03 +0100 Subject: [PATCH 2/8] pango: Add darwin frameworks for fond rendering --- pkgs/development/libraries/pango/default.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix index f39fc2afe7d..22cf7be84d0 100644 --- a/pkgs/development/libraries/pango/default.nix +++ b/pkgs/development/libraries/pango/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, pkgconfig, libXft, cairo, harfbuzz -, libintlOrEmpty, gobjectIntrospection +, libintlOrEmpty, gobjectIntrospection, darwin }: with stdenv.lib; @@ -19,7 +19,12 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "out" "devdoc" ]; buildInputs = [ gobjectIntrospection ]; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkgconfig ] + ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + Carbon + CoreGraphics + CoreText + ]); propagatedBuildInputs = [ cairo harfbuzz libXft ] ++ libintlOrEmpty; enableParallelBuilding = true; @@ -48,6 +53,6 @@ stdenv.mkDerivation rec { license = licenses.lgpl2Plus; maintainers = with maintainers; [ raskin urkud ]; - platforms = with platforms; linux ++ darwin; + platforms = platforms.linux ++ platforms.darwin; }; } From 9f31633a5006c511c97df77dcc025138b4c38e48 Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Fri, 23 Dec 2016 22:16:02 +0100 Subject: [PATCH 3/8] librsvg: Add framework ApplicationServices for darwin --- pkgs/development/libraries/librsvg/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index 409307fb52b..ebd0f79cd47 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, pkgconfig, glib, gdk_pixbuf, pango, cairo, libxml2, libgsf -, bzip2, libcroco, libintlOrEmpty +, bzip2, libcroco, libintlOrEmpty, darwin , withGTK ? false, gtk3 ? null , gobjectIntrospection ? null, enableIntrospection ? false }: @@ -22,7 +22,10 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ glib gdk_pixbuf cairo ] ++ lib.optional withGTK gtk3; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkgconfig ] + ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + ApplicationServices + ]); configureFlags = [ "--enable-introspection=auto" ] ++ stdenv.lib.optional stdenv.isDarwin "--disable-Bsymbolic"; From 5a572f80185b2ad2a06ca42ed61bbe08cd14198b Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Fri, 23 Dec 2016 22:18:25 +0100 Subject: [PATCH 4/8] gtk2: Use quartz backend on darwin --- pkgs/development/libraries/gtk+/2.x.nix | 17 ++++++++++++----- pkgs/top-level/all-packages.nix | 2 ++ 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 { }; From 8f7adffe4deefafc40f170194718e7837bf9208a Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Fri, 23 Dec 2016 22:20:30 +0100 Subject: [PATCH 5/8] pygtk: Add flag -ObjC for darwin Had to add this so that it was able to parse the headers from the frameworks. --- pkgs/development/python-modules/pygtk/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/pygtk/default.nix b/pkgs/development/python-modules/pygtk/default.nix index 7d0896c1fb8..0940ef00ac9 100644 --- a/pkgs/development/python-modules/pygtk/default.nix +++ b/pkgs/development/python-modules/pygtk/default.nix @@ -3,7 +3,7 @@ buildPythonPackage rec { name = "pygtk-2.24.0"; - + disabled = isPy3k; src = fetchurl { @@ -20,6 +20,8 @@ buildPythonPackage rec { buildPhase = "buildPhase"; + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-ObjC"; + installPhase = "installPhase"; checkPhase = stdenv.lib.optionalString (libglade == null) From 0f67005c4a2651ab0d9a48468a4873cff3551b8b Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Sat, 24 Dec 2016 01:11:19 +0100 Subject: [PATCH 6/8] cairo: Add ApplicationServices as propagatedBuildInput Noticed that it caused depending packages to fail, like librsvg, imagemagiv, graphviz. --- pkgs/development/libraries/cairo/default.nix | 4 +++- pkgs/development/libraries/librsvg/default.nix | 7 ++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix index 7df72bc0560..5b40f27674d 100644 --- a/pkgs/development/libraries/cairo/default.nix +++ b/pkgs/development/libraries/cairo/default.nix @@ -48,7 +48,6 @@ stdenv.mkDerivation rec { ] ++ libintlOrEmpty ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ CoreGraphics CoreText - ApplicationServices Carbon ]); @@ -57,6 +56,9 @@ stdenv.mkDerivation rec { ++ optionals xcbSupport [ libxcb xcbutil ] ++ optional gobjectSupport glib ++ optional glSupport mesa_noglu + ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + ApplicationServices + ]) ; # TODO: maybe liblzo but what would it be for here? configureFlags = if stdenv.isDarwin then [ diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index ebd0f79cd47..409307fb52b 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, pkgconfig, glib, gdk_pixbuf, pango, cairo, libxml2, libgsf -, bzip2, libcroco, libintlOrEmpty, darwin +, bzip2, libcroco, libintlOrEmpty , withGTK ? false, gtk3 ? null , gobjectIntrospection ? null, enableIntrospection ? false }: @@ -22,10 +22,7 @@ stdenv.mkDerivation rec { propagatedBuildInputs = [ glib gdk_pixbuf cairo ] ++ lib.optional withGTK gtk3; - nativeBuildInputs = [ pkgconfig ] - ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ - ApplicationServices - ]); + nativeBuildInputs = [ pkgconfig ]; configureFlags = [ "--enable-introspection=auto" ] ++ stdenv.lib.optional stdenv.isDarwin "--disable-Bsymbolic"; From ea053cad7a3c54a8fcb29d697c5c07f1f31c0937 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 22 Nov 2016 23:09:17 -0600 Subject: [PATCH 7/8] gtk-mac-integration: init at 2.0.8 --- .../libraries/gtk-mac-integration/default.nix | 30 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/development/libraries/gtk-mac-integration/default.nix diff --git a/pkgs/development/libraries/gtk-mac-integration/default.nix b/pkgs/development/libraries/gtk-mac-integration/default.nix new file mode 100644 index 00000000000..30ac8f2fe28 --- /dev/null +++ b/pkgs/development/libraries/gtk-mac-integration/default.nix @@ -0,0 +1,30 @@ +{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig, glib, gtk_doc, gtk }: + +stdenv.mkDerivation rec { + name = "gtk-mac-integration-2.0.8"; + + src = fetchFromGitHub { + owner = "GNOME"; + repo = "gtk-mac-integration"; + rev = "79e708870cdeea24ecdb036c77b4630104ae1776"; + sha256 = "1fbhnvj0rqc3089ypvgnpkp6ad2rr37v5qk38008dgamb9h7f3qs"; + }; + + nativeBuildInputs = [ autoreconfHook pkgconfig gtk_doc ]; + buildInputs = [ glib gtk ]; + + preAutoreconf = '' + gtkdocize + ''; + + meta = with lib; { + description = "Provides integration for Gtk+ applications into the Mac desktop"; + + license = licenses.lgpl21; + + homepage = https://wiki.gnome.org/Projects/GTK+/OSX/Integration; + + maintainers = [ maintainers.matthewbauer ]; + platforms = platforms.darwin; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ba5358f1906..0d79a295854 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7515,6 +7515,10 @@ in gtk-sharp-beans = callPackage ../development/libraries/gtk-sharp-beans { }; + gtk-mac-integration = callPackage ../development/libraries/gtk-mac-integration { + gtk = gtk2; + }; + gtkspell2 = callPackage ../development/libraries/gtkspell { }; gtkspell3 = callPackage ../development/libraries/gtkspell/3.nix { }; From f025d2c1898a5697ca109d51412850375883db44 Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Sun, 25 Dec 2016 00:56:49 +0100 Subject: [PATCH 8/8] gtksourceview: Add gtk-mac-integration for darwin Had to pick two commits as patches from the repository which update the dependency ige-mac-integration to gtk-mac-integration. --- .../gnome-2/desktop/gtksourceview/default.nix | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/pkgs/desktops/gnome-2/desktop/gtksourceview/default.nix b/pkgs/desktops/gnome-2/desktop/gtksourceview/default.nix index c69ee82fa26..7c9cd42a0e9 100644 --- a/pkgs/desktops/gnome-2/desktop/gtksourceview/default.nix +++ b/pkgs/desktops/gnome-2/desktop/gtksourceview/default.nix @@ -1,5 +1,8 @@ -{stdenv, fetchurl, pkgconfig, atk, cairo, glib, gtk, pango, - libxml2Python, perl, intltool, gettext}: +{stdenv, fetchpatch, fetchurl, autoreconfHook, pkgconfig, atk, cairo, glib +, gnome_common, gtk, pango +, libxml2Python, perl, intltool, gettext, gtk-mac-integration }: + +with stdenv.lib; stdenv.mkDerivation rec { name = "gtksourceview-${version}"; @@ -9,6 +12,29 @@ stdenv.mkDerivation rec { url = "mirror://gnome/sources/gtksourceview/2.10/${name}.tar.bz2"; sha256 = "c585773743b1df8a04b1be7f7d90eecdf22681490d6810be54c81a7ae152191e"; }; - buildInputs = [pkgconfig atk cairo glib gtk pango libxml2Python perl intltool - gettext]; + + patches = optionals stdenv.isDarwin [ + (fetchpatch { + name = "change-igemacintegration-to-gtkosxapplication.patch"; + url = "https://git.gnome.org/browse/gtksourceview/patch/?id=e88357c5f210a8796104505c090fb6a04c213902"; + sha256 = "0h5q79q9dqbg46zcyay71xn1pm4aji925gjd5j93v4wqn41wj5m7"; + }) + (fetchpatch { + name = "update-to-gtk-mac-integration-2.0-api.patch"; + url = "https://git.gnome.org/browse/gtksourceview/patch/?id=ab46e552e1d0dae73f72adac8d578e40bdadaf95"; + sha256 = "0qzrbv4hpa0v8qbmpi2vp575n13lkrvp3cgllwrd2pslw1v9q3aj"; + }) + ]; + + buildInputs = [ + pkgconfig atk cairo glib gtk + pango libxml2Python perl intltool + gettext + ] ++ optionals stdenv.isDarwin [ + autoreconfHook gnome_common gtk-mac-integration + ]; + + preConfigure = optionalString stdenv.isDarwin '' + intltoolize --force + ''; }