2008-01-23 19:11:03 +01: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]);
|
|
|
|
|
|
|
|
a step is defined by noDepEntry, FullDepEntry or PackEntry.
|
|
|
|
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 23:59:31 +02:00
|
|
|
args:
|
|
|
|
with args;
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
inherit (builtins)
|
2008-01-23 19:11:03 +01:00
|
|
|
head tail isList isAttrs;
|
2007-10-29 11:52:04 +01:00
|
|
|
in
|
2007-08-26 23:59:31 +02:00
|
|
|
rec {
|
|
|
|
|
|
|
|
/*
|
|
|
|
let shelllib = rec {
|
|
|
|
a= {
|
|
|
|
text = "aaaa";
|
|
|
|
deps = [b c];
|
|
|
|
};
|
|
|
|
b = {
|
|
|
|
text = "b";
|
|
|
|
};
|
|
|
|
c = {
|
|
|
|
text = "c";
|
|
|
|
deps = [];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
[textClosure [shelllib.a]
|
|
|
|
textclosure shelllib.a];
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-10-29 11:52:04 +01:00
|
|
|
textClosureDupList = arg:
|
2007-08-26 23:59:31 +02:00
|
|
|
(
|
|
|
|
if isList arg then
|
|
|
|
textClosureDupList {text = ""; deps = arg;}
|
|
|
|
else
|
2007-10-29 11:52:04 +01:00
|
|
|
(concatLists (map textClosureDupList arg.deps)) ++ [arg]
|
2007-08-26 23:59:31 +02:00
|
|
|
);
|
|
|
|
|
2008-01-23 19:11:03 +01:00
|
|
|
textClosureDupListOverridable = predefined: arg:
|
|
|
|
(
|
|
|
|
if isList arg then
|
|
|
|
textClosureDupListOverridable predefined {text = ""; deps = arg;}
|
|
|
|
else if isAttrs arg then
|
|
|
|
(concatLists (map (textClosureDupListOverridable predefined) arg.deps)) ++ [arg]
|
|
|
|
else
|
|
|
|
textClosureDupListOverridable predefined (getAttr [arg] [] predefined)
|
|
|
|
);
|
|
|
|
|
|
|
|
textClosureListOverridable = predefined: arg:
|
2007-10-29 11:52:04 +01:00
|
|
|
(map (x : x.text)
|
2008-01-23 19:11:03 +01:00
|
|
|
(uniqList {inputList = textClosureDupListOverridable predefined arg;}));
|
|
|
|
textClosureOverridable = predefined: arg: concatStringsSep "\n" (textClosureListOverridable predefined arg);
|
2007-08-26 23:59:31 +02:00
|
|
|
|
2008-01-23 19:11:03 +01:00
|
|
|
textClosureMapOveridable = f: predefined: arg:
|
|
|
|
concatStringsSep "\n" (map f (textClosureListOverridable predefined arg));
|
2007-11-08 15:34:54 +01:00
|
|
|
|
2007-10-29 11:52:04 +01:00
|
|
|
noDepEntry = text : {inherit text;deps = [];};
|
|
|
|
FullDepEntry = text : deps: {inherit text deps;};
|
2007-08-29 01:29:23 +02:00
|
|
|
PackEntry = deps: {inherit deps; text="";};
|
2007-08-26 23:59:31 +02:00
|
|
|
}
|