From 7171d16fd40ed53b29ef11125f23f0f68f672f51 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Wed, 25 Jan 2017 02:08:03 -0500 Subject: [PATCH 1/3] bap: init at 1.2.0 --- .../development/ocaml-modules/bap/default.nix | 62 +++++++++++++++++++ pkgs/top-level/ocaml-packages.nix | 2 + 2 files changed, 64 insertions(+) create mode 100644 pkgs/development/ocaml-modules/bap/default.nix diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix new file mode 100644 index 00000000000..25564a0a300 --- /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; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 232f1331865..cf2b676a5d4 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -51,6 +51,8 @@ let base64 = callPackage ../development/ocaml-modules/base64 { }; + bap = callPackage ../development/ocaml-modules/bap { }; + bitstring = callPackage ../development/ocaml-modules/bitstring { }; bolt = callPackage ../development/ocaml-modules/bolt { }; From d022b4419cc2f4528203b8840ee2f9481344e55e Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Wed, 25 Jan 2017 02:14:40 -0500 Subject: [PATCH 2/3] bap-python: init at 1.1.0 --- .../python-modules/bap/default.nix | 23 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 4 ++++ 2 files changed, 27 insertions(+) create mode 100644 pkgs/development/python-modules/bap/default.nix diff --git a/pkgs/development/python-modules/bap/default.nix b/pkgs/development/python-modules/bap/default.nix new file mode 100644 index 00000000000..9362729af44 --- /dev/null +++ b/pkgs/development/python-modules/bap/default.nix @@ -0,0 +1,23 @@ +{stdenv, buildPythonPackage, fetchFromGitHub, bap, requests}: + +buildPythonPackage rec { + name = "bap"; + version = "1.1.0"; + src = fetchFromGitHub { + owner = "BinaryAnalysisPlatform"; + repo = "bap-python"; + rev = "v${version}"; + sha256 = "0wd46ksxscgb2dci69sbndzxs6drq5cahraqq42cdk114hkrsxs3"; + }; + + propagatedBuildInputs = [bap requests]; + + doCheck = false; + + 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; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5bb2b28d001..22a3f56a6d4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -175,6 +175,10 @@ in { # packages defined elsewhere + bap = callPackage ../development/python-modules/bap { + bap = pkgs.ocamlPackages_4_02.bap; + }; + blivet = callPackage ../development/python-modules/blivet { }; breathe = callPackage ../development/python-modules/breathe { }; From e010c25ba41a09787168afd4c343ad49a8515f56 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Wed, 25 Jan 2017 02:18:06 -0500 Subject: [PATCH 3/3] libbap: init at master-2017-02-08 --- pkgs/development/libraries/libbap/default.nix | 29 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +++ 2 files changed, 33 insertions(+) create mode 100644 pkgs/development/libraries/libbap/default.nix diff --git a/pkgs/development/libraries/libbap/default.nix b/pkgs/development/libraries/libbap/default.nix new file mode 100644 index 00000000000..83bd81456c0 --- /dev/null +++ b/pkgs/development/libraries/libbap/default.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchFromGitHub, bap, ocaml, findlib, ctypes, autoreconfHook, + which }: + +stdenv.mkDerivation rec { + name = "libbap-${version}"; + version = "master-2017-02-08"; + + src = fetchFromGitHub { + owner = "BinaryAnalysisPlatform"; + repo = "bap-bindings"; + rev = "b3da5bd5cdb3d646015ccdeb886b5ea8fd85a108"; + sha256 = "0cwfyfpxbi9bm4kkpamyd7mgsm5b6j1rh217fqb5gi05wg45rkbb"; + }; + + nativeBuildInputs = [ autoreconfHook which ]; + buildInputs = [ ocaml bap findlib ctypes ]; + + preInstall = '' + mkdir -p $out/lib + mkdir -p $out/include + ''; + + meta = { + homepage = http://github.com/binaryanalysisplatform/bap-bindings; + description = "A C library for interacting with BAP"; + maintainers = [ stdenv.lib.maintainers.maurer ]; + platforms = stdenv.lib.platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1fb20dab34d..665e78c004c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8079,6 +8079,10 @@ with pkgs; libb2 = callPackage ../development/libraries/libb2 { }; + libbap = callPackage ../development/libraries/libbap { + inherit (ocamlPackages_4_02) bap ocaml findlib ctypes; + }; + libbluedevil = callPackage ../development/libraries/libbluedevil { }; libbdplus = callPackage ../development/libraries/libbdplus { };