From 79d01b2e0411ac777922d3efd84313985b0bbbd5 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Tue, 10 Jul 2018 17:09:36 -0500
Subject: [PATCH] radare2-cutter: fix build by skipping over unhelpful helper
 script :)

At least it's very much not helpful for our usage.
---
 .../tools/analysis/radare2-cutter/default.nix         | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pkgs/development/tools/analysis/radare2-cutter/default.nix b/pkgs/development/tools/analysis/radare2-cutter/default.nix
index 6a2b34210aa..a072dff007e 100644
--- a/pkgs/development/tools/analysis/radare2-cutter/default.nix
+++ b/pkgs/development/tools/analysis/radare2-cutter/default.nix
@@ -21,9 +21,20 @@ stdenv.mkDerivation rec {
 
   postUnpack = "export sourceRoot=$sourceRoot/src";
 
+  # Remove this "very helpful" helper file intended for discovering r2,
+  # as it's a doozy of harddcoded paths and unexpected behavior.
+  # Happily Nix has everything all set so we don't need it,
+  # other than as basis for the qmakeFlags set below.
+  postPatch = ''
+    substituteInPlace Cutter.pro \
+      --replace "include(lib_radare2.pri)" ""
+  '';
+
   nativeBuildInputs = [ qmake pkgconfig ];
   buildInputs = [ qtbase qtsvg qtwebengine radare2 python3 ];
 
+  qmakeFlags = [ "CONFIG+=link_pkgconfig" "PKGCONFIG+=r_core" ];
+
   enableParallelBuilding = true;
 
   meta = with stdenv.lib; {