capstone: build with cmake

This commit is contained in:
Nick Cao 2023-06-15 22:03:10 +08:00
parent 905c6263e0
commit 19d28fc464
No known key found for this signature in database

View file

@ -1,7 +1,7 @@
{ lib
, stdenv
, cmake
, fetchFromGitHub
, pkg-config
, fixDarwinDylibNames
}:
@ -16,31 +16,13 @@ stdenv.mkDerivation rec {
sha256 = "sha256-XMwQ7UaPC8YYu4yxsE4bbR3leYPfBHu5iixSLz05r3g=";
};
# replace faulty macos detection
postPatch = lib.optionalString stdenv.isDarwin ''
sed -i 's/^IS_APPLE := .*$/IS_APPLE := 1/' Makefile
'';
configurePhase = "patchShebangs make.sh ";
buildPhase = "PREFIX=$out ./make.sh";
doCheck = true;
checkPhase = ''
# first remove fuzzing steps from check target
substituteInPlace Makefile --replace "fuzztest fuzzallcorp" ""
make check
'';
installPhase = (lib.optionalString stdenv.isDarwin "HOMEBREW_CAPSTONE=1 ")
+ "PREFIX=$out ./make.sh install";
nativeBuildInputs = [
pkg-config
cmake
] ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames
];
enableParallelBuilding = true;
doCheck = true;
meta = {
description = "Advanced disassembly library";