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

93 lines
3.2 KiB
Nix
Raw Normal View History

2016-10-12 13:20:57 +02:00
{ stdenv, fetchurl, makeWrapper, ncurses, ocamlPackages, graphviz
, ltl2ba, coq, alt-ergo, why3, autoconf
}:
2012-07-12 17:42:24 +02:00
2016-10-12 13:20:57 +02:00
let
mkocamlpath = p: "${p}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib";
ocamlpath = "${mkocamlpath ocamlPackages.apron}:${mkocamlpath ocamlPackages.mlgmpidl}";
in
stdenv.mkDerivation rec {
name = "frama-c-${version}";
version = "20171101";
slang = "Sulfur";
src = fetchurl {
url = "http://frama-c.com/download/frama-c-${slang}-${version}.tar.gz";
sha256 = "1vwjfqmm1r36gkybsy3a7m89q5zicf4rnz5vlsn9imnpjpl9gjw1";
};
why2 = fetchurl {
2017-11-14 22:37:34 +01:00
url = "http://why.lri.fr/download/why-2.39.tar.gz";
sha256 = "0nf17jl00s7q9z8gkbamnf7mglvxqrm3967c17ic4c9xz8g125a8";
};
nativeBuildInputs = [ autoconf makeWrapper ];
2016-10-12 13:20:57 +02:00
buildInputs = with ocamlPackages; [
2014-11-07 10:50:39 +01:00
ncurses ocaml findlib alt-ergo ltl2ba ocamlgraph
lablgtk coq graphviz zarith why3 apron camlp4
2012-07-12 17:42:24 +02:00
];
# Experimentally, the build segfaults with high core counts
enableParallelBuilding = false;
unpackPhase = ''
tar xf $src
tar xf $why2
'';
buildPhase = ''
cd frama*
./configure --prefix=$out
# It is not parallel safe
make
make install
cd ../why*
FRAMAC=$out/bin/frama-c ./configure --prefix=$out
make
make install
2016-10-12 13:20:57 +02:00
for p in $out/bin/frama-c{,-gui};
do
wrapProgram $p --prefix OCAMLPATH ':' ${ocamlpath}
done
'';
# Enter frama-c directory before patching
prePatch = ''cd frama*'';
2016-10-12 13:20:57 +02:00
patches = [ ./dynamic.diff ];
2012-07-12 17:42:24 +02:00
postPatch = ''
# strip absolute paths to /usr/bin
for file in ./configure ./share/Makefile.common ./src/*/configure; do #*/
2012-07-12 17:42:24 +02:00
substituteInPlace $file --replace '/usr/bin/' ""
done
2016-09-27 22:26:10 +02:00
substituteInPlace ./src/plugins/aorai/aorai_register.ml --replace '"ltl2ba' '"${ltl2ba}/bin/ltl2ba'
cd ../why*
substituteInPlace ./Makefile.in --replace '-warn-error A' '-warn-error A-3'
substituteInPlace ./frama-c-plugin/Makefile --replace 'shell frama-c' "shell $out/bin/frama-c"
substituteInPlace ./jc/jc_make.ml --replace ' why-dp ' " $out/bin/why-dp "
substituteInPlace ./jc/jc_make.ml --replace "?= why@\n" "?= $out/bin/why@\n"
substituteInPlace ./jc/jc_make.ml --replace ' gwhy-bin@' " $out/bin/gwhy-bin@"
substituteInPlace ./jc/jc_make.ml --replace ' why3 ' " ${why3}/bin/why3 "
substituteInPlace ./jc/jc_make.ml --replace ' why3ide ' " ${why3}/bin/why3ide "
substituteInPlace ./jc/jc_make.ml --replace ' why3replayer ' " ${why3}/bin/why3replayer "
substituteInPlace ./jc/jc_make.ml --replace ' why3ml ' " ${why3}/bin/why3ml "
substituteInPlace ./jc/jc_make.ml --replace ' coqdep@' " ${coq}/bin/coqdep@"
substituteInPlace ./jc/jc_make.ml --replace 'coqc' " ${coq}/bin/coqc"
substituteInPlace ./frama-c-plugin/register.ml --replace ' jessie ' " $out/bin/jessie "
cd ..
2012-07-12 17:42:24 +02:00
'';
meta = {
2016-09-27 22:26:10 +02: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 22:26:10 +02:00
platforms = stdenv.lib.platforms.unix;
};
}