about summary refs log tree commit diff
path: root/pkgs/development/python-modules/capstone/4.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/capstone/4.nix')
-rw-r--r--pkgs/development/python-modules/capstone/4.nix35
1 files changed, 25 insertions, 10 deletions
diff --git a/pkgs/development/python-modules/capstone/4.nix b/pkgs/development/python-modules/capstone/4.nix
index 7c79cfe819428..b7c31d336091e 100644
--- a/pkgs/development/python-modules/capstone/4.nix
+++ b/pkgs/development/python-modules/capstone/4.nix
@@ -1,16 +1,26 @@
-{ lib
-, buildPythonPackage
-, capstone_4
-, stdenv
-, setuptools
-, pythonAtLeast
+{
+  lib,
+  buildPythonPackage,
+  capstone_4,
+  stdenv,
+  setuptools,
+  fetchpatch,
 }:
 
 buildPythonPackage {
   pname = "capstone";
   inherit (capstone_4) version src;
 
-  sourceRoot = "source/bindings/python";
+  sourceRoot = "${capstone_4.src.name}/bindings/python";
+  patches = [
+    # Drop distutils in python binding (PR 2271)
+    (fetchpatch {
+      name = "drop-distutils-in-python-binding.patch";
+      url = "https://github.com/capstone-engine/capstone/commit/d63211e3acb64fceb8b1c4a0d804b4b027f4ef71.patch";
+      hash = "sha256-zUGeFmm3xH5dzfPJE8nnHwqwFBrsZ7w8LBJAy20/3RI=";
+      stripLen = 2;
+    })
+  ];
 
   postPatch = ''
     ln -s ${capstone_4}/lib/libcapstone${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/
@@ -20,7 +30,10 @@ buildPythonPackage {
 
   # aarch64 only available from MacOS SDK 11 onwards, so fix the version tag.
   # otherwise, bdist_wheel may detect "macosx_10_6_arm64" which doesn't make sense.
-  setupPyBuildFlags = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ "--plat-name" "macosx_11_0" ];
+  setupPyBuildFlags = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
+    "--plat-name"
+    "macosx_11_0"
+  ];
 
   propagatedBuildInputs = [ setuptools ];
 
@@ -34,7 +47,9 @@ buildPythonPackage {
     homepage = "http://www.capstone-engine.org/";
     license = licenses.bsdOriginal;
     description = "Python bindings for Capstone disassembly engine";
-    maintainers = with maintainers; [ bennofs ris ];
-    broken = pythonAtLeast "3.12"; # uses distutils
+    maintainers = with maintainers; [
+      bennofs
+      ris
+    ];
   };
 }