1{stdenv, fetchFromGitHub, fetchgit, fetchurl, fetchpatch, pkgconfig, libusb, readline, libewf, perl, zlib, openssl, git,
2gtk2 ? null, vte ? null, gtkdialog ? null,
3python ? null,
4ruby ? null,
5lua ? null,
6useX11, rubyBindings, pythonBindings, luaBindings}:
7
8assert useX11 -> (gtk2 != null && vte != null && gtkdialog != null);
9assert rubyBindings -> ruby != null;
10assert pythonBindings -> python != null;
11
12let
13 inherit (stdenv.lib) optional;
14in
15stdenv.mkDerivation rec {
16 version = "2.3.0";
17 name = "radare2-${version}";
18
19 src = fetchFromGitHub {
20 owner = "radare";
21 repo = "radare2";
22 rev = version;
23 sha256 = "0x5vcprqf0fnj876mdvryfvg7ymbrw1cxrr7a06v0swg7yql1lpw";
24 };
25
26 postPatch = let
27 cs_tip = "bdbc57de63725a98732ddc34b48de96f8ada66f2"; # version from $sourceRoot/shlr/Makefile
28 capstone = fetchgit {
29 url = "https://github.com/aquynh/capstone.git";
30 rev = cs_tip;
31 sha256 = "1sqxpjf2dlrg87dm9p39p5d1qzahrnfnrjijpv1xg1shax439jni";
32 leaveDotGit = true;
33 };
34 in ''
35 if ! grep -F "CS_TIP=${cs_tip}" shlr/Makefile; then echo "CS_TIP mismatch"; exit 1; fi
36 cp -r ${capstone} shlr/capstone
37 chmod -R u+rw shlr/capstone
38 '';
39
40 enableParallelBuilding = true;
41
42 nativeBuildInputs = [ pkgconfig git ];
43 buildInputs = [ readline libusb libewf perl zlib openssl]
44 ++ optional useX11 [gtkdialog vte gtk2]
45 ++ optional rubyBindings [ruby]
46 ++ optional pythonBindings [python]
47 ++ optional luaBindings [lua];
48
49 meta = {
50 description = "unix-like reverse engineering framework and commandline tools";
51 homepage = http://radare.org/;
52 license = stdenv.lib.licenses.gpl2Plus;
53 maintainers = with stdenv.lib.maintainers; [raskin makefu];
54 platforms = with stdenv.lib.platforms; linux;
55 inherit version;
56 };
57}