frama-c: overhaul, upgrade to 20140301-Neon

This massively upgrades the frama-c package to be far more useful,
including support for a lot more plugins, including Jessie.

Jessie unfortunately requires that its plugin is installed alongside
frama-c, so we install why2 (where it lives) along with frama-c now.
This increases the size, but makes it much more useful.

In the future, it may be possible to split out the build such that why2
is a separate expression and frama-c only installs the plugin, rather
than all of why2. However, right now this is fine.

Furthermore, why3 is now a dependency - the Jessie plugin can use
either, and defaults to Why3 now. Per the design, Frama-C can also go
from Why2->Why3 as well.

We also make Coq and Alt-Ergo dependencies, so that out-of-the-box users
get at least one SMT solver and a prover for support.

Signed-off-by: Austin Seipp <aseipp@pobox.com>

+61 -32
+61 -32
pkgs/development/tools/misc/frama-c/default.nix
··· 1 - # Note on a potential dependency-bloat: 2 - # Frama-c ships with several plugins that have dependencies on other 3 - # software. Not providing the dependencies has as effect that certain 4 - # plugins will not be available. 5 - # I've included the dependencies that are well-supported by nixpkgs 6 - # and seem useful in general. Not included are: 7 - # alt-ergo, ltl2ba, otags, why-dp 1 + { stdenv, fetchurl, ncurses, ocamlPackages, graphviz 2 + , ltl2ba, coq, alt-ergo, gmp, why3 }: 8 3 9 - { stdenv, fetchurl, ncurses, ocamlPackages, coq, graphviz }: 4 + stdenv.mkDerivation rec { 5 + name = "frama-c-${version}"; 6 + version = "20140301"; 7 + slang = "Neon"; 10 8 11 - let 9 + src = fetchurl { 10 + url = "http://frama-c.com/download/frama-c-${slang}-${version}.tar.gz"; 11 + sha256 = "0ca7ky7vs34did1j64v6d8gcp2irzw3rr5qgv47jhmidbipn1865"; 12 + }; 12 13 13 - version = "20111001"; 14 - sha256 = "8afad848321c958fab265045cd152482e77ce7c175ee7c9af2d4bec57a1bc671"; 15 - 16 - in stdenv.mkDerivation { 17 - name = "frama-c-${version}"; 18 - 19 - src = fetchurl { 20 - url = "http://frama-c.com/download/frama-c-Nitrogen-${version}.tar.gz"; 21 - inherit sha256; 14 + why2 = fetchurl { 15 + url = "http://why.lri.fr/download/why-2.34.tar.gz"; 16 + sha256 = "1335bhq9v3h46m8aba2c5myi9ghm87q41in0m15xvdrwq5big1jg"; 22 17 }; 23 18 24 19 buildInputs = with ocamlPackages; [ 25 - ncurses ocaml findlib ocamlgraph 26 - lablgtk coq graphviz # optional dependencies 20 + ncurses ocaml findlib alt-ergo ltl2ba ocamlgraph gmp 21 + lablgtk coq graphviz zarith why3 zarith 27 22 ]; 28 23 29 - patches = [ 30 - # this patch comes from the debian frama-c package, and was 31 - # posted on the frama-c issue tracker. 32 - ./0007-Port-to-OCamlgraph-1.8.2.patch 33 - ]; 24 + 25 + enableParallelBuilding = true; 26 + configureFlags = [ "--disable-local-ocamlgraph" ]; 27 + 28 + unpackPhase = '' 29 + tar xf $src 30 + tar xf $why2 31 + ''; 32 + 33 + buildPhase = '' 34 + cd frama* 35 + ./configure --prefix=$out 36 + make -j$NIX_BUILD_CORES 37 + make install 38 + cd ../why* 39 + FRAMAC=$out/bin/frama-c ./configure --prefix=$out 40 + make 41 + make install 42 + ''; 43 + 44 + 45 + # Taken from Debian Sid 46 + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=746091 47 + patches = ./0004-Port-to-OCamlgraph-1.8.5.patch; 34 48 49 + # Enter frama-c directory before patching 50 + prePatch = ''cd frama*''; 35 51 postPatch = '' 36 52 # strip absolute paths to /usr/bin 37 53 for file in ./configure ./share/Makefile.common ./src/*/configure; do ··· 49 65 --replace '$OCAMLLIB/ocamlgraph' "$OCAMLGRAPH_HOME" \ 50 66 --replace '$OCAMLLIB/lablgtk2' "$LABLGTK_HOME" \ 51 67 --replace '+ocamlgraph' "$OCAMLGRAPH_HOME" \ 52 - --replace '1.8)' '*)' 53 68 substituteInPlace ./Makefile --replace '+lablgtk2' "$LABLGTK_HOME" \ 54 69 --replace '$(patsubst +%,.,$(INCLUDES) $(GUI_INCLUDES))' \ 55 70 '$(patsubst /%,.,$(patsubst +%,.,$(INCLUDES) $(GUI_INCLUDES)))' 71 + 72 + substituteInPlace ./src/aorai/aorai_register.ml --replace '"ltl2ba' '"${ltl2ba}/bin/ltl2ba' 73 + 74 + cd ../why* 75 + substituteInPlace ./frama-c-plugin/Makefile --replace 'shell frama-c' "shell $out/bin/frama-c" 76 + substituteInPlace ./jc/jc_make.ml --replace ' why-dp ' " $out/bin/why-dp " 77 + substituteInPlace ./jc/jc_make.ml --replace "?= why@\n" "?= $out/bin/why@\n" 78 + substituteInPlace ./jc/jc_make.ml --replace ' gwhy-bin@' " $out/bin/gwhy-bin@" 79 + substituteInPlace ./jc/jc_make.ml --replace ' why3 ' " ${why3}/bin/why3 " 80 + substituteInPlace ./jc/jc_make.ml --replace ' why3ide ' " ${why3}/bin/why3ide " 81 + substituteInPlace ./jc/jc_make.ml --replace ' why3replayer ' " ${why3}/bin/why3replayer " 82 + substituteInPlace ./jc/jc_make.ml --replace ' why3ml ' " ${why3}/bin/why3ml " 83 + substituteInPlace ./jc/jc_make.ml --replace ' coqdep@' " ${coq}/bin/coqdep@" 84 + substituteInPlace ./jc/jc_make.ml --replace 'coqc' " ${coq}/bin/coqc" 85 + substituteInPlace ./frama-c-plugin/register.ml --replace ' jessie ' " $out/bin/jessie " 86 + cd .. 56 87 ''; 57 88 58 89 meta = { 59 90 description = "Frama-C is an extensible tool for source-code analysis of C software"; 60 - 61 - homepage = http://frama-c.com/; 62 - license = "GPLv2"; 63 - 64 - maintainers = [ stdenv.lib.maintainers.amiddelk ]; 65 - platforms = stdenv.lib.platforms.gnu; 91 + homepage = http://frama-c.com/; 92 + license = stdenv.lib.licenses.lgpl21; 93 + maintainers = with stdenv.lib.maintainers; [ thoughtpolice amiddelk ]; 94 + platforms = stdenv.lib.platforms.linux; 66 95 }; 67 96 }