@@ -1,125 +0,0 @@
1−{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper
2−, coqPackages, ocamlPackages, coq2html
3−, tools ? stdenv.cc
4−, version ? "3.9"
5−}:
6−
7−let
8− ocaml-pkgs = with ocamlPackages; [ ocaml findlib menhir menhirLib ];
9− ccomp-platform = if stdenv.isDarwin then "x86_64-macosx" else "x86_64-linux";
10− inherit (coqPackages) coq flocq;
11− inherit (lib) optional optionalString;
12−in
13−
14−let param = {
15− "3.7" = {
16− sha256 = "1h4zhk9rrqki193nxs9vjvya7nl9yxjcf07hfqb6g77riy1vd2jr";
17− patches = [
18− (fetchpatch {
19− url = "https://github.com/AbsInt/CompCert/commit/0a2db0269809539ccc66f8ec73637c37fbd23580.patch";
20− sha256 = "0n8qrba70x8f422jdvq9ddgsx6avf2dkg892g4ldh3jiiidyhspy";
21− })
22− (fetchpatch {
23− url = "https://github.com/AbsInt/CompCert/commit/5e29f8b5ba9582ecf2a1d0baeaef195873640607.patch";
24− sha256 = "184nfdgxrkci880lkaj5pgnify3plka7xfgqrgv16275sqppc5hc";
25− })
26− ];
27− };
28− "3.8" = {
29− sha256 = "1gzlyxvw64ca12qql3wnq3bidcx9ygsklv9grjma3ib4hvg7vnr7";
30− patches = [
31− # Support for Coq 8.12.2
32− (fetchpatch {
33− url = "https://github.com/AbsInt/CompCert/commit/06956421b4307054af221c118c5f59593c0e67b9.patch";
34− sha256 = "1f90q6j3xfvnf3z830bkd4d8526issvmdlrjlc95bfsqs78i1yrl";
35− })
36− # Support for Coq 8.13.0
37− (fetchpatch {
38− url = "https://github.com/AbsInt/CompCert/commit/0895388e7ebf9c9f3176d225107e21968919fb97.patch";
39− sha256 = "0qhkzgb2xl5kxys81pldp3mr39gd30lvr2l2wmplij319vp3xavd";
40− })
41− # Support for Coq 8.13.1
42− (fetchpatch {
43− url = "https://github.com/AbsInt/CompCert/commit/6bf310dd678285dc193798e89fc2c441d8430892.patch";
44− sha256 = "026ahhvpj5pksy90f8pnxgmhgwfqk4kwyvcf8x3dsanvz98d4pj5";
45− })
46− # Drop support for Coq < 8.9
47− (fetchpatch {
48− url = "https://github.com/AbsInt/CompCert/commit/7563a5df926a4c6fb1489a7a4c847641c8a35095.patch";
49− sha256 = "05vkslzy399r3dm6dmjs722rrajnyfa30xsyy3djl52isvn4gyfb";
50− })
51− # Support for Coq 8.13.2
52− (fetchpatch {
53− url = "https://github.com/AbsInt/CompCert/commit/48bc183167c4ce01a5c9ea86e49d60530adf7290.patch";
54− sha256 = "0j62lppfk26d1brdp3qwll2wi4gvpx1k70qivpvby5f7dpkrkax1";
55− })
56− ];
57− useExternalFlocq = true;
58− };
59− "3.9" = {
60− sha256 = "1srcz2dqrvmbvv5cl66r34zqkm0hsbryk7gd3i9xx4slahc9zvdb";
61− useExternalFlocq = true;
62− };
63−}."${version}"; in
64−
65−stdenv.mkDerivation rec {
66− pname = "compcert";
67− inherit version;
68−
69− src = fetchFromGitHub {
70− owner = "AbsInt";
71− repo = "CompCert";
72− rev = "v${version}";
73− inherit (param) sha256;
74− };
75−
76− patches = param.patches or [];
77−
78− nativeBuildInputs = [ makeWrapper ];
79− buildInputs = ocaml-pkgs ++ [ coq coq2html ];
80− propagatedBuildInputs = optional (param.useExternalFlocq or false) flocq;
81− enableParallelBuilding = true;
82−
83− postPatch = ''
84− substituteInPlace ./configure \
85− --replace \$\{toolprefix\}ar 'ar' \
86− --replace '{toolprefix}gcc' '{toolprefix}cc'
87− '';
88−
89− configurePhase = ''
90− ./configure -clightgen \
91− -prefix $out \
92− -coqdevdir $lib/lib/coq/${coq.coq-version}/user-contrib/compcert/ \
93− -toolprefix ${tools}/bin/ \
94− ${optionalString (param.useExternalFlocq or false) "-use-external-Flocq"} \
95− ${ccomp-platform}
96− '';
97−
98− installTargets = "documentation install";
99− postInstall = ''
100− # move man into place
101− mkdir -p $man/share
102− mv $out/share/man/ $man/share/
103−
104− # move docs into place
105− mkdir -p $doc/share/doc/compcert
106− mv doc/html $doc/share/doc/compcert/
107−
108− # wrap ccomp to undefine _FORTIFY_SOURCE; ccomp invokes cc1 which sets
109− # _FORTIFY_SOURCE=2 by default, but undefines __GNUC__ (as it should),
110− # which causes a warning in libc. this suppresses it.
111− for x in ccomp clightgen; do
112− wrapProgram $out/bin/$x --add-flags "-U_FORTIFY_SOURCE"
113− done
114− '';
115−
116− outputs = [ "out" "lib" "doc" "man" ];
117−
118− meta = with lib; {
119− description = "Formally verified C compiler";
120− homepage = "https://compcert.org";
121− license = licenses.inria-compcert;
122− platforms = [ "x86_64-linux" "x86_64-darwin" ];
123− maintainers = with maintainers; [ thoughtpolice jwiegley vbgl ];
124− };
125−}