From bc4f39f48b1fe56e807edd7b77bd41e955b9f651 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 9 Apr 2015 10:56:18 -0500 Subject: emacs: allow choosing gtk2 or gtk3 --- pkgs/applications/editors/emacs-24/default.nix | 30 ++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'pkgs/applications/editors/emacs-24') diff --git a/pkgs/applications/editors/emacs-24/default.nix b/pkgs/applications/editors/emacs-24/default.nix index 83774206b5c7..f5379780c5d5 100644 --- a/pkgs/applications/editors/emacs-24/default.nix +++ b/pkgs/applications/editors/emacs-24/default.nix @@ -2,11 +2,24 @@ , pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif , libtiff, librsvg, texinfo, gconf, libxml2, imagemagick, gnutls , alsaLib, cairo -, withX ? !stdenv.isDarwin, withGTK ? true +, withX ? !stdenv.isDarwin +, withGTK3 ? false, gtk3 ? null +, withGTK2 ? true, gtk2 }: assert (libXft != null) -> libpng != null; # probably a bug assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise +assert withGTK2 -> withX; +assert withGTK3 -> withX; +assert withGTK2 -> !withGTK3 && gtk2 != null; +assert withGTK3 -> !withGTK2 && gtk3 != null; + +let + toolkit = + if withGTK3 then "gtk3" + else if withGTK2 then "gtk2" + else "lucid"; +in stdenv.mkDerivation rec { name = "emacs-24.4"; @@ -28,17 +41,16 @@ stdenv.mkDerivation rec { ++ stdenv.lib.optional stdenv.isLinux dbus ++ stdenv.lib.optionals withX [ x11 libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft - imagemagick gtk gconf ] + imagemagick gconf ] + ++ stdenv.lib.optional (withX && withGTK2) [ gtk2 ] + ++ stdenv.lib.optional (withX && withGTK3) [ gtk3 ] ++ stdenv.lib.optional (stdenv.isDarwin && withX) cairo; configureFlags = - ( if withX && withGTK then - [ "--with-x-toolkit=gtk" "--with-xft"] - else (if withX then - [ "--with-x-toolkit=lucid" "--with-xft" ] - else - [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no" - "--with-gif=no" "--with-tiff=no" ] ) ); + if withX + then [ "--with-x-toolkit=${toolkit}" "--with-xft" ] + else [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no" + "--with-gif=no" "--with-tiff=no" ]; NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.isDarwin && withX) "-I${cairo}/include/cairo"; -- cgit 1.4.1