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