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

View File

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