2021-11-09 23:58:09 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, setuptools
|
|
|
|
, unicorn-emu
|
|
|
|
}:
|
2017-09-10 14:19:41 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "unicorn";
|
2021-01-24 01:29:22 +01:00
|
|
|
version = lib.getVersion unicorn-emu;
|
2021-11-09 23:58:09 +01:00
|
|
|
format = "setuptools";
|
2017-09-10 14:19:41 +01:00
|
|
|
|
2019-12-31 21:24:13 +00:00
|
|
|
src = unicorn-emu.src;
|
2021-11-09 23:58:09 +01:00
|
|
|
|
2020-10-29 19:22:04 +01:00
|
|
|
sourceRoot = "source/bindings/python";
|
2017-09-10 14:19:41 +01:00
|
|
|
|
2019-12-31 21:24:13 +00:00
|
|
|
prePatch = ''
|
|
|
|
ln -s ${unicorn-emu}/lib/libunicorn${stdenv.targetPlatform.extensions.sharedLibrary} prebuilt/
|
|
|
|
ln -s ${unicorn-emu}/lib/libunicorn.a prebuilt/
|
|
|
|
'';
|
2017-09-10 14:19:41 +01:00
|
|
|
|
2021-11-14 17:24:38 +00:00
|
|
|
# needed on non-x86 linux
|
|
|
|
setupPyBuildFlags = lib.optionals stdenv.isLinux [ "--plat-name" "linux" ];
|
|
|
|
|
2021-11-09 23:58:09 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2021-11-14 17:24:20 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
mv unicorn unicorn.hidden
|
|
|
|
patchShebangs sample_*.py shellcode.py
|
|
|
|
sh -e sample_all.sh
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-11-14 17:24:38 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"unicorn"
|
|
|
|
];
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-12-31 21:24:13 +00:00
|
|
|
description = "Python bindings for Unicorn CPU emulator engine";
|
2020-10-02 09:58:50 +02:00
|
|
|
homepage = "https://www.unicorn-engine.org/";
|
2021-11-09 23:58:09 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2019-12-31 21:24:13 +00:00
|
|
|
maintainers = with maintainers; [ bennofs ris ];
|
2017-09-10 14:19:41 +01:00
|
|
|
};
|
|
|
|
}
|