2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2023-02-02 18:25:31 +00:00
|
|
|
, callPackage
|
2021-12-06 16:07:01 +00:00
|
|
|
, cmake
|
2023-02-02 18:25:31 +00:00
|
|
|
, python3
|
2021-12-06 16:07:01 +00:00
|
|
|
}:
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
let
|
|
|
|
zycore = callPackage ./zycore.nix {
|
|
|
|
inherit stdenv fetchFromGitHub cmake;
|
|
|
|
};
|
|
|
|
in
|
2021-02-05 17:12:51 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "zydis";
|
2022-12-02 08:20:57 +00:00
|
|
|
version = "4.0.0";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zyantific";
|
|
|
|
repo = "zydis";
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = "v${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-/no/8FNa5LlwhZMSMao4/cwZk6GlamLjqr+isbh6tEI=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ zycore ];
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DZYAN_SYSTEM_ZYCORE=ON"
|
|
|
|
"-DCMAKE_INSTALL_LIBDIR=lib"
|
|
|
|
"-DCMAKE_INSTALL_INCLUDEDIR=include"
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
doCheck = true;
|
|
|
|
nativeCheckInputs = [ python3 ];
|
|
|
|
checkPhase = ''
|
|
|
|
pushd ../tests
|
|
|
|
python3 ./regression.py test ../build/ZydisInfo
|
|
|
|
python3 ./regression_encoder.py \
|
|
|
|
../build/Zydis{Fuzz{ReEncoding,Encoder},TestEncoderAbsolute}
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = { inherit zycore; };
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-12-06 16:07:01 +00:00
|
|
|
homepage = "https://zydis.re/";
|
2021-02-05 17:12:51 +00:00
|
|
|
description = "Fast and lightweight x86/x86-64 disassembler library";
|
|
|
|
license = licenses.mit;
|
2023-02-02 18:25:31 +00:00
|
|
|
maintainers = with maintainers; [ jbcrail AndersonTorres athre0z ];
|
2021-02-05 17:12:51 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|