at 24.11-pre 1.2 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 setuptools, 6 unicorn-emu, 7}: 8 9buildPythonPackage rec { 10 pname = "unicorn"; 11 version = lib.getVersion unicorn-emu; 12 format = "setuptools"; 13 14 src = unicorn-emu.src; 15 16 sourceRoot = "${src.name}/bindings/python"; 17 18 prePatch = '' 19 ln -s ${unicorn-emu}/lib/libunicorn.* prebuilt/ 20 ''; 21 22 # needed on non-x86 linux 23 setupPyBuildFlags = 24 lib.optionals stdenv.isLinux [ 25 "--plat-name" 26 "linux" 27 ] 28 # aarch64 only available from MacOS SDK 11 onwards, so fix the version tag. 29 # otherwise, bdist_wheel may detect "macosx_10_6_arm64" which doesn't make sense. 30 ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ 31 "--plat-name" 32 "macosx_11_0" 33 ]; 34 35 propagatedBuildInputs = [ setuptools ]; 36 37 checkPhase = '' 38 runHook preCheck 39 40 mv unicorn unicorn.hidden 41 patchShebangs sample_*.py shellcode.py 42 sh -e sample_all.sh 43 44 runHook postCheck 45 ''; 46 47 pythonImportsCheck = [ "unicorn" ]; 48 49 meta = with lib; { 50 description = "Python bindings for Unicorn CPU emulator engine"; 51 homepage = "https://www.unicorn-engine.org/"; 52 license = licenses.gpl2Plus; 53 maintainers = with maintainers; [ 54 bennofs 55 ris 56 ]; 57 }; 58}