Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 158 lines 5.9 kB view raw
1{ lib, fetchzip, mkCoqDerivation 2, coq, flocq, compcert 3, ocamlPackages, fetchpatch, makeWrapper, coq2html 4, stdenv, tools ? stdenv.cc 5, version ? null 6}: 7 8let compcert = mkCoqDerivation rec { 9 10 pname = "compcert"; 11 owner = "AbsInt"; 12 13 inherit version; 14 releaseRev = v: "v${v}"; 15 16 defaultVersion = with lib.versions; lib.switch coq.version [ 17 { case = range "8.14" "8.16"; out = "3.12"; } 18 { case = isEq "8.13" ; out = "3.10"; } 19 { case = isEq "8.12" ; out = "3.9"; } 20 { case = range "8.8" "8.11"; out = "3.8"; } 21 ] null; 22 23 release = { 24 "3.8".sha256 = "1gzlyxvw64ca12qql3wnq3bidcx9ygsklv9grjma3ib4hvg7vnr7"; 25 "3.9".sha256 = "1srcz2dqrvmbvv5cl66r34zqkm0hsbryk7gd3i9xx4slahc9zvdb"; 26 "3.10".sha256 = "sha256:19rmx8r8v46101ij5myfrz60arqjy7q3ra3fb8mxqqi3c8c4l4j6"; 27 "3.11".sha256 = "sha256-ZISs/ZAJVWtxp9+Sg5qV5Rss1gI9hK769GnBfawLa6A="; 28 "3.12".sha256 = "sha256-hXkQ8UnAx3k50OJGBmSm4hgrnRFCosu4+PEMrcKfmV0="; 29 }; 30 31 strictDeps = true; 32 33 nativeBuildInputs = with ocamlPackages; [ makeWrapper ocaml findlib menhir coq coq2html ]; 34 buildInputs = with ocamlPackages; [ menhirLib ]; 35 propagatedBuildInputs = [ flocq ]; 36 37 enableParallelBuilding = true; 38 39 postPatch = '' 40 substituteInPlace ./configure \ 41 --replace \$\{toolprefix\}ar 'ar' \ 42 --replace '{toolprefix}gcc' '{toolprefix}cc' 43 ''; 44 45 configurePhase = '' 46 ./configure -clightgen \ 47 -prefix $out \ 48 -coqdevdir $lib/lib/coq/${coq.coq-version}/user-contrib/compcert/ \ 49 -toolprefix ${tools}/bin/ \ 50 -use-external-Flocq \ 51 ${if stdenv.isDarwin then "x86_64-macosx" else "x86_64-linux"} 52 ''; 53 54 installTargets = "documentation install"; 55 installFlags = []; # trust ./configure 56 preInstall = '' 57 mkdir -p $out/share/man 58 mkdir -p $man/share 59 ''; 60 postInstall = '' 61 # move man into place 62 mv $out/share/man/ $man/share/ 63 64 # move docs into place 65 mkdir -p $doc/share/doc/compcert 66 mv doc/html $doc/share/doc/compcert/ 67 68 # wrap ccomp to undefine _FORTIFY_SOURCE; ccomp invokes cc1 which sets 69 # _FORTIFY_SOURCE=2 by default, but undefines __GNUC__ (as it should), 70 # which causes a warning in libc. this suppresses it. 71 for x in ccomp clightgen; do 72 wrapProgram $out/bin/$x --add-flags "-U_FORTIFY_SOURCE" 73 done 74 ''; 75 76 outputs = [ "out" "lib" "doc" "man" ]; 77 78 meta = with lib; { 79 description = "Formally verified C compiler"; 80 homepage = "https://compcert.org"; 81 license = licenses.inria-compcert; 82 platforms = [ "x86_64-linux" "x86_64-darwin" ]; 83 maintainers = with maintainers; [ thoughtpolice jwiegley vbgl ]; 84 }; 85}; in 86compcert.overrideAttrs (o: 87 { 88 patches = with lib.versions; lib.switch [ coq.version o.version ] [ 89 { cases = [ (range "8.12.2" "8.13.2") "3.8" ]; 90 out = [ 91 # Support for Coq 8.12.2 92 (fetchpatch { 93 url = "https://github.com/AbsInt/CompCert/commit/06956421b4307054af221c118c5f59593c0e67b9.patch"; 94 sha256 = "1f90q6j3xfvnf3z830bkd4d8526issvmdlrjlc95bfsqs78i1yrl"; 95 }) 96 # Support for Coq 8.13.0 97 (fetchpatch { 98 url = "https://github.com/AbsInt/CompCert/commit/0895388e7ebf9c9f3176d225107e21968919fb97.patch"; 99 sha256 = "0qhkzgb2xl5kxys81pldp3mr39gd30lvr2l2wmplij319vp3xavd"; 100 }) 101 # Support for Coq 8.13.1 102 (fetchpatch { 103 url = "https://github.com/AbsInt/CompCert/commit/6bf310dd678285dc193798e89fc2c441d8430892.patch"; 104 sha256 = "026ahhvpj5pksy90f8pnxgmhgwfqk4kwyvcf8x3dsanvz98d4pj5"; 105 }) 106 # Drop support for Coq < 8.9 107 (fetchpatch { 108 url = "https://github.com/AbsInt/CompCert/commit/7563a5df926a4c6fb1489a7a4c847641c8a35095.patch"; 109 sha256 = "05vkslzy399r3dm6dmjs722rrajnyfa30xsyy3djl52isvn4gyfb"; 110 }) 111 # Support for Coq 8.13.2 112 (fetchpatch { 113 url = "https://github.com/AbsInt/CompCert/commit/48bc183167c4ce01a5c9ea86e49d60530adf7290.patch"; 114 sha256 = "0j62lppfk26d1brdp3qwll2wi4gvpx1k70qivpvby5f7dpkrkax1"; 115 }) 116 ]; 117 } 118 { cases = [ (range "8.14" "8.15") "3.10" ]; 119 out = [ 120 # Support for Coq 8.14.1 121 (fetchpatch { 122 url = "https://github.com/AbsInt/CompCert/commit/a79f0f99831aa0b0742bf7cce459cc9353bd7cd0.patch"; 123 sha256 = "sha256:0g20x8gfzvplpad9y9vr1p33k6qv6rsp691x6687v9ffvz7zsz94"; 124 }) 125 # Support for Coq 8.15.0 126 (fetchpatch { 127 url = "https://github.com/AbsInt/CompCert/commit/a882f78c069f7337dd9f4abff117d4df98ef38a6.patch"; 128 sha256 = "sha256:16i87s608fj9ni7cvd5wrd7gicqniad7w78wi26pxdy0pacl7bjg"; 129 }) 130 # Support for Coq 8.15.1 131 (fetchpatch { 132 url = "https://github.com/AbsInt/CompCert/commit/10a976994d7fd30d143354c289ae735d210ccc09.patch"; 133 sha256 = "sha256:0bg58gpkgxlmxzp6sg0dvybrfk0pxnm7qd6vxlrbsbm2w6wk03jv"; 134 }) 135 # Support for Coq 8.15.2 136 (fetchpatch { 137 url = "https://github.com/AbsInt/CompCert/commit/283a5be7296c4c0a94d863b427c77007ab875733.patch"; 138 sha256 = "sha256:1s7hvb5ii3p8kkcjlzwldvk8xc3iiibxi9935qjbrh25xi6qs66k"; 139 }) 140 ]; 141 } 142 { cases = [ (isEq "8.16") (range "3.11" "3.12") ]; 143 out = [ 144 # Support for Coq 8.16.0 145 (fetchpatch { 146 url = "https://github.com/AbsInt/CompCert/commit/34be08a23d18d56f2dde24fd24b6dbe3bcb01ec3.patch"; 147 sha256 = "sha256-a5YnftGVadVypEqrOYRRxI7YtGOEWyKnO4GqakFhvzI="; 148 }) 149 # Support for Coq 8.16.1 150 (fetchpatch { 151 url = "https://github.com/AbsInt/CompCert/commit/35531503b3493cb9b0ec8a8585e84928c85b4af9.patch"; 152 hash = "sha256-DvtYi/eiPUe8tA0EFTcCjJA0JjtVKceUsX4ZDM0pWkE="; 153 }) 154 ]; 155 } 156 ] []; 157 } 158)