From 939e2d702f494d25a0bbfd788d5c83b59866eb8d Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Wed, 12 Oct 2016 13:20:57 +0200 Subject: [PATCH] frama-c: link to the apron library --- .../tools/analysis/frama-c/default.nix | 17 ++++++++++++++--- .../tools/analysis/frama-c/dynamic.diff | 12 ++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/tools/analysis/frama-c/dynamic.diff diff --git a/pkgs/development/tools/analysis/frama-c/default.nix b/pkgs/development/tools/analysis/frama-c/default.nix index fc817a8e391e..a1239c6a1216 100644 --- a/pkgs/development/tools/analysis/frama-c/default.nix +++ b/pkgs/development/tools/analysis/frama-c/default.nix @@ -1,6 +1,11 @@ -{ stdenv, fetchurl, ncurses, ocamlPackages, graphviz +{ stdenv, fetchurl, makeWrapper, ncurses, ocamlPackages, graphviz , ltl2ba, coq, alt-ergo, why3 }: +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 = "20160501"; @@ -16,9 +21,11 @@ stdenv.mkDerivation rec { sha256 = "1335bhq9v3h46m8aba2c5myi9ghm87q41in0m15xvdrwq5big1jg"; }; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = with ocamlPackages; [ ncurses ocaml findlib alt-ergo ltl2ba ocamlgraph - lablgtk coq graphviz zarith why3 zarith + lablgtk coq graphviz zarith why3 apron ]; @@ -38,11 +45,15 @@ stdenv.mkDerivation rec { FRAMAC=$out/bin/frama-c ./configure --prefix=$out make make install + for p in $out/bin/frama-c{,-gui}; + do + wrapProgram $p --prefix OCAMLPATH ':' ${ocamlpath} + done ''; - # Enter frama-c directory before patching prePatch = ''cd frama*''; + patches = [ ./dynamic.diff ]; postPatch = '' # strip absolute paths to /usr/bin for file in ./configure ./share/Makefile.common ./src/*/configure; do diff --git a/pkgs/development/tools/analysis/frama-c/dynamic.diff b/pkgs/development/tools/analysis/frama-c/dynamic.diff new file mode 100644 index 000000000000..7ab2b32de1e7 --- /dev/null +++ b/pkgs/development/tools/analysis/frama-c/dynamic.diff @@ -0,0 +1,12 @@ +--- a/src/kernel_services/plugin_entry_points/dynamic.ml 2016-05-30 16:15:22.000000000 +0200 ++++ b/src/kernel_services/plugin_entry_points/dynamic.ml 2016-10-13 18:25:31.000000000 +0200 +@@ -287,7 +287,8 @@ + (List.fold_right (add_dir ~user:false) Config.plugin_dir []) ; + let pkgs = ref [] in + List.iter (scan_directory pkgs) !load_path ; +- let findlib_path = String.concat ":" !load_path in ++ let findlib_path = String.concat ":" (!load_path @ ++ try [Sys.getenv "OCAMLPATH"] with Not_found -> []) in + Klog.debug ~dkey "setting findlib path to %s" findlib_path; + Findlib.init ~env_ocamlpath:findlib_path (); + load_packages (List.rev !pkgs) ;