2008-01-17 04:14:00 -07:00
|
|
|
/*
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
You define you custom builder script by adding all build steps to a list.
|
|
|
|
for example:
|
|
|
|
builder = writeScript "fsg-4.4-builder"
|
|
|
|
(textClosure [doUnpack addInputs preBuild doMake installPhase doForceShare]);
|
|
|
|
|
2009-05-19 17:25:58 -06:00
|
|
|
a step is defined by noDepEntry, fullDepEntry or packEntry.
|
2008-01-17 04:14:00 -07:00
|
|
|
To ensure that prerequisite are met those are added before the task itself by
|
|
|
|
textClosureDupList. Duplicated items are removed again.
|
|
|
|
|
|
|
|
See trace/nixpkgs/trunk/pkgs/top-level/builder-defs.nix for some predefined build steps
|
|
|
|
|
|
|
|
*/
|
2007-08-26 15:59:31 -06:00
|
|
|
|
2009-05-11 09:21:42 -06:00
|
|
|
{stdenv, lib}:
|
2007-08-26 15:59:31 -06:00
|
|
|
|
2009-05-11 09:21:42 -06:00
|
|
|
with lib;
|
2008-01-18 05:36:56 -07:00
|
|
|
|
2009-05-11 05:55:05 -06:00
|
|
|
rec {
|
2007-11-08 07:34:54 -07:00
|
|
|
|
2009-05-11 09:21:42 -06:00
|
|
|
/* !!! The interface of this function is kind of messed up, since
|
|
|
|
it's way too overloaded and almost but not quite computes a
|
|
|
|
topological sort of the depstrings. */
|
|
|
|
|
|
|
|
textClosureList = predefined: arg:
|
|
|
|
let
|
|
|
|
f = done: todo:
|
|
|
|
if todo == [] then {result = []; inherit done;}
|
|
|
|
else
|
|
|
|
let entry = head todo; in
|
|
|
|
if isAttrs entry then
|
|
|
|
let x = f done entry.deps;
|
|
|
|
y = f x.done (tail todo);
|
|
|
|
in { result = x.result ++ [entry.text] ++ y.result;
|
|
|
|
done = y.done;
|
|
|
|
}
|
|
|
|
else if hasAttr entry done then f done (tail todo)
|
|
|
|
else f (done // listToAttrs [{name = entry; value = 1;}]) ([(builtins.getAttr entry predefined)] ++ tail todo);
|
|
|
|
in (f {} arg).result;
|
|
|
|
|
|
|
|
textClosureMap = f: predefined: names:
|
|
|
|
concatStringsSep "\n" (map f (textClosureList predefined names));
|
2009-05-11 05:55:05 -06:00
|
|
|
|
|
|
|
noDepEntry = text: {inherit text; deps = [];};
|
|
|
|
fullDepEntry = text: deps: {inherit text deps;};
|
|
|
|
packEntry = deps: {inherit deps; text="";};
|
|
|
|
|
|
|
|
# Old names - don't use.
|
|
|
|
FullDepEntry = fullDepEntry;
|
|
|
|
PackEntry = packEntry;
|
|
|
|
|
2007-08-26 15:59:31 -06:00
|
|
|
}
|