summary refs log tree commit diff
path: root/pkgs/applications/editors/emacs-24
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2015-04-12 15:12:12 -0500
committerThomas Tuegel <ttuegel@gmail.com>2015-04-12 15:12:12 -0500
commitcebf5894625d41eb7332ee69fdd798f407093ba5 (patch)
tree8f82f25b4f5cef7a57917f9b50064839db3f38a1 /pkgs/applications/editors/emacs-24
parenta4e63baf3502137740edf165239f676a9c832d06 (diff)
parentbc4f39f48b1fe56e807edd7b77bd41e955b9f651 (diff)
downloadnixlib-cebf5894625d41eb7332ee69fdd798f407093ba5.tar
nixlib-cebf5894625d41eb7332ee69fdd798f407093ba5.tar.gz
nixlib-cebf5894625d41eb7332ee69fdd798f407093ba5.tar.bz2
nixlib-cebf5894625d41eb7332ee69fdd798f407093ba5.tar.lz
nixlib-cebf5894625d41eb7332ee69fdd798f407093ba5.tar.xz
nixlib-cebf5894625d41eb7332ee69fdd798f407093ba5.tar.zst
nixlib-cebf5894625d41eb7332ee69fdd798f407093ba5.zip
Merge pull request #7294 from ttuegel/emacs
emacs: allow choosing gtk2 or gtk3
Diffstat (limited to 'pkgs/applications/editors/emacs-24')
-rw-r--r--pkgs/applications/editors/emacs-24/default.nix30
1 files changed, 21 insertions, 9 deletions
diff --git a/pkgs/applications/editors/emacs-24/default.nix b/pkgs/applications/editors/emacs-24/default.nix
index d5c5e066e740..80fed602474e 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.5";
@@ -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";