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