pkgs/top-level/all-packages.nix, pkgs/applications/editors/emacs-23: prefer makeOverridable over getPkgConfig to customize GNU Emacs

Changed 'emacs23' expression to allow for argument overriding instead of
relying on getPkgConfig. While I was at it, I also simplified the actual build
expression a bit.

svn path=/nixpkgs/trunk/; revision=21873
This commit is contained in:
Peter Simons 2010-05-19 12:26:21 +00:00
parent 5e4bf97212
commit 8d1637de33
2 changed files with 22 additions and 40 deletions

View File

@ -1,22 +1,11 @@
{ xawSupport ? true
, xpmSupport ? true
, dbusSupport ? true
, xaw3dSupport ? false
, gtkGUI ? false
, xftSupport ? false
, stdenv, fetchurl, ncurses, x11, libXaw ? null, libXpm ? null, Xaw3d ? null
, pkgconfig ? null, gtk ? null, libXft ? null, dbus ? null
, libpng, libjpeg, libungif, libtiff, librsvg, texinfo
, gconf ? null
{ stdenv, fetchurl, ncurses, x11, libXaw, libXpm, Xaw3d
, pkgconfig, gtk, libXft, dbus, libpng, libjpeg, libungif
, libtiff, librsvg, texinfo, gconf
}:
assert xawSupport -> libXaw != null;
assert xpmSupport -> libXpm != null;
assert dbusSupport -> dbus != null;
assert xaw3dSupport -> Xaw3d != null;
assert gtkGUI -> pkgconfig != null && gtk != null;
assert xftSupport -> libXft != null && libpng != null; # libpng = probably a bug
assert stdenv.isDarwin -> xawSupport; # fails to link otherwise
assert (gtk != null) -> (pkgconfig != null);
assert (libXft != null) -> libpng != null; # probably a bug
assert stdenv.isDarwin -> libXaw != null; # fails to link otherwise
stdenv.mkDerivation rec {
name = "emacs-23.2";
@ -29,19 +18,12 @@ stdenv.mkDerivation rec {
};
buildInputs = [
ncurses x11 texinfo
(if xawSupport then libXaw else null)
(if xpmSupport then libXpm else null)
(if dbusSupport then dbus else null)
(if xaw3dSupport then Xaw3d else null)
libpng libjpeg libungif libtiff librsvg
]
++ (if gtkGUI then [pkgconfig gtk] else [])
++ (if xftSupport then [libXft] else [])
++ stdenv.lib.optional (gconf != null) gconf;
ncurses x11 texinfo libXaw Xaw3d libXpm dbus libpng libjpeg libungif
libtiff librsvg gtk (if gtk != null then pkgconfig else null) libXft gconf
];
configureFlags =
stdenv.lib.optionals gtkGUI [ "--with-x-toolkit=gtk" "--with-xft" ];
stdenv.lib.optionals (gtk != null) [ "--with-x-toolkit=gtk" "--with-xft" ];
doCheck = true;
@ -68,7 +50,7 @@ stdenv.mkDerivation rec {
homepage = http://www.gnu.org/software/emacs/;
license = "GPLv3+";
maintainers = [ stdenv.lib.maintainers.ludo ];
maintainers = [ stdenv.lib.maintainers.ludo stdenv.lib.maintainers.simons ];
platforms = stdenv.lib.platforms.all;
};
}

View File

@ -7451,17 +7451,17 @@ let
gtkGUI = getPkgConfig "emacs" "gtkSupport" true;
};
emacs23 = import ../applications/editors/emacs-23 {
inherit fetchurl stdenv ncurses pkgconfig x11 Xaw3d
libpng libjpeg libungif libtiff librsvg texinfo dbus;
inherit (xlibs) libXaw libXpm libXft;
inherit (gtkLibs) gtk;
gconf = gnome.GConf; # optional GConf support.
xawSupport = stdenv.isDarwin || getPkgConfig "emacs" "xawSupport" false;
xaw3dSupport = getPkgConfig "emacs" "xaw3dSupport" false;
gtkGUI = getPkgConfig "emacs" "gtkSupport" true;
xftSupport = getPkgConfig "emacs" "xftSupport" true;
dbusSupport = getPkgConfig "emacs" "dbusSupport" true;
emacs23 = makeOverridable (import ../applications/editors/emacs-23) {
inherit fetchurl stdenv ncurses pkgconfig x11 libpng libjpeg
libungif libtiff texinfo dbus;
inherit (xlibs) libXpm libXft;
# use override to select the appropriate gui toolkit
libXaw = if stdenv.isDarwin then xlibs.libXaw else null;
Xaw3d = null;
gtk = if stdenv.isDarwin then gtkLibs.gtk else null;
# TODO: these packages don't build on Darwin.
gconf = if stdenv.isDarwin then null else gnome.GConf;
librsvg = if stdenv.isDarwin then null else librsvg;
};
emacsSnapshot = lowPrio (import ../applications/editors/emacs-snapshot {