nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl, makeWrapper, writeText
2, autoconf, ncurses, graphviz, doxygen
3, ocamlPackages, ltl2ba, coq, why3,
4}:
5
6let
7 mkocamlpath = p: "${p}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib";
8 runtimeDeps = with ocamlPackages; [
9 apron
10 biniou
11 camlzip
12 easy-format
13 menhir
14 mlgmpidl
15 num
16 ocamlgraph
17 why3
18 yojson
19 zarith
20 ];
21 ocamlpath = lib.concatMapStringsSep ":" mkocamlpath runtimeDeps;
22in
23
24stdenv.mkDerivation rec {
25 pname = "frama-c";
26 version = "20.0";
27 slang = "Calcium";
28
29 src = fetchurl {
30 url = "http://frama-c.com/download/frama-c-${version}-${slang}.tar.gz";
31 sha256 = "03dvn162djylj2skmk6vv75gh87mm4s5cspkzcrlm5x0rlla2yqn";
32 };
33
34 preConfigure = lib.optionalString stdenv.cc.isClang "configureFlagsArray=(\"--with-cpp=clang -E -C\")";
35
36 nativeBuildInputs = [ autoconf makeWrapper ];
37
38 buildInputs = with ocamlPackages; [
39 ncurses ocaml findlib ltl2ba ocamlgraph yojson menhir camlzip
40 lablgtk coq graphviz zarith apron why3 mlgmpidl doxygen
41 ];
42
43 enableParallelBuilding = true;
44
45 fixupPhase = ''
46 for p in $out/bin/frama-c{,-gui};
47 do
48 wrapProgram $p --prefix OCAMLPATH ':' ${ocamlpath}
49 done
50 '';
51
52 # Allow loading of external Frama-C plugins
53 setupHook = writeText "setupHook.sh" ''
54 addFramaCPath () {
55 if test -d "''$1/lib/frama-c/plugins"; then
56 export FRAMAC_PLUGIN="''${FRAMAC_PLUGIN}''${FRAMAC_PLUGIN:+:}''$1/lib/frama-c/plugins"
57 export OCAMLPATH="''${OCAMLPATH}''${OCAMLPATH:+:}''$1/lib/frama-c/plugins"
58 fi
59
60 if test -d "''$1/lib/frama-c"; then
61 export OCAMLPATH="''${OCAMLPATH}''${OCAMLPATH:+:}''$1/lib/frama-c"
62 fi
63
64 if test -d "''$1/share/frama-c/"; then
65 export FRAMAC_EXTRA_SHARE="''${FRAMAC_EXTRA_SHARE}''${FRAMAC_EXTRA_SHARE:+:}''$1/share/frama-c"
66 fi
67
68 }
69
70 addEnvHooks "$targetOffset" addFramaCPath
71 '';
72
73
74 meta = {
75 description = "An extensible and collaborative platform dedicated to source-code analysis of C software";
76 homepage = http://frama-c.com/;
77 license = stdenv.lib.licenses.lgpl21;
78 maintainers = with stdenv.lib.maintainers; [ thoughtpolice amiddelk ];
79 platforms = stdenv.lib.platforms.unix;
80 };
81}