Added XScreensaver; also changed version-stub.nix (now it does sumArgs itself, and requires builderDefs to be used) and added a merge of composing-builder and declarative flag processing.

svn path=/nixpkgs/trunk/; revision=9776
This commit is contained in:
Michael Raskin 2007-11-22 20:26:00 +00:00
parent ebfbf03a25
commit 2b5369552c
7 changed files with 119 additions and 3 deletions

View file

@ -0,0 +1,38 @@
args : with args; with builderDefs (args // {
src = /* put a fetchurl here */
fetchurl {
url = http://www.jwz.org/xscreensaver/xscreensaver-5.04.tar.gz;
sha256 = "1mx6zc6rvb6pr9wb6mv4ljiii9ybw0dshd74aclf7rlmfx4hn86i";
};
useConfig = true;
reqsList = [
["true" "libX11" "gtk" "pkgconfig" "bc" "perl" "intltool" "libXmu"]
["GL" "mesa"]
["GUI" "gtk" "libxml2" "libglade"]
["jpeg" "libjpeg"]
["false"]
];
configFlags = [
"GL" " --with-gl "
"gdkpixbuf" " --with-pixbuf "
"DPMS" " --with-dpms "
"true" (" --with-x-app-defaults=\$out/share/xscreensaver/app-defaults "+
" --with-hackdir=\$out/share/xscreensaver-hacks ")
];
}) null; /* null is a terminator for sumArgs */
let
preConfigure = FullDepEntry ("
sed -e 's%@GTK_DATADIR@%@datadir@% ; s%@PO_DATADIR@%@datadir@%' "+
"-i driver/Makefile.in po/Makefile.in.in;
") [minInit doUnpack];
in
stdenv.mkDerivation rec {
name = "xscreensaver-"+version;
builder = writeScript (name + "-builder")
(textClosure [preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
meta = {
description = "
The X screensaver daemon. Run xscreensaver-demo to configure.
";
};
}

View file

@ -0,0 +1,9 @@
let
realPath=y: (__toPath ((toString ./JustNothing/.. )+"/"+y.version+".nix"));
dispatch=(x: ((import (realPath x)) x));
in
args :
with args;
with builderDefs {src="";} null;
let eater=(lib.sumArgs dispatch args); in
eater

View file

@ -248,4 +248,7 @@ rec {
innerModifySumArgs f x (a // b);
modifySumArgs = f: x: innerModifySumArgs f x {};
debugVal = if builtins ? trace then x: (builtins.trace x x) else x: x;
debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x;
}

View file

@ -4326,6 +4326,19 @@ rec {
base14Fonts = "${ghostscript}/share/ghostscript/fonts";
};
xscreensaverFun = import ../applications/graphics/xscreensaver {
inherit stdenv fetchurl builderDefs lib pkgconfig bc perl intltool;
inherit (xlibs) libX11 libXmu;
};
xscreensaver = xscreensaverFun {
version = "5.04";
flags = ["GL" "gdkpixbuf" "DPMS" "gui" "jpeg"];
inherit mesa libxml2 libjpeg;
inherit (gtkLibs) gtk;
inherit (gnome) libglade;
} null;
xterm = import ../applications/misc/xterm {
inherit fetchurl stdenv ncurses;
inherit (xlibs) libXaw xproto libXt libX11 libSM libICE;

View file

@ -186,7 +186,7 @@ args: with args; with stringsWithDeps; with lib;
) [minInit];
doConfigure = FullDepEntry ("
./configure --prefix=\"\$prefix\" ${toString (getAttr ["configureFlags"] "" args)}
./configure --prefix=\"\$prefix\" ${toString configureFlags}
") [minInit addInputs doUnpack];
doAutotools = FullDepEntry ("
@ -200,7 +200,7 @@ args: with args; with stringsWithDeps; with lib;
")[minInit addInputs doUnpack];
doMake = FullDepEntry ("
make ${toString (getAttr ["makeFlags"] "" args)}
make ${toString makeFlags}
") [minInit addInputs doUnpack];
doUnpack = toSrcDir (toString src);
@ -269,4 +269,28 @@ args: with args; with stringsWithDeps; with lib;
textClosure = textClosureMap makeNest;
inherit noDepEntry FullDepEntry PackEntry;
defList = (getAttr ["defList"] [] args);
getVal = getValue args defList;
check = checkFlag args;
reqsList = getAttr ["reqsList"] [] args;
buildInputsNames = filter (x: (null != getVal x))
(uniqList {inputList =
(concatLists (map
(x:(if (x==[]) then [] else builtins.tail x))
reqsList));});
configFlags = getAttr ["configFlags"] [] args;
buildFlags = getAttr ["buildFlags"] [] args;
nameSuffixes = getAttr ["nameSuffixes"] [] args;
autoBuildInputs = assert (checkReqs args defList reqsList);
filter (x: x!=null) (map getVal buildInputsNames);
autoConfigureFlags = condConcat "" configFlags check;
autoMakeFlags = condConcat "" buildFlags check;
useConfig = getAttr ["useConfig"] false args;
buildInputs = if useConfig then autoBuildInputs else getAttr ["buildInputs"] [] args;
configureFlags = if useConfig then autoConfigureFlags else
getAttr ["configureFlags"] "" args;
makeFlags = if useConfig then autoMakeFlags else getAttr ["makeFlags"] "" args;
inherit lib;
}) // args

View file

@ -0,0 +1,22 @@
args : with args; with builderDefs (args // {
src = /* put a fetchurl here */
(abort "Specify source");
useConfig = true;
reqsList = [
["true" ]
["false"]
];
/* List consisiting of an even number of strings; "key" "value" */
configFlags = [
];
}) null; /* null is a terminator for sumArgs */
stdenv.mkDerivation rec {
name = "${(abort "Specify name")}"+version;
builder = writeScript (name + "-builder")
(textClosure [(abort "Check phases") doMakeInstall doForceShare doPropagate]);
meta = {
description = "
${(abort "Specify description")}
";
};
}

View file

@ -1,2 +1,9 @@
let
realPath=y: (__toPath ((toString ./JustNothing/.. )+"/"+y.version+".nix"));
dispatch=(x: ((import (realPath x)) x));
in
args :
(import (__toPath ((toString ./JustNothing/.. )+"/"+args.version+".nix"))) args
with args;
with builderDefs {src="";} null;
let eater=(lib.sumArgs dispatch args); in
eater