2020-04-24 23:36:52 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper, writeText
|
2023-03-04 12:14:45 +00:00
|
|
|
, graphviz, doxygen
|
2020-11-09 15:59:12 +00:00
|
|
|
, ocamlPackages, ltl2ba, coq, why3
|
|
|
|
, gdk-pixbuf, wrapGAppsHook
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
mkocamlpath = p: "${p}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib";
|
|
|
|
runtimeDeps = with ocamlPackages; [
|
2020-11-30 08:33:03 +00:00
|
|
|
apron.dev
|
2022-11-27 09:42:12 +00:00
|
|
|
bigarray-compat
|
2020-04-24 23:36:52 +00:00
|
|
|
biniou
|
|
|
|
camlzip
|
|
|
|
easy-format
|
2021-06-06 07:54:09 +00:00
|
|
|
menhirLib
|
2020-04-24 23:36:52 +00:00
|
|
|
mlgmpidl
|
|
|
|
num
|
|
|
|
ocamlgraph
|
2022-07-14 12:49:19 +00:00
|
|
|
ppx_deriving
|
2023-03-04 12:14:45 +00:00
|
|
|
ppx_deriving_yojson
|
2022-07-14 12:49:19 +00:00
|
|
|
ppx_import
|
2021-06-28 23:13:55 +00:00
|
|
|
stdlib-shims
|
2020-04-24 23:36:52 +00:00
|
|
|
why3
|
2021-06-28 23:13:55 +00:00
|
|
|
re
|
2022-07-14 12:49:19 +00:00
|
|
|
result
|
2021-06-28 23:13:55 +00:00
|
|
|
seq
|
|
|
|
sexplib
|
|
|
|
sexplib0
|
|
|
|
parsexp
|
|
|
|
base
|
2020-04-24 23:36:52 +00:00
|
|
|
yojson
|
|
|
|
zarith
|
|
|
|
];
|
|
|
|
ocamlpath = lib.concatMapStringsSep ":" mkocamlpath runtimeDeps;
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "frama-c";
|
2023-03-04 12:14:45 +00:00
|
|
|
version = "26.1";
|
|
|
|
slang = "Iron";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-03-04 12:14:45 +00:00
|
|
|
url = "https://frama-c.com/download/frama-c-${version}-${slang}.tar.gz";
|
|
|
|
hash = "sha256-UT7ajIyu8e5vzrz2oBKDDrtZqUacgUP/TRi0/kz9Qkg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
postConfigure = "patchShebangs src/plugins/eva/gen-api.sh";
|
2022-07-14 12:49:19 +00:00
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
nativeBuildInputs = [ wrapGAppsHook ] ++ (with ocamlPackages; [ ocaml findlib dune_3 ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = with ocamlPackages; [
|
2023-03-04 12:14:45 +00:00
|
|
|
dune-site dune-configurator
|
|
|
|
ltl2ba ocamlgraph yojson menhirLib camlzip
|
2022-01-25 03:21:06 +00:00
|
|
|
lablgtk3 lablgtk3-sourceview3 coq graphviz zarith apron why3 mlgmpidl doxygen
|
2023-03-04 12:14:45 +00:00
|
|
|
ppx_deriving ppx_import ppx_deriving_yojson
|
2020-11-09 15:59:12 +00:00
|
|
|
gdk-pixbuf
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
dune build -j$NIX_BUILD_CORES --release @install
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installFlags = [ "PREFIX=$(out)" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-09 15:59:12 +00:00
|
|
|
preFixup = ''
|
2023-03-04 12:14:45 +00:00
|
|
|
gappsWrapperArgs+=(--prefix OCAMLPATH ':' ${ocamlpath}:$out/lib/)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Allow loading of external Frama-C plugins
|
|
|
|
setupHook = writeText "setupHook.sh" ''
|
|
|
|
addFramaCPath () {
|
|
|
|
if test -d "''$1/lib/frama-c/plugins"; then
|
2020-11-09 15:59:12 +00:00
|
|
|
export FRAMAC_PLUGIN="''${FRAMAC_PLUGIN-}''${FRAMAC_PLUGIN:+:}''$1/lib/frama-c/plugins"
|
|
|
|
export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/frama-c/plugins"
|
2020-04-24 23:36:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -d "''$1/lib/frama-c"; then
|
2020-11-09 15:59:12 +00:00
|
|
|
export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/frama-c"
|
2020-04-24 23:36:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -d "''$1/share/frama-c/"; then
|
2020-11-09 15:59:12 +00:00
|
|
|
export FRAMAC_EXTRA_SHARE="''${FRAMAC_EXTRA_SHARE-}''${FRAMAC_EXTRA_SHARE:+:}''$1/share/frama-c"
|
2020-04-24 23:36:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
addEnvHooks "$targetOffset" addFramaCPath
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "An extensible and collaborative platform dedicated to source-code analysis of C software";
|
|
|
|
homepage = "http://frama-c.com/";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.lgpl21;
|
|
|
|
maintainers = with lib.maintainers; [ thoughtpolice amiddelk ];
|
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|