nixpkgs/pkgs/development/tools/analysis/frama-c/default.nix

82 lines
2.2 KiB
Nix
Raw Normal View History

2019-06-19 03:01:38 +01:00
{ lib, stdenv, fetchurl, makeWrapper, writeText
, autoconf, ncurses, graphviz, doxygen
, ocamlPackages, ltl2ba, coq, why3,
}:
2012-07-12 16:42:24 +01:00
2016-10-12 12:20:57 +01:00
let
mkocamlpath = p: "${p}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib";
2019-06-19 03:01:38 +01:00
runtimeDeps = with ocamlPackages; [
apron
biniou
camlzip
easy-format
menhir
mlgmpidl
num
ocamlgraph
why3
yojson
zarith
];
ocamlpath = lib.concatMapStringsSep ":" mkocamlpath runtimeDeps;
2016-10-12 12:20:57 +01:00
in
stdenv.mkDerivation rec {
pname = "frama-c";
2020-06-14 00:31:36 +01:00
version = "21.0";
slang = "Scandium";
src = fetchurl {
2018-12-02 13:14:31 +00:00
url = "http://frama-c.com/download/frama-c-${version}-${slang}.tar.gz";
2020-06-14 00:31:36 +01:00
sha256 = "0xqkyrvkr31r6443zgf4f749a1mf2360v8f0km071a1za767yvf5";
};
2019-06-19 03:01:38 +01:00
preConfigure = lib.optionalString stdenv.cc.isClang "configureFlagsArray=(\"--with-cpp=clang -E -C\")";
nativeBuildInputs = [ autoconf makeWrapper ];
2016-10-12 12:20:57 +01:00
buildInputs = with ocamlPackages; [
2019-06-19 03:01:38 +01:00
ncurses ocaml findlib ltl2ba ocamlgraph yojson menhir camlzip
lablgtk coq graphviz zarith apron why3 mlgmpidl doxygen
2012-07-12 16:42:24 +01:00
];
2019-06-19 03:01:38 +01:00
enableParallelBuilding = true;
2019-06-19 03:01:38 +01:00
fixupPhase = ''
2016-10-12 12:20:57 +01:00
for p in $out/bin/frama-c{,-gui};
do
wrapProgram $p --prefix OCAMLPATH ':' ${ocamlpath}
done
'';
2019-06-19 03:01:38 +01:00
# Allow loading of external Frama-C plugins
setupHook = writeText "setupHook.sh" ''
addFramaCPath () {
if test -d "''$1/lib/frama-c/plugins"; then
export FRAMAC_PLUGIN="''${FRAMAC_PLUGIN}''${FRAMAC_PLUGIN:+:}''$1/lib/frama-c/plugins"
export OCAMLPATH="''${OCAMLPATH}''${OCAMLPATH:+:}''$1/lib/frama-c/plugins"
fi
if test -d "''$1/lib/frama-c"; then
export OCAMLPATH="''${OCAMLPATH}''${OCAMLPATH:+:}''$1/lib/frama-c"
fi
if test -d "''$1/share/frama-c/"; then
export FRAMAC_EXTRA_SHARE="''${FRAMAC_EXTRA_SHARE}''${FRAMAC_EXTRA_SHARE:+:}''$1/share/frama-c"
fi
2012-07-12 16:42:24 +01:00
2019-06-19 03:01:38 +01:00
}
addEnvHooks "$targetOffset" addFramaCPath
2012-07-12 16:42:24 +01:00
'';
2019-06-19 03:01:38 +01:00
meta = {
2016-09-27 21:26:10 +01:00
description = "An extensible and collaborative platform dedicated to source-code analysis of C software";
homepage = "http://frama-c.com/";
license = stdenv.lib.licenses.lgpl21;
maintainers = with stdenv.lib.maintainers; [ thoughtpolice amiddelk ];
2016-09-27 21:26:10 +01:00
platforms = stdenv.lib.platforms.unix;
};
}