Added conditional concatenation and used it for name and configureFlags generation.

svn path=/nixpkgs/trunk/; revision=9136
This commit is contained in:
Michael Raskin 2007-08-15 21:17:11 +00:00
parent 75747d3b1c
commit 54a1f25c4c
4 changed files with 33 additions and 16 deletions

View File

@ -12,6 +12,15 @@ let
["true" "ncurses"]
["false" "libSM"]
];
nameSuffixes = [
"hugeFeatures" "-huge"
"x11Support" "-X11"
];
configFlags = [
"true" " --disable-xim "
"x11Support" " --enable-gui=auto "
"hugeFeatures" "--with-features=huge --enable-cscope --enable-multibyte --enable-xsmp"
];
buildInputsNames = args.lib.filter (x: (null!=getVal x))
(args.lib.uniqList {inputList =
(args.lib.concatLists (map
@ -20,12 +29,7 @@ let
in
assert args.lib.checkReqs args defList reqsList;
args.stdenv.mkDerivation {
name = "vim-7.1" +
(if (check "hugeFeatures") then
"-huge" else "")
+ (if (check "x11Support")
then "-X11" else "")
;
name = args.lib.condConcat "vim-7.1" nameSuffixes check;
src = args.fetchurl {
url = ftp://ftp.nluug.nl/pub/editors/vim/unix/vim-7.1.tar.bz2;
@ -38,10 +42,7 @@ args.stdenv.mkDerivation {
postInstall = "ln -s $out/bin/vim $out/bin/vi";
preBuild="touch src/auto/link.sed";
configureFlags=" --enable-gui=auto --disable-xim "+
(if (check "hugeFeatures") then
"--with-features=huge --enable-cscope --enable-multibyte --enable-xsmp "
else "");
configureFlags = args.lib.condConcat "" configFlags check;
meta = {
description = "The most popular clone of the VI editor";

View File

@ -172,4 +172,14 @@ rec {
in uniqList {outputList=newOutputList;
inputList = (tail inputList);};
condConcat = name: list: checker:
if list == [] then name else
if checker (head list) then
condConcat
(name + (head (tail list)))
(tail (tail list))
checker
else condConcat
name (tail (tail list)) checker;
}

View File

@ -3363,9 +3363,7 @@ rec {
inherit (xlibs) libX11 libXext libSM libXpm
libXt libXaw libXau;
inherit (gtkLibs) glib gtk;
hugeFeatures = true;
gtkGUI = true;
x11Support = true;
flags = ["hugeFeatures" "gtkGUI" "x11Support"];
};
vlc = import ../applications/video/vlc {

View File

@ -16,18 +16,26 @@ let
(args.lib.concatLists (map
(x:(if (x==[]) then [] else builtins.tail x))
reqsList));});
configFlags = [
"true" ""
(assert false) - fill it; list consists of pairs "condition" "flags". "True" means always.
];
nameSuffixes = [
(assert false) - fill it if needed, or blank it.
];
in
assert args.lib.checkReqs args defList reqsList;
with args;
args.stdenv.mkDerivation {
name = "
#!!! Fill me //
" ;
name = args.lib.condConcat "
#Fill the name //
" nameSuffixes check;
src = args.
#Put fetcher here
buildInputs = args.lib.filter (x: x!=null) (map getVal buildInputsNames);
configureFlags = args.lib.condConcat "" configFlags check;
meta = {
description = "