diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/tools/analysis/frama-c/default.nix')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/tools/analysis/frama-c/default.nix | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/analysis/frama-c/default.nix b/infra/libkookie/nixpkgs/pkgs/development/tools/analysis/frama-c/default.nix new file mode 100644 index 000000000000..94012ce7ff68 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/tools/analysis/frama-c/default.nix @@ -0,0 +1,80 @@ +{ lib, stdenv, fetchurl, makeWrapper, writeText +, autoconf, ncurses, graphviz, doxygen +, ocamlPackages, ltl2ba, coq, why3 +, gdk-pixbuf, wrapGAppsHook +}: + +let + mkocamlpath = p: "${p}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib"; + runtimeDeps = with ocamlPackages; [ + apron.dev + biniou + camlzip + easy-format + menhir + mlgmpidl + num + ocamlgraph + why3 + yojson + zarith + ]; + ocamlpath = lib.concatMapStringsSep ":" mkocamlpath runtimeDeps; +in + +stdenv.mkDerivation rec { + pname = "frama-c"; + version = "22.0"; + slang = "Titanium"; + + src = fetchurl { + url = "http://frama-c.com/download/frama-c-${version}-${slang}.tar.gz"; + sha256 = "1mq1fijka95ydrla486yr4w6wdl9l7vmp512s1q00b0p6lmfwmkh"; + }; + + preConfigure = lib.optionalString stdenv.cc.isClang "configureFlagsArray=(\"--with-cpp=clang -E -C\")"; + + nativeBuildInputs = [ autoconf wrapGAppsHook ]; + + buildInputs = with ocamlPackages; [ + ncurses ocaml findlib ltl2ba ocamlgraph yojson menhir camlzip + lablgtk coq graphviz zarith apron why3 mlgmpidl doxygen + gdk-pixbuf + ]; + + enableParallelBuilding = true; + + preFixup = '' + gappsWrapperArgs+=(--prefix OCAMLPATH ':' ${ocamlpath}) + ''; + + # 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 + + } + + addEnvHooks "$targetOffset" addFramaCPath + ''; + + + meta = { + 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 ]; + platforms = stdenv.lib.platforms.unix; + }; +} |