Merge pull request #7294 from ttuegel/emacs

emacs: allow choosing gtk2 or gtk3
This commit is contained in:
Thomas Tuegel 2015-04-12 15:12:12 -05:00
commit cebf589462

View File

@ -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";