nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 149 lines 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchurl, 6 ocaml, 7 findlib, 8 ocamlbuild, 9 ocaml_oasis, 10 bitstring, 11 camlzip, 12 cmdliner, 13 core_kernel, 14 ezjsonm, 15 fileutils, 16 jane_rope ? null, 17 mmap, 18 lwt, 19 ocamlgraph, 20 ocurl, 21 re, 22 uri, 23 zarith, 24 piqi, 25 piqi-ocaml, 26 uuidm, 27 llvm, 28 frontc, 29 ounit, 30 ppx_jane, 31 parsexp ? null, 32 utop, 33 libxml2, 34 ncurses, 35 linenoise, 36 ppx_bap, 37 ppx_bitstring, 38 yojson, 39 which, 40 makeWrapper, 41 writeText, 42 z3, 43}: 44 45stdenv.mkDerivation (finalAttrs: { 46 pname = "ocaml${ocaml.version}-bap"; 47 version = "2.5.0+pr1621"; 48 src = fetchFromGitHub { 49 owner = "BinaryAnalysisPlatform"; 50 repo = "bap"; 51 rev = "65c282d94e8b7028e8a986c637db3a2378a753f6"; 52 hash = "sha256-LUZZOgG1T8xa5jLA/fDft8ofYb/Yf6QjTrl6AlLY7H0="; 53 }; 54 55 sigs = fetchurl { 56 url = "https://github.com/BinaryAnalysisPlatform/bap/releases/download/v${finalAttrs.version}/sigs.zip"; 57 sha256 = "0d69jd28z4g64mglq94kj5imhmk5f6sgcsh9q2nij3b0arpcliwk"; 58 }; 59 60 createFindlibDestdir = true; 61 62 setupHook = writeText "setupHook.sh" '' 63 export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/ocaml${ocaml.version}-bap-${finalAttrs.version}/" 64 export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/ocaml${ocaml.version}-bap-${finalAttrs.version}-llvm-plugins/" 65 ''; 66 67 nativeBuildInputs = [ 68 which 69 makeWrapper 70 ocaml 71 findlib 72 ocamlbuild 73 ocaml_oasis 74 ]; 75 76 buildInputs = [ 77 ocamlbuild 78 linenoise 79 ounit 80 ppx_bitstring 81 z3 82 utop 83 libxml2 84 ncurses 85 ]; 86 87 propagatedBuildInputs = [ 88 bitstring 89 camlzip 90 cmdliner 91 ppx_bap 92 core_kernel 93 ezjsonm 94 fileutils 95 jane_rope 96 mmap 97 lwt 98 ocamlgraph 99 ocurl 100 re 101 uri 102 zarith 103 piqi 104 parsexp 105 piqi-ocaml 106 uuidm 107 frontc 108 yojson 109 ]; 110 111 installPhase = '' 112 runHook preInstall 113 export OCAMLPATH=$OCAMLPATH:$OCAMLFIND_DESTDIR; 114 export PATH=$PATH:$out/bin 115 export CAML_LD_LIBRARY_PATH=''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}$OCAMLFIND_DESTDIR/bap-plugin-llvm/:$OCAMLFIND_DESTDIR/bap/ 116 mkdir -p $out/lib/bap 117 make install 118 rm $out/bin/baptop 119 makeWrapper ${utop}/bin/utop $out/bin/baptop --prefix OCAMLPATH : $OCAMLPATH --prefix PATH : $PATH --add-flags "-ppx ppx-bap -short-paths -require \"bap.top\"" 120 wrapProgram $out/bin/bapbuild --prefix OCAMLPATH : $OCAMLPATH --prefix PATH : $PATH 121 ln -s $sigs $out/share/bap/sigs.zip 122 runHook postInstall 123 ''; 124 125 disableIda = "--disable-ida"; 126 disableGhidra = "--disable-ghidra"; 127 128 patches = [ 129 ./curses_is_ncurses.patch 130 ]; 131 132 preConfigure = '' 133 substituteInPlace oasis/monads --replace-warn core_kernel.rope jane_rope 134 ''; 135 136 configureFlags = [ 137 "--enable-everything ${finalAttrs.disableIda} ${finalAttrs.disableGhidra}" 138 "--with-llvm-config=${llvm.dev}/bin/llvm-config" 139 ]; 140 141 meta = { 142 description = "Platform for binary analysis. It is written in OCaml, but can be used from other languages"; 143 homepage = "https://github.com/BinaryAnalysisPlatform/bap/"; 144 license = lib.licenses.mit; 145 maintainers = [ lib.maintainers.maurer ]; 146 mainProgram = "bap"; 147 broken = lib.versionOlder ocaml.version "4.08"; 148 }; 149})