mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-11-27 08:20:13 +00:00
26.11 no longer supports x86_64-darwin. Hence: - simplify: darwin && aarch64 -> darwin - remove: darwin && x86_64 Assisted-by: Codex, GPT-6.1-Sol medium
54 lines
1.4 KiB
Nix
54 lines
1.4 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
capstone,
|
|
stdenv,
|
|
setuptools,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "capstone";
|
|
version = lib.getVersion capstone;
|
|
pyproject = true;
|
|
|
|
src = capstone.src;
|
|
sourceRoot = "${src.name}/bindings/python";
|
|
|
|
# libcapstone.a is not built with BUILD_SHARED_LIBS. For some reason setup.py
|
|
# checks if it exists but it is not really needed. Most likely a bug in setup.py.
|
|
postPatch = ''
|
|
ln -s ${capstone}/lib/libcapstone${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/
|
|
touch prebuilt/libcapstone${stdenv.targetPlatform.extensions.staticLibrary}
|
|
substituteInPlace setup.py --replace manylinux1 manylinux2014
|
|
'';
|
|
|
|
# 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.hostPlatform.isDarwin [
|
|
"--plat-name"
|
|
"macosx_11_0"
|
|
];
|
|
|
|
build-system = [ setuptools ];
|
|
|
|
dependencies = [ setuptools ];
|
|
|
|
checkPhase = ''
|
|
mv capstone capstone.hidden
|
|
pushd tests
|
|
patchShebangs test_*
|
|
make -f ../Makefile check
|
|
popd
|
|
'';
|
|
|
|
meta = {
|
|
description = "Python bindings for Capstone disassembly engine";
|
|
homepage = "http://www.capstone-engine.org/";
|
|
license = lib.licenses.bsdOriginal;
|
|
maintainers = with lib.maintainers; [
|
|
bennofs
|
|
ris
|
|
];
|
|
};
|
|
}
|