diff --git a/pkgs/development/tools/analysis/radare2/default.nix b/pkgs/development/tools/analysis/radare2/default.nix index 1622c6168606..cdade7c273cc 100644 --- a/pkgs/development/tools/analysis/radare2/default.nix +++ b/pkgs/development/tools/analysis/radare2/default.nix @@ -1,4 +1,5 @@ { lib +, fetchpatch , stdenv , fetchFromGitHub , buildPackages @@ -19,6 +20,7 @@ , python3 , ruby , lua +, capstone , useX11 ? false , rubyBindings ? false , pythonBindings ? false @@ -30,13 +32,11 @@ let # # DO NOT EDIT! Automatically generated by ./update.py - gittap = "5.1.1"; - gittip = "a86f8077fc148abd6443384362a3717cd4310e64"; - rev = "5.1.1"; - version = "5.1.1"; - sha256 = "0hv9x31iabasj12g8f04incr1rbcdkxi3xnqn3ggp8gl4h6pf2f3"; - cs_ver = "4.0.2"; - cs_sha256 = "0y5g74yjyliciawpn16zhdwya7bd3d7b1cccpcccc2wg8vni1k2w"; + gittap = "5.2.0"; + gittip = "cf3db945083fb4dab951874e5ec1283128deab11"; + rev = "5.2.0"; + version = "5.2.0"; + sha256 = "08azxfk6mw2vr0x4zbz0612rk7pj4mfz8shrzc9ima77wb52b8sm"; # in stdenv.mkDerivation { @@ -49,22 +49,13 @@ stdenv.mkDerivation { inherit rev sha256; }; - postPatch = - let - capstone = fetchFromGitHub { - owner = "aquynh"; - repo = "capstone"; - # version from $sourceRoot/shlr/Makefile - rev = cs_ver; - sha256 = cs_sha256; - }; - in - '' - mkdir -p build/shlr - cp -r ${capstone} capstone-${cs_ver} - chmod -R +w capstone-${cs_ver} - tar -czvf shlr/capstone-${cs_ver}.tar.gz capstone-${cs_ver} - ''; + patches = [ + # fix build against openssl, included in next release + (fetchpatch { + url = "https://github.com/radareorg/radare2/commit/e5e7469b6450c374e0884d35d44824e1a4eb46b4.patch"; + sha256 = "sha256-xTmMHvUdW7d2QG7d4hlvMgEcegND7pGU745TWGqzY44="; + }) + ]; postInstall = '' install -D -m755 $src/binr/r2pm/r2pm $out/bin/r2pm @@ -80,6 +71,7 @@ stdenv.mkDerivation { "--with-sysmagic" "--with-syszip" "--with-sysxxhash" + "--with-syscapstone" "--with-openssl" ]; @@ -87,8 +79,17 @@ stdenv.mkDerivation { depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ file readline libusb-compat-0_1 libewf perl zlib openssl libuv ] - ++ optional useX11 [ gtkdialog vte gtk2 ] + buildInputs = [ + capstone + file + readline + libusb-compat-0_1 + libewf + perl + zlib + openssl + libuv + ] ++ optional useX11 [ gtkdialog vte gtk2 ] ++ optional rubyBindings [ ruby ] ++ optional pythonBindings [ python3 ] ++ optional luaBindings [ lua ]; diff --git a/pkgs/development/tools/analysis/radare2/update.py b/pkgs/development/tools/analysis/radare2/update.py index a860d226df27..e1dfc071cd38 100755 --- a/pkgs/development/tools/analysis/radare2/update.py +++ b/pkgs/development/tools/analysis/radare2/update.py @@ -55,24 +55,12 @@ def git(dirname: str, *args: str) -> str: def get_repo_info(dirname: str, rev: str) -> Dict[str, str]: sha256 = prefetch_github("radare", "radare2", rev) - cs_ver = None - with open(Path(dirname).joinpath("shlr", "Makefile")) as makefile: - for l in makefile: - match = re.match("CS_VER=(\S+)", l) - if match: - cs_ver = match.group(1) - assert cs_ver is not None - - cs_sha256 = prefetch_github("aquynh", "capstone", cs_ver) - return dict( rev=rev, sha256=sha256, version_commit=git(dirname, "rev-list", "--all", "--count"), gittap=git(dirname, "describe", "--tags", "--match", "[0-9]*"), gittip=git(dirname, "rev-parse", "HEAD"), - cs_ver=cs_ver, - cs_sha256=cs_sha256, ) @@ -107,8 +95,6 @@ def main() -> None: rev = "{info["rev"]}"; version = "{version}"; sha256 = "{info["sha256"]}"; - cs_ver = "{info["cs_ver"]}"; - cs_sha256 = "{info["cs_sha256"]}"; #""" ) elif "#" in l: