1{ lib 2, buildPythonPackage 3, capstone 4, stdenv 5, setuptools 6}: 7 8buildPythonPackage rec { 9 pname = "capstone"; 10 version = lib.getVersion capstone; 11 12 src = capstone.src; 13 sourceRoot = "${src.name}/bindings/python"; 14 15 postPatch = '' 16 ln -s ${capstone}/lib/libcapstone${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/ 17 ln -s ${capstone}/lib/libcapstone.a prebuilt/ 18 substituteInPlace setup.py --replace manylinux1 manylinux2014 19 ''; 20 21 # aarch64 only available from MacOS SDK 11 onwards, so fix the version tag. 22 # otherwise, bdist_wheel may detect "macosx_10_6_arm64" which doesn't make sense. 23 setupPyBuildFlags = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ "--plat-name" "macosx_11_0" ]; 24 25 propagatedBuildInputs = [ setuptools ]; 26 27 checkPhase = '' 28 mv capstone capstone.hidden 29 patchShebangs test_* 30 make check 31 ''; 32 33 meta = with lib; { 34 homepage = "http://www.capstone-engine.org/"; 35 license = licenses.bsdOriginal; 36 description = "Python bindings for Capstone disassembly engine"; 37 maintainers = with maintainers; [ bennofs ris ]; 38 }; 39}