summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/bap
diff options
context:
space:
mode:
authorMatthew Maurer <matthew.r.maurer@gmail.com>2017-01-25 02:08:03 -0500
committerMatthew Maurer <matthew.r.maurer@gmail.com>2017-04-04 13:11:01 -0400
commit7171d16fd40ed53b29ef11125f23f0f68f672f51 (patch)
tree5aaf2bce8ab6b81b642099ebd7a5cfa9bb42fb0c /pkgs/development/ocaml-modules/bap
parent9f34d1f19a34771b493d3bd5e3361a127bc10c98 (diff)
downloadnixlib-7171d16fd40ed53b29ef11125f23f0f68f672f51.tar
nixlib-7171d16fd40ed53b29ef11125f23f0f68f672f51.tar.gz
nixlib-7171d16fd40ed53b29ef11125f23f0f68f672f51.tar.bz2
nixlib-7171d16fd40ed53b29ef11125f23f0f68f672f51.tar.lz
nixlib-7171d16fd40ed53b29ef11125f23f0f68f672f51.tar.xz
nixlib-7171d16fd40ed53b29ef11125f23f0f68f672f51.tar.zst
nixlib-7171d16fd40ed53b29ef11125f23f0f68f672f51.zip
bap: init at 1.2.0
Diffstat (limited to 'pkgs/development/ocaml-modules/bap')
-rw-r--r--pkgs/development/ocaml-modules/bap/default.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix
new file mode 100644
index 000000000000..25564a0a3009
--- /dev/null
+++ b/pkgs/development/ocaml-modules/bap/default.nix
@@ -0,0 +1,62 @@
+{stdenv, buildOcaml, fetchFromGitHub, fetchurl, camlp4, ocaml_oasis, bitstring, camlzip, cmdliner, core_kernel, ezjsonm, faillib, fileutils, ocaml_lwt, ocamlgraph, ocurl, re, uri, zarith, piqi, piqi-ocaml, uuidm, llvm_38, ulex, easy-format, xmlm, frontc, ounit, utop, which, makeWrapper, writeText, ocaml}:
+
+buildOcaml rec {
+  name = "bap";
+  version = "1.2.0";
+  src = fetchFromGitHub {
+    owner = "BinaryAnalysisPlatform";
+    repo = "bap";
+    rev = "v${version}";
+    sha256 = "0dn1gvj73pma0rsw8r50cmjddibnf42w1kbskb2vpzq0kb79jlkw";
+  };
+
+  sigs = fetchurl {
+     url = "https://github.com/BinaryAnalysisPlatform/bap/releases/download/v${version}/sigs.zip";
+     sha256 = "0mpsq2pinbrynlisnh8j3nrlamlsls7lza0bkqnm9szqjjdmcgfn";
+  };
+
+  createFindlibDestdir = true;
+
+  setupHook = writeText "setupHook.sh" ''
+    export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/"
+    export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}-llvm-plugins/"
+  '';
+
+  nativeBuildInputs = [ which makeWrapper ];
+
+  buildInputs = [ ocaml_oasis
+                  llvm_38
+                  utop ];
+
+  propagatedBuildInputs = [ bitstring camlzip cmdliner core_kernel ezjsonm faillib fileutils ocaml_lwt ocamlgraph ocurl re uri zarith piqi
+                            piqi-ocaml uuidm frontc ounit ];
+
+  installPhase = ''
+    export OCAMLPATH=$OCAMLPATH:$OCAMLFIND_DESTDIR;
+    export PATH=$PATH:$out/bin
+    export CAML_LD_LIBRARY_PATH=$CAML_LD_LIBRARY_PATH:$OCAMLFIND_DESTDIR/bap-plugin-llvm/:$OCAMLFIND_DESTDIR/bap/
+    mkdir -p $out/lib/bap
+    make install
+    rm $out/bin/baptop
+    makeWrapper ${utop}/bin/utop $out/bin/baptop --prefix OCAMLPATH : $OCAMLPATH --prefix PATH : $PATH --add-flags "-ppx ppx-bap -short-paths -require \"bap.top\""
+    wrapProgram $out/bin/bapbuild --prefix OCAMLPATH : $OCAMLPATH --prefix PATH : $PATH
+    ln -s $sigs $out/share/bap/sigs.zip
+  '';
+
+  disableIda = "--disable-ida --disable-fsi-benchmark";
+
+  doCheck = true;
+
+  checkTarget = "check test";
+
+  configureFlags = "--enable-everything --enable-tests ${disableIda} --with-llvm-config=${llvm_38}/bin/llvm-config";
+
+  BAPBUILDFLAGS = "-j $(NIX_BUILD_CORES)";
+
+  meta = with stdenv.lib; {
+    description = "Platform for binary analysis. It is written in OCaml, but can be used from other languages.";
+    homepage = https://github.com/BinaryAnalysisPlatform/bap/;
+    maintainers = [ maintainers.maurer ];
+    license = licenses.mit;
+  };
+}