Beta-version of builderDefs fixes.

svn path=/nixpkgs/trunk/; revision=9657
This commit is contained in:
Michael Raskin 2007-11-12 16:42:13 +00:00
parent 2bd4257a68
commit e18c7cec9d
3 changed files with 54 additions and 27 deletions

View file

@ -17,7 +17,8 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "swh-plugins-0.4.15"; name = "swh-plugins-0.4.15";
builder = writeScript "swh-plugins-0.4.15-builder" builder = writeScript "swh-plugins-0.4.15-builder"
(textClosure [doConfigure doMakeInstall postInstall doForceShare]); (textClosure [doConfigure doMakeInstall
postInstall doForceShare]);
meta = { meta = {
description = " description = "
LADSPA format audio plugins. LADSPA format audio plugins.

View file

@ -244,4 +244,8 @@ rec {
(l + (if l=="" then "" else ".") + s) (builtins.getAttr s attrs))) (l + (if l=="" then "" else ".") + s) (builtins.getAttr s attrs)))
(builtins.attrNames attrs))))); (builtins.attrNames attrs)))));
innerModifySumArgs = f: x: a: b: if b == null then (f a b) // x else
innerModifySumArgs f x (a // b);
modifySumArgs = f: x: innerModifySumArgs f x {};
} }

View file

@ -1,5 +1,5 @@
args: with args; with stringsWithDeps; with lib; args: with args; with stringsWithDeps; with lib;
rec (rec
{ {
inherit writeScript; inherit writeScript;
@ -12,30 +12,29 @@ rec
else if (hasSuffixHack ".zip" s) || (hasSuffixHack ".ZIP" s) then "zip" else if (hasSuffixHack ".zip" s) || (hasSuffixHack ".ZIP" s) then "zip"
else (abort "unknown archive type : ${s}")); else (abort "unknown archive type : ${s}"));
minInit = noDepEntry (" defAddToSearchPath = FullDepEntry ("
set -e addToSearchPathWithCustomDelimiter() {
NIX_GCC=${stdenv.gcc} local delimiter=\$1
export SHELL=${stdenv.shell} local varName=\$2
# Set up the initial path. local needDir=\$3
PATH= local addDir=\${4:-\$needDir}
for i in \$NIX_GCC ${toString stdenv.initialPath}; do local prefix=\$5
PATH=\$PATH\${PATH:+:}\$i/bin if [ -d \$prefix\$needDir ]; then
done if [ -z \${!varName} ]; then
" + (if ((stdenv ? preHook) && (stdenv.preHook != null) && eval export \${varName}=\${prefix}\$addDir
((toString stdenv.preHook) != "")) then else
" eval export \${varName}=\${!varName}\${delimiter}\${prefix}\$addDir
param1=${stdenv.param1} fi
param2=${stdenv.param2} fi
param3=${stdenv.param3} }
param4=${stdenv.param4}
param5=${stdenv.param5}
source ${stdenv.preHook}
export TZ=UTC
prefix=${if args ? prefix then (toString args.prefix) else "\$out"}
addToSearchPath()
{
addToSearchPathWithCustomDelimiter \"\${PATH_DELIMITER}\" \"\$@\"
}
") [defNest];
defNest = noDepEntry ("
nestingLevel=0 nestingLevel=0
startNest() { startNest() {
@ -62,10 +61,33 @@ rec
} }
trap \"closeNest\" EXIT trap \"closeNest\" EXIT
");
minInit = FullDepEntry ("
set -e
NIX_GCC=${stdenv.gcc}
export SHELL=${stdenv.shell}
# Set up the initial path.
PATH=
for i in \$NIX_GCC ${toString stdenv.initialPath}; do
PATH=\$PATH\${PATH:+:}\$i/bin
done
" + (if ((stdenv ? preHook) && (stdenv.preHook != null) &&
((toString stdenv.preHook) != "")) then
"
param1=${stdenv.param1}
param2=${stdenv.param2}
param3=${stdenv.param3}
param4=${stdenv.param4}
param5=${stdenv.param5}
source ${stdenv.preHook}
export TZ=UTC
prefix=${if args ? prefix then (toString args.prefix) else "\$out"}
" "
else "")); else "")) [defNest defAddToSearchPath];
addInputs = FullDepEntry (" addInputs = FullDepEntry ("
# Recursively find all build inputs. # Recursively find all build inputs.
@ -243,8 +265,8 @@ rec
replaceInScript = file: l: (concatStringsSep "\n" ((pairMap (replaceScriptVar file) l))); replaceInScript = file: l: (concatStringsSep "\n" ((pairMap (replaceScriptVar file) l)));
replaceScripts = l:(concatStringsSep "\n" (pairMap replaceInScript l)); replaceScripts = l:(concatStringsSep "\n" (pairMap replaceInScript l));
doReplaceScripts = FullDepEntry (replaceScripts (getAttr ["shellReplacements"] [] args)) [minInit]; doReplaceScripts = FullDepEntry (replaceScripts (getAttr ["shellReplacements"] [] args)) [minInit];
makeNest = x:(if x==minInit.text then x else "startNest\n" + x + "\nstopNest\n"); makeNest = x:(if x==defNest.text then x else "startNest\n" + x + "\nstopNest\n");
textClosure = textClosureMap makeNest; textClosure = textClosureMap makeNest;
inherit noDepEntry FullDepEntry PackEntry; inherit noDepEntry FullDepEntry PackEntry;
} }) // args