about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/zydis/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/zydis/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/zydis/default.nix34
1 files changed, 28 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/development/libraries/zydis/default.nix b/nixpkgs/pkgs/development/libraries/zydis/default.nix
index 7009123a4528..e889d92273ef 100644
--- a/nixpkgs/pkgs/development/libraries/zydis/default.nix
+++ b/nixpkgs/pkgs/development/libraries/zydis/default.nix
@@ -1,30 +1,52 @@
 { lib
 , stdenv
 , fetchFromGitHub
+, callPackage
 , cmake
+, python3
 }:
 
+let
+  zycore = callPackage ./zycore.nix {
+    inherit stdenv fetchFromGitHub cmake;
+  };
+in
 stdenv.mkDerivation rec {
   pname = "zydis";
-  version = "3.2.1";
+  version = "4.0.0";
 
   src = fetchFromGitHub {
     owner = "zyantific";
     repo = "zydis";
     rev = "v${version}";
-    fetchSubmodules = true;
-    sha256 = "sha256-FB7hGQ9vI3ZE376iROEpdtZm91IiccBhtAFa94JgnUY=";
+    hash = "sha256-/no/8FNa5LlwhZMSMao4/cwZk6GlamLjqr+isbh6tEI=";
   };
 
-  nativeBuildInputs = [
-    cmake
+  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 ];
+    maintainers = with maintainers; [ jbcrail AndersonTorres athre0z ];
     platforms = platforms.all;
   };
 }