summary refs log tree commit diff
path: root/pkgs/development/libraries/zydis/default.nix
blob: e889d92273efca47e27a17be91a23943c8f976eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ lib
, stdenv
, fetchFromGitHub
, callPackage
, cmake
, python3
}:

let
  zycore = callPackage ./zycore.nix {
    inherit stdenv fetchFromGitHub cmake;
  };
in
stdenv.mkDerivation rec {
  pname = "zydis";
  version = "4.0.0";

  src = fetchFromGitHub {
    owner = "zyantific";
    repo = "zydis";
    rev = "v${version}";
    hash = "sha256-/no/8FNa5LlwhZMSMao4/cwZk6GlamLjqr+isbh6tEI=";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ zycore ];
  cmakeFlags = [
    "-DZYAN_SYSTEM_ZYCORE=ON"
    "-DCMAKE_INSTALL_LIBDIR=lib"
    "-DCMAKE_INSTALL_INCLUDEDIR=include"
  ];

  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; };

  meta = with lib; {
    homepage = "https://zydis.re/";
    description = "Fast and lightweight x86/x86-64 disassembler library";
    license = licenses.mit;
    maintainers = with maintainers; [ jbcrail AndersonTorres athre0z ];
    platforms = platforms.all;
  };
}