summary refs log tree commit diff
path: root/pkgs/development/python-modules/capstone/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/capstone/default.nix')
-rw-r--r--pkgs/development/python-modules/capstone/default.nix38
1 files changed, 14 insertions, 24 deletions
diff --git a/pkgs/development/python-modules/capstone/default.nix b/pkgs/development/python-modules/capstone/default.nix
index 035632f9cf2..7fc0b16522e 100644
--- a/pkgs/development/python-modules/capstone/default.nix
+++ b/pkgs/development/python-modules/capstone/default.nix
@@ -3,43 +3,33 @@
 , fetchPypi
 , fetchpatch
 , setuptools
+, capstone
 }:
 
 buildPythonPackage rec {
   pname = "capstone";
-  version = "3.0.5.post1";
+  version = stdenv.lib.getVersion capstone;
 
-  setupPyBuildFlags = [
-    "--plat-name x86_64-linux"
-  ];
-
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "3c0f73db9f8392f7048c8a244809f154d7c39f354e2167f6c477630aa517ed04";
-  };
-
-  propagatedBuildInputs = [ setuptools ];
-
-  patches = [
-    (fetchpatch {
-      stripLen = 2;
-      url = "https://patch-diff.githubusercontent.com/raw/aquynh/capstone/pull/783/commits/23fe9f36622573c747e2bab6119ff245437bf276.patch";
-      sha256 = "0yizqrdlxqxn16873593kdx2vrr7gvvilhgcf9xy6hr0603d3m5r";
-    })
-  ];
+  src = capstone.src;
+  sourceRoot = "${capstone.name}/bindings/python";
 
   postPatch = ''
-    patchShebangs src/make.sh
+    ln -s ${capstone}/lib/libcapstone${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/
+    ln -s ${capstone}/lib/libcapstone.a prebuilt/
   '';
 
-  preCheck = ''
-    mv src/libcapstone.so capstone
+  propagatedBuildInputs = [ setuptools ];
+
+  checkPhase = ''
+    mv capstone capstone.hidden
+    patchShebangs test_*
+    make check
   '';
 
   meta = with stdenv.lib; {
     homepage = "http://www.capstone-engine.org/";
     license = licenses.bsdOriginal;
-    description = "Capstone disassembly engine";
-    maintainers = with maintainers; [ bennofs ];
+    description = "Python bindings for Capstone disassembly engine";
+    maintainers = with maintainers; [ bennofs ris ];
   };
 }