1{ stdenv, lib, fetchurl
2, coq, ocamlPackages
3, tools ? stdenv.cc
4}:
5
6assert lib.versionAtLeast ocamlPackages.ocaml.version "4.02";
7
8stdenv.mkDerivation rec {
9 name = "compcert-${version}";
10 version = "3.0.1";
11
12 src = fetchurl {
13 url = "http://compcert.inria.fr/release/${name}.tgz";
14 sha256 = "0dgrj26dzdy4n3s9b5hwc6lm54vans1v4qx9hdp1q8w1qqcdriq9";
15 };
16
17 buildInputs = [ coq ]
18 ++ (with ocamlPackages; [ ocaml findlib menhir ]);
19
20 enableParallelBuilding = true;
21
22 configurePhase = ''
23 substituteInPlace ./configure --replace '{toolprefix}gcc' '{toolprefix}cc'
24 ./configure -clightgen -prefix $out -toolprefix ${tools}/bin/ '' +
25 (if stdenv.isDarwin then "x86_64-macosx" else "x86_64-linux");
26
27 installTargets = "documentation install";
28
29 postInstall = ''
30 mkdir -p $lib/share/doc/compcert
31 mv doc/html $lib/share/doc/compcert/
32 mkdir -p $lib/lib/coq/${coq.coq-version}/user-contrib/compcert/
33 mv backend cfrontend common cparser driver flocq x86 x86_64 lib \
34 $lib/lib/coq/${coq.coq-version}/user-contrib/compcert/
35 '';
36
37 outputs = [ "out" "lib" ];
38
39 meta = with stdenv.lib; {
40 description = "Formally verified C compiler";
41 homepage = "http://compcert.inria.fr";
42 license = licenses.inria;
43 platforms = platforms.linux ++
44 platforms.darwin;
45 maintainers = with maintainers; [ thoughtpolice jwiegley vbgl ];
46 };
47}