From dffda95fdd383a01da15d2545fb1006b4a293e39 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Tue, 22 Jan 2008 15:13:35 +0000 Subject: [PATCH] reverted (10214) and merged my changes again because I had changed a lot of line by accident svn path=/nixpkgs/trunk/; revision=10246 --- pkgs/top-level/builder-defs.nix | 80 ++++++++------------------------- 1 file changed, 19 insertions(+), 61 deletions(-) diff --git a/pkgs/top-level/builder-defs.nix b/pkgs/top-level/builder-defs.nix index 9e35a36b2ef5..e70191f091cd 100644 --- a/pkgs/top-level/builder-defs.nix +++ b/pkgs/top-level/builder-defs.nix @@ -1,39 +1,3 @@ -# see dep-strings.nix as well -/* -questions: - - add some comments? - - why is prefix used in doConfigure ? shouldn't that be out? - - don't think toSrcDir should cd to the directory. - I'd prefer cd `toSrcDir xx.tar.gz` - Then you can use it to unpack files - - suggestion: - deps before text? why? - It's kind of documentation and much less lines most of the time ? - - remove noDepEntry, FullDepEntry, PackEntry all together and use { ... } ? - you only have to remember two words: text and deps which isn't hard - using noDepEntry FullDepEntry PackEntry you'll have to remember 3 words and argument order - You just have to learn it once.. ? - - no way to override steps ? - - separate settings from dep entries - (eg patchFlags / forceShare, patches) to get a better overview ? ) - - envAdderInner: What about a small example? It took quite some time to understand how to use it - eg envAdderInner "" "A" "B" "C" "D" null results in - echo export A="$A:B"; - echo export C="$C:D"; - does'nt handle the env has been empty don't add delimiter case - - -*/ - - args: with args; with stringsWithDeps; with lib; (rec { @@ -54,7 +18,6 @@ args: with args; with stringsWithDeps; with lib; # Last block - for single files!! It should be always after .tar.* else if (hasSuffixHack ".bz2" s) then "plain-bz2" - else if (hasSuffixHack ".zip" s) || (hasSuffixHack ".ZIP" s) then "zip" else (abort "unknown archive type : ${s}")); defAddToSearchPath = FullDepEntry (" @@ -77,7 +40,7 @@ args: with args; with stringsWithDeps; with lib; { addToSearchPathWithCustomDelimiter \"\${PATH_DELIMITER}\" \"\$@\" } - ") [defNest]; + ") ["defNest"]; defNest = noDepEntry (" nestingLevel=0 @@ -132,7 +95,7 @@ args: with args; with stringsWithDeps; with lib; prefix=${if args ? prefix then (toString args.prefix) else "\$out"} " - else "")) [defNest defAddToSearchPath]; + else "")) ["defNest" "defAddToSearchPath"]; addInputs = FullDepEntry (" # Recursively find all build inputs. @@ -152,12 +115,6 @@ args: with args; with stringsWithDeps; with lib; if test -f \$pkg/nix-support/setup-hook; then source \$pkg/nix-support/setup-hook fi - - if test -f \$pkg/nix-support/propagated-build-inputs; then - for i in \$(cat \$pkg/nix-support/propagated-build-inputs); do - findInputs \$i - done - fi } pkgs=\"\" @@ -204,7 +161,7 @@ args: with args; with stringsWithDeps; with lib; fi PATH=\$_PATH\${_PATH:+:}\$PATH - ") [minInit]; + ") ["minInit"]; defEnsureDir = FullDepEntry (" # Ensure that the given directories exists. @@ -214,7 +171,7 @@ args: with args; with stringsWithDeps; with lib; if ! test -x \"\$dir\"; then mkdir -p \"\$dir\"; fi done } - ") [minInit]; + ") ["minInit"]; toSrcDir = s : FullDepEntry ((if (archiveType s) == "tar" then " tar xvf '${s}' @@ -243,11 +200,11 @@ args: with args; with stringsWithDeps; with lib; cd \$(basename ${s} .bz2) " else (abort "unknown archive type : ${s}"))+ (if args ? goSrcDir then args.goSrcDir else "") - ) [minInit]; + ) ["minInit"]; doConfigure = FullDepEntry (" ./configure --prefix=\"\$prefix\" ${toString configureFlags} - ") [minInit addInputs doUnpack]; + ") ["minInit" "addInputs" "doUnpack"]; doAutotools = FullDepEntry (" mkdir -p config @@ -257,21 +214,21 @@ args: with args; with stringsWithDeps; with lib; autoheader || true; automake --add-missing --copy autoconf - ")[minInit addInputs doUnpack]; + ")["minInit" "addInputs" "doUnpack"]; doMake = FullDepEntry (" make ${toString makeFlags} - ") [minInit addInputs doUnpack]; + ") ["minInit" "addInputs" "doUnpack"]; doUnpack = toSrcDir (toString src); installPythonPackage = FullDepEntry (" python setup.py install --prefix=\"\$prefix\" - ") [minInit addInputs doUnpack]; + ") ["minInit" "addInputs" "doUnpack"]; doMakeInstall = FullDepEntry (" make ${toString (getAttr ["makeFlags"] "" args)} "+ - "${toString (getAttr ["installFlags"] "" args)} install") [doMake]; + "${toString (getAttr ["installFlags"] "" args)} install") ["doMake"]; doForceShare = FullDepEntry (" ensureDir \"\$prefix/share\" @@ -281,7 +238,7 @@ args: with args; with stringsWithDeps; with lib; ln -sv share/\$d \"\$prefix\" fi; done; - ") [minInit defEnsureDir]; + ") ["minInit" "defEnsureDir"]; doDump = n: noDepEntry "echo Dump number ${n}; set"; @@ -293,7 +250,7 @@ args: with args; with stringsWithDeps; with lib; doPatch = FullDepEntry (concatStringsSep ";" (map toPatchCommand patches) - ) [minInit doUnpack]; + ) ["minInit" "doUnpack"]; envAdderInner = s: x: if x==null then s else y: a: envAdderInner (s+"echo export ${x}='\"'\"\$${x}:${y}\";'\"'\n") a; @@ -311,12 +268,12 @@ args: with args; with stringsWithDeps; with lib; (${envAdderList env} echo '\"'\"${cmd}-orig\"'\"' '\"'\\\$@'\"' \n) > \"${cmd}\""; - doWrap = cmd: FullDepEntry (wrapEnv cmd (getAttr ["wrappedEnv"] [] args)) [minInit]; + doWrap = cmd: FullDepEntry (wrapEnv cmd (getAttr ["wrappedEnv"] [] args)) ["minInit"]; doPropagate = FullDepEntry (" ensureDir \$out/nix-support echo '${toString (getAttr ["propagatedBuildInputs"] [] args)}' >\$out/nix-support/propagated-build-inputs - ") [minInit defEnsureDir]; + ") ["minInit" "defEnsureDir"]; /*debug = x:(__trace x x); debugX = x:(__trace (__toXML x) x);*/ @@ -326,7 +283,7 @@ args: with args; with stringsWithDeps; with lib; replaceScripts = l:(concatStringsSep "\n" (pairMap replaceInScript l)); doReplaceScripts = FullDepEntry (replaceScripts (getAttr ["shellReplacements"] [] args)) [minInit]; makeNest = x:(if x==defNest.text then x else "startNest\n" + x + "\nstopNest\n"); - textClosure = textClosureMap makeNest; + textClosure = textClosureMapOveridable makeNest; inherit noDepEntry FullDepEntry PackEntry; @@ -361,6 +318,7 @@ args: with args; with stringsWithDeps; with lib; surroundWithCommands = x : before : after : {deps=x.deps; text = before + "\n" + x.text + "\n" + after ;}; + # some haskell stuff - untested! # -------------------------------------------------------- # creates a setup hook @@ -386,7 +344,7 @@ args: with args; with stringsWithDeps; with lib; # Either rungghc or compile setup.hs # / which one is better ? runghc had some trouble with ghc-6.6.1 - defineCabalSetupCmd = noDepEntry " + defCabalSetupCmd = noDepEntry " CABAL_SETUP=\"runghc setup.hs\" "; @@ -411,7 +369,7 @@ args: with args; with stringsWithDeps; with lib; # using ./setup copy to install # and ./setup register --gen-script to install to our local database # after replacing /usr/lib etc with our pure $out path - defCabalBuild = FullDepEntry + cabalBuild = FullDepEntry (if (args ? subdir) then "cd ${args.subdir}" else "")+ " createEmptyPackageDatabaseAndSetupHook ghc --make setup.hs -o setup @@ -422,6 +380,6 @@ args: with args; with stringsWithDeps; with lib; sed -e 's=/usr/local/lib=\$out=g' \\ -i register.sh GHC_PACKAGE_PATH=\$PACKAGE_DB ./register.sh - " [defCreateEmptyPackageDatabaseAndSetupHook defineCabalSetupCmd]; + " [defCreateEmptyPackageDatabaseAndSetupHook defCabalSetupCmd]; }) // args