@@ -13,49 +13,22 @@ with haskellLib;
1313 "benchmarks"
1414 ];
1515
16− mergeComponents = lib.zipAttrsWith (_: comps: lib.genAttrs [
17− "depends"
18− "libs"
19− "frameworks"
20− "pkgconfig"
21− "build-tools"
22− ] (n: {
23− ${n} = lib.concatMap (comp: comp.${n} or []) comps;
24− }));
25−
26− unionrAttrs = lib.foldr (a: b: a // b) {};
27−
28− mergeConfigs = configs:
29− let
30− mergeComponentType = type: mergeComponents (map (conf: (conf.components or {}).${type} or {}) configs);
31− in unionrAttrs configs // {
32− flags = unionrAttrs (map (conf: conf.flags or {}) configs);
33− package = lib.foldr (conf: lib.recursiveUpdate (conf.package or {})) {} configs;
34− components =
35− mergeComponents (map (conf: removeAttrs (conf.components or {}) subComponentTypes) configs)
36− // lib.genAttrs subComponentTypes mergeComponentType;
37− configureFlags = concatMap (conf: conf.configureFlags or []) configs;
38− };
39−
4016 foldrAttrVals = f: z: attrs:
41− lib.foldr (g: acc: g acc) z (lib.mapAttrsToList f attrs);
42−
43− attrLength = attrs: builtins.length (builtins.attrValues attrs);
17+ lib.foldr (g: acc: g acc) z (lib.mapAttrsToList (_name: f) attrs);
4418
4519 foldComponents = tys: f: z: conf:
4620 let
4721 comps = conf.components or {};
48− foldSection = foldrAttrVals f;
49− libComp = acc:
50− foldSection acc
51− (removeAttrs comps subComponentTypes);
22+ libComp = acc: if comps ? library then f comps.library acc else acc;
5223 subComps = acc:
5324 lib.foldr
54− (ty: acc': foldSection acc' (comps.${ty} or {}))
25+ (ty: acc': foldrAttrVals f acc' (comps.${ty} or {}))
5526 acc
5627 tys;
5728 in libComp (subComps z);
5829
30+ getAllComponents = foldComponents subComponentTypes (c: acc: [c] ++ acc) [];
31+
5932 componentPrefix = {
6033 # Are all of these right?
6134 sublibs = "sublib";