<commit_before>{stdenv, fetchFromGitHub, fetchurl, fetchpatch, pkgconfig, libusb, readline, libewf, perl, zlib, openssl,
gtk2 ? null, vte ? null, gtkdialog ? null,
python ? null,
ruby ? null,
lua ? null,
useX11, rubyBindings, pythonBindings, luaBindings}:

assert useX11 -> (gtk2 != null && vte != null && gtkdialog != null);
assert rubyBindings -> ruby != null;
assert pythonBindings -> python != null;

let
  inherit (stdenv.lib) optional;
in
stdenv.mkDerivation rec {
  version = "2.3.0";
  name = "radare2-${version}";

  src = fetchFromGitHub {
    owner = "radare";
    repo = "radare2";
    rev = version;
    sha256 = "0x5vcprqf0fnj876mdvryfvg7ymbrw1cxrr7a06v0swg7yql1lpw";
  };

  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

  '';

  enableParallelBuilding = true;

  nativeBuildInputs = [ pkgconfig ];<commit_msg>radare2: use capstone rev used by default, not release from 2015.<commit_after>{stdenv, fetchFromGitHub, fetchgit, fetchurl, fetchpatch, pkgconfig, libusb, readline, libewf, perl, zlib, openssl, git,
gtk2 ? null, vte ? null, gtkdialog ? null,
python ? null,
ruby ? null,
lua ? null,
useX11, rubyBindings, pythonBindings, luaBindings}:

assert useX11 -> (gtk2 != null && vte != null && gtkdialog != null);
assert rubyBindings -> ruby != null;
assert pythonBindings -> python != null;

let
  inherit (stdenv.lib) optional;
in
stdenv.mkDerivation rec {
  version = "2.3.0";
  name = "radare2-${version}";

  src = fetchFromGitHub {
    owner = "radare";
    repo = "radare2";
    rev = version;
    sha256 = "0x5vcprqf0fnj876mdvryfvg7ymbrw1cxrr7a06v0swg7yql1lpw";
  };

  postPatch = let
    cs_tip = "bdbc57de63725a98732ddc34b48de96f8ada66f2"; # version from $sourceRoot/shlr/Makefile
    capstone = fetchgit {
      url = "https://github.com/aquynh/capstone.git";
      rev = cs_tip;
      sha256 = "1sqxpjf2dlrg87dm9p39p5d1qzahrnfnrjijpv1xg1shax439jni";
      leaveDotGit = true;
    };
  in ''
    if ! grep -F "CS_TIP=${cs_tip}" shlr/Makefile; then echo "CS_TIP mismatch"; exit 1; fi
    cp -r ${capstone} shlr/capstone
    chmod -R u+rw shlr/capstone
  '';

  enableParallelBuilding = true;

  nativeBuildInputs = [ pkgconfig git ];
{'fraction_non_alphanumeric': 0.1295296838858905, 'fraction_numerical': 0.04741711642251349, 'mean_word_length': 3.9334600760456273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6032188', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1009, 'n_words': 221}