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

View File

@ -172,4 +172,14 @@ rec {
in uniqList {outputList=newOutputList; in uniqList {outputList=newOutputList;
inputList = (tail inputList);}; 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 inherit (xlibs) libX11 libXext libSM libXpm
libXt libXaw libXau; libXt libXaw libXau;
inherit (gtkLibs) glib gtk; inherit (gtkLibs) glib gtk;
hugeFeatures = true; flags = ["hugeFeatures" "gtkGUI" "x11Support"];
gtkGUI = true;
x11Support = true;
}; };
vlc = import ../applications/video/vlc { vlc = import ../applications/video/vlc {

View File

@ -16,18 +16,26 @@ let
(args.lib.concatLists (map (args.lib.concatLists (map
(x:(if (x==[]) then [] else builtins.tail x)) (x:(if (x==[]) then [] else builtins.tail x))
reqsList));}); 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 in
assert args.lib.checkReqs args defList reqsList; assert args.lib.checkReqs args defList reqsList;
with args; with args;
args.stdenv.mkDerivation { args.stdenv.mkDerivation {
name = " name = args.lib.condConcat "
#!!! Fill me // #Fill the name //
" ; " nameSuffixes check;
src = args. src = args.
#Put fetcher here #Put fetcher here
buildInputs = args.lib.filter (x: x!=null) (map getVal buildInputsNames); buildInputs = args.lib.filter (x: x!=null) (map getVal buildInputsNames);
configureFlags = args.lib.condConcat "" configFlags check;
meta = { meta = {
description = " description = "