1 { lib, stdenv, fetchurl, makeWrapper, writeText
2 , autoconf, ncurses, graphviz, doxygen
3 , ocamlPackages, ltl2ba, coq, why3
4 , gdk-pixbuf, wrapGAppsHook
8 mkocamlpath = p: "${p}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib";
9 runtimeDeps = with ocamlPackages; [
32 ocamlpath = lib.concatMapStringsSep ":" mkocamlpath runtimeDeps;
35 stdenv.mkDerivation rec {
41 url = "https://frama-c.com/download/frama-c-${version}-${slang}.tar.gz";
42 sha256 = "sha256-Ii3O/NJyBTVAv1ts/zae/Ee4HCjzYOthZmnD8wqLwp8=";
45 preConfigure = lib.optionalString stdenv.cc.isClang "configureFlagsArray=(\"--with-cpp=clang -E -C\")";
47 postConfigure = "patchShebangs src/plugins/value/gen-api.sh";
49 nativeBuildInputs = [ autoconf wrapGAppsHook ];
51 buildInputs = with ocamlPackages; [
52 ncurses ocaml findlib ltl2ba ocamlgraph yojson menhirLib camlzip
53 lablgtk3 lablgtk3-sourceview3 coq graphviz zarith apron why3 mlgmpidl doxygen
54 ppx_deriving ppx_import
58 enableParallelBuilding = true;
61 gappsWrapperArgs+=(--prefix OCAMLPATH ':' ${ocamlpath})
64 # Allow loading of external Frama-C plugins
65 setupHook = writeText "setupHook.sh" ''
67 if test -d "''$1/lib/frama-c/plugins"; then
68 export FRAMAC_PLUGIN="''${FRAMAC_PLUGIN-}''${FRAMAC_PLUGIN:+:}''$1/lib/frama-c/plugins"
69 export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/frama-c/plugins"
72 if test -d "''$1/lib/frama-c"; then
73 export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/frama-c"
76 if test -d "''$1/share/frama-c/"; then
77 export FRAMAC_EXTRA_SHARE="''${FRAMAC_EXTRA_SHARE-}''${FRAMAC_EXTRA_SHARE:+:}''$1/share/frama-c"
82 addEnvHooks "$targetOffset" addFramaCPath
87 description = "An extensible and collaborative platform dedicated to source-code analysis of C software";
88 homepage = "http://frama-c.com/";
89 license = lib.licenses.lgpl21;
90 maintainers = with lib.maintainers; [ thoughtpolice amiddelk ];
91 platforms = lib.platforms.unix;