lol
1{ lib,
2 mkCoqDerivation, recurseIntoAttrs,
3 mathcomp, mathcomp-finmap, mathcomp-bigenough,
4 hierarchy-builder,
5 single ? false,
6 coqPackages, coq, version ? null }@args:
7with builtins // lib;
8let
9 repo = "analysis";
10 owner = "math-comp";
11
12 release."1.0.0".sha256 = "sha256-KiXyaWB4zQ3NuXadq4BSWfoN1cIo1xiLVSN6nW03tC4=";
13 release."0.7.0".sha256 = "sha256-JwkyetXrFsFHqz8KY3QBpHsrkhmEFnrCGuKztcoen60=";
14 release."0.6.7".sha256 = "sha256-3i2PBMEwihwgwUmnS0cmrZ8s+aLPFVq/vo0aXMUaUyA=";
15 release."0.6.6".sha256 = "sha256-tWtv6yeB5/vzwpKZINK9OQ0yQsvD8qu9zVSNHvLMX5Y=";
16 release."0.6.5".sha256 = "sha256-oJk9/Jl1SWra2aFAXRAVfX7ZUaDfajqdDksYaW8dv8E=";
17 release."0.6.1".sha256 = "sha256-1VyNXu11/pDMuH4DmFYSUF/qZ4Bo+/Zl3Y0JkyrH/r0=";
18 release."0.6.0".sha256 = "sha256-0msICcIrK6jbOSiBu0gIVU3RHwoEEvB88CMQqW/06rg=";
19 release."0.5.3".sha256 = "sha256-1NjFsi5TITF8ZWx1NyppRmi8g6YaoUtTdS9bU/sUe5k=";
20 release."0.5.2".sha256 = "0yx5p9zyl8jv1vg7rgkyq8dqzkdnkqv969mi62whmhkvxbavgzbw";
21 release."0.5.1".sha256 = "1hnzqb1gxf88wgj2n1b0f2xm6sxg9j0735zdsv6j12hlvx5lwk68";
22 release."0.3.13".sha256 = "sha256-Yaztew79KWRC933kGFOAUIIoqukaZOdNOdw4XszR1Hg=";
23 release."0.3.10".sha256 = "sha256-FBH2c8QRibq5Ycw/ieB8mZl0fDiPrYdIzZ6W/A3pIhI=";
24 release."0.3.9".sha256 = "sha256-uUU9diBwUqBrNRLiDc0kz0CGkwTZCUmigPwLbpDOeg4=";
25 release."0.3.6".sha256 = "0g2j7b2hca4byz62ssgg90bkbc8wwp7xkb2d3225bbvihi92b4c5";
26 release."0.3.4".sha256 = "18mgycjgg829dbr7ps77z6lcj03h3dchjbj5iir0pybxby7gd45c";
27 release."0.3.3".sha256 = "1m2mxcngj368vbdb8mlr91hsygl430spl7lgyn9qmn3jykack867";
28 release."0.3.1".sha256 = "1iad288yvrjv8ahl9v18vfblgqb1l5z6ax644w49w9hwxs93f2k8";
29 release."0.2.3".sha256 = "0p9mr8g1qma6h10qf7014dv98ln90dfkwn76ynagpww7qap8s966";
30
31 defaultVersion = with versions; lib.switch [ coq.version mathcomp.version ] [
32 { cases = [ (range "8.17" "8.19") (range "2.0.0" "2.2.0") ]; out = "1.0.0"; }
33 { cases = [ (range "8.17" "8.19") (range "1.17.0" "1.19.0") ]; out = "0.7.0"; }
34 { cases = [ (range "8.17" "8.18") (range "1.15.0" "1.18.0") ]; out = "0.6.7"; }
35 { cases = [ (range "8.17" "8.18") (range "1.15.0" "1.18.0") ]; out = "0.6.6"; }
36 { cases = [ (range "8.14" "8.18") (range "1.15.0" "1.17.0") ]; out = "0.6.5"; }
37 { cases = [ (range "8.14" "8.18") (range "1.13.0" "1.16.0") ]; out = "0.6.1"; }
38 { cases = [ (range "8.14" "8.18") (range "1.13" "1.15") ]; out = "0.5.2"; }
39 { cases = [ (range "8.13" "8.15") (range "1.13" "1.14") ]; out = "0.5.1"; }
40 { cases = [ (range "8.13" "8.15") (range "1.12" "1.14") ]; out = "0.3.13"; }
41 { cases = [ (range "8.11" "8.14") (range "1.12" "1.13") ]; out = "0.3.10"; }
42 { cases = [ (range "8.10" "8.12") "1.11.0" ]; out = "0.3.3"; }
43 { cases = [ (range "8.10" "8.11") "1.11.0" ]; out = "0.3.1"; }
44 { cases = [ (range "8.8" "8.11") (range "1.8" "1.10") ]; out = "0.2.3"; }
45 ] null;
46
47 # list of analysis packages sorted by dependency order
48 packages = [ "classical" "analysis" ];
49
50 mathcomp_ = package: let
51 classical-deps = [ mathcomp.algebra mathcomp-finmap ];
52 analysis-deps = [ mathcomp.field mathcomp-bigenough ];
53 intra-deps = lib.optionals (package != "single") (map mathcomp_ (head (splitList (lib.pred.equal package) packages)));
54 pkgpath = if package == "single" then "."
55 else if package == "analysis" then "theories" else "${package}";
56 pname = if package == "single" then "mathcomp-analysis-single"
57 else "mathcomp-${package}";
58 derivation = mkCoqDerivation ({
59 inherit version pname defaultVersion release repo owner;
60
61 namePrefix = [ "coq" "mathcomp" ];
62
63 propagatedBuildInputs =
64 intra-deps
65 ++ optionals (elem package [ "classical" "single" ]) classical-deps
66 ++ optionals (elem package [ "analysis" "single" ]) analysis-deps;
67
68 preBuild = ''
69 cd ${pkgpath}
70 '';
71
72 meta = {
73 description = "Analysis library compatible with Mathematical Components";
74 maintainers = [ maintainers.cohencyril ];
75 license = licenses.cecill-c;
76 };
77
78 passthru = genAttrs packages mathcomp_;
79 });
80 # split packages didn't exist before 0.6, so bulding nothing in that case
81 patched-derivation1 = derivation.overrideAttrs (o:
82 optionalAttrs (o.pname != null && o.pname != "mathcomp-analysis" &&
83 o.version != null && o.version != "dev" && versions.isLt "0.6" o.version)
84 { preBuild = ""; buildPhase = "echo doing nothing"; installPhase = "echo doing nothing"; }
85 );
86 patched-derivation2 = patched-derivation1.overrideAttrs (o:
87 optionalAttrs (o.pname != null && o.pname == "mathcomp-analysis" &&
88 o.version != null && o.version != "dev" && versions.isLt "0.6" o.version)
89 { preBuild = ""; }
90 );
91 patched-derivation = patched-derivation2.overrideAttrs (o:
92 optionalAttrs (o.version != null
93 && (o.version == "dev" || versions.isGe "0.3.4" o.version))
94 {
95 propagatedBuildInputs = o.propagatedBuildInputs ++ [ hierarchy-builder ];
96 }
97 );
98 in patched-derivation;
99in
100mathcomp_ (if single then "single" else "analysis")