diff --git a/pkgs/development/tools/analysis/radare2/default.nix b/pkgs/development/tools/analysis/radare2/default.nix index 0d4b55bb472..1572fff40b9 100644 --- a/pkgs/development/tools/analysis/radare2/default.nix +++ b/pkgs/development/tools/analysis/radare2/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, pkgconfig, libusb, readline, libewf, perl, zlib, openssl, +{stdenv, fetchFromGitHub, fetchurl, pkgconfig, libusb, readline, libewf, perl, zlib, openssl, gtk2 ? null, vte ? null, gtkdialog ? null, python ? null, ruby ? null, @@ -10,17 +10,35 @@ assert rubyBindings -> ruby != null; assert pythonBindings -> python != null; let - optional = stdenv.lib.optional; + inherit (stdenv.lib) optional; in stdenv.mkDerivation rec { - version = "1.4.0"; + version = "1.6.0"; name = "radare2-${version}"; - src = fetchurl { - url = "http://cloud.radare.org/get/${version}/${name}.tar.gz"; - sha256 = "bf6e9ad94fd5828d3936563b8b13218433fbf44231cacfdf37a7312ae2b3e93e"; + src = fetchFromGitHub { + owner = "radare"; + repo = "radare2"; + rev = version; + sha256 = "0kb7y0b5kw2p1kxpzjgc8pnwdkqyzkijzp5d2a9zs2ira96668zd"; }; + postPatch = let + cs_ver = "3.0.4"; # version from $sourceRoot/shlr/Makefile + capstone = fetchurl { + url = "https://github.com/aquynh/capstone/archive/${cs_ver}.tar.gz"; + sha256 = "1whl5c8j6vqvz2j6ay2pyszx0jg8d3x8hq66cvgghmjchvsssvax"; + }; + in '' + if ! grep -F "CS_VER=${cs_ver}" shlr/Makefile; then echo "CS_VER mismatch"; exit 1; fi + substituteInPlace shlr/Makefile --replace CS_RELEASE=0 CS_RELEASE=1 + cp ${capstone} shlr/capstone-${cs_ver}.tar.gz + + # make compiler happy (fixed in upstream 2017-08-11) + substituteInPlace libr/asm/arch/hexagon/gnu/hexagon-dis.c --replace \ + '(*info->fprintf_func) (info->stream, errmsg);' \ + '(*info->fprintf_func) (info->stream, "%s", errmsg);' + ''; buildInputs = [pkgconfig readline libusb libewf perl zlib openssl] ++ optional useX11 [gtkdialog vte gtk2] @@ -28,6 +46,13 @@ stdenv.mkDerivation rec { ++ optional pythonBindings [python] ++ optional luaBindings [lua]; + postInstall = '' + # replace symlinks pointing into the build directory with the files they point to + rm $out/bin/{r2-docker,r2-indent} + cp sys/r2-docker.sh $out/bin/r2-docker + cp sys/indent.sh $out/bin/r2-indent + ''; + meta = { description = "unix-like reverse engineering framework and commandline tools"; homepage = http://radare.org/;