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 , pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif
, libtiff, librsvg, texinfo, gconf, libxml2, imagemagick, gnutls , libtiff, librsvg, texinfo, gconf, libxml2, imagemagick, gnutls
, alsaLib, cairo , 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 (libXft != null) -> libpng != null; # probably a bug
assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise 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 { stdenv.mkDerivation rec {
name = "emacs-24.5"; name = "emacs-24.5";
@ -28,17 +41,16 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional stdenv.isLinux dbus ++ stdenv.lib.optional stdenv.isLinux dbus
++ stdenv.lib.optionals withX ++ stdenv.lib.optionals withX
[ x11 libXaw Xaw3d libXpm libpng libjpeg libungif libtiff librsvg libXft [ 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; ++ stdenv.lib.optional (stdenv.isDarwin && withX) cairo;
configureFlags = configureFlags =
( if withX && withGTK then if withX
[ "--with-x-toolkit=gtk" "--with-xft"] then [ "--with-x-toolkit=${toolkit}" "--with-xft" ]
else (if withX then else [ "--with-x=no" "--with-xpm=no" "--with-jpeg=no" "--with-png=no"
[ "--with-x-toolkit=lucid" "--with-xft" ] "--with-gif=no" "--with-tiff=no" ];
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) NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.isDarwin && withX)
"-I${cairo}/include/cairo"; "-I${cairo}/include/cairo";