at 23.05-pre 90 lines 4.3 kB view raw
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 = "math-comp"; 10 owner = "math-comp"; 11 12 release."0.5.3".sha256 = "sha256-1NjFsi5TITF8ZWx1NyppRmi8g6YaoUtTdS9bU/sUe5k="; 13 release."0.5.2".sha256 = "0yx5p9zyl8jv1vg7rgkyq8dqzkdnkqv969mi62whmhkvxbavgzbw"; 14 release."0.5.1".sha256 = "1hnzqb1gxf88wgj2n1b0f2xm6sxg9j0735zdsv6j12hlvx5lwk68"; 15 release."0.3.13".sha256 = "sha256-Yaztew79KWRC933kGFOAUIIoqukaZOdNOdw4XszR1Hg="; 16 release."0.3.10".sha256 = "sha256-FBH2c8QRibq5Ycw/ieB8mZl0fDiPrYdIzZ6W/A3pIhI="; 17 release."0.3.9".sha256 = "sha256-uUU9diBwUqBrNRLiDc0kz0CGkwTZCUmigPwLbpDOeg4="; 18 release."0.3.6".sha256 = "0g2j7b2hca4byz62ssgg90bkbc8wwp7xkb2d3225bbvihi92b4c5"; 19 release."0.3.4".sha256 = "18mgycjgg829dbr7ps77z6lcj03h3dchjbj5iir0pybxby7gd45c"; 20 release."0.3.3".sha256 = "1m2mxcngj368vbdb8mlr91hsygl430spl7lgyn9qmn3jykack867"; 21 release."0.3.1".sha256 = "1iad288yvrjv8ahl9v18vfblgqb1l5z6ax644w49w9hwxs93f2k8"; 22 release."0.2.3".sha256 = "0p9mr8g1qma6h10qf7014dv98ln90dfkwn76ynagpww7qap8s966"; 23 24 defaultVersion = with versions; switch [ coq.version mathcomp.version ] [ 25 { cases = [ (isGe "8.14") (isGe "1.13.0") ]; out = "0.5.3"; } 26 { cases = [ (isGe "8.14") (range "1.13" "1.15") ]; out = "0.5.2"; } 27 { cases = [ (isGe "8.13") (range "1.13" "1.14") ]; out = "0.5.1"; } 28 { cases = [ (range "8.13" "8.15") (range "1.12" "1.14") ]; out = "0.3.13"; } 29 { cases = [ (range "8.11" "8.14") (isGe "1.12.0") ]; out = "0.3.10"; } 30 { cases = [ (range "8.11" "8.13") "1.11.0" ]; out = "0.3.4"; } 31 { cases = [ (range "8.10" "8.12") "1.11.0" ]; out = "0.3.3"; } 32 { cases = [ (range "8.10" "8.11") "1.11.0" ]; out = "0.3.1"; } 33 { cases = [ (range "8.8" "8.11") (range "1.8" "1.10") ]; out = "0.2.3"; } 34 ] null; 35 36 # list of analysis packages sorted by dependency order 37 packages = [ "classical" "analysis" ]; 38 39 mathcomp_ = package: let 40 classical-deps = [ mathcomp.algebra mathcomp-finmap hierarchy-builder ]; 41 analysis-deps = [ mathcomp.field mathcomp-bigenough ]; 42 intra-deps = if package == "single" then [] 43 else map mathcomp_ (head (splitList (pred.equal package) packages)); 44 pkgpath = if package == "single" then "." 45 else if package == "analysis" then "theories" else "${package}"; 46 pname = if package == "single" then "mathcomp-analysis-single" 47 else "mathcomp-${package}"; 48 derivation = mkCoqDerivation ({ 49 inherit version pname defaultVersion release repo owner; 50 51 namePrefix = [ "coq" "mathcomp" ]; 52 53 propagatedBuildInputs = 54 intra-deps 55 ++ optionals (elem package [ "classical" "single" ]) classical-deps 56 ++ optionals (elem package [ "analysis" "single" ]) analysis-deps; 57 58 preBuild = '' 59 cd ${pkgpath} 60 ''; 61 62 meta = { 63 description = "Analysis library compatible with Mathematical Components"; 64 maintainers = [ maintainers.cohencyril ]; 65 license = licenses.cecill-c; 66 }; 67 68 passthru = genAttrs packages mathcomp_; 69 }); 70 # split packages didn't exist before 0.6, so bulding nothing in that case 71 patched-derivation1 = derivation.overrideAttrs (o: 72 optionalAttrs (o.pname != null && o.pname != "mathcomp-analysis" && 73 o.version != null && o.version != "dev" && versions.isLt "0.6" o.version) 74 { preBuild = ""; buildPhase = "echo doing nothing"; installPhase = "echo doing nothing"; } 75 ); 76 patched-derivation2 = patched-derivation1.overrideAttrs (o: 77 optionalAttrs (o.pname != null && o.pname == "mathcomp-analysis" && 78 o.version != null && o.version != "dev" && versions.isLt "0.6" o.version) 79 { preBuild = ""; } 80 ); 81 patched-derivation = patched-derivation2.overrideAttrs (o: 82 optionalAttrs (o.version != null 83 && (o.version == "dev" || versions.isGe "0.3.4" o.version)) 84 { 85 propagatedBuildInputs = o.propagatedBuildInputs ++ [ hierarchy-builder ]; 86 } 87 ); 88 in patched-derivation; 89in 90mathcomp_ (if single then "single" else "analysis")