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 { lib
, stdenv , stdenv
, cmake
, fetchFromGitHub , fetchFromGitHub
, pkg-config
, fixDarwinDylibNames , fixDarwinDylibNames
}: }:
@ -16,31 +16,13 @@ stdenv.mkDerivation rec {
sha256 = "sha256-XMwQ7UaPC8YYu4yxsE4bbR3leYPfBHu5iixSLz05r3g="; 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 = [ nativeBuildInputs = [
pkg-config cmake
] ++ lib.optionals stdenv.isDarwin [ ] ++ lib.optionals stdenv.isDarwin [
fixDarwinDylibNames fixDarwinDylibNames
]; ];
enableParallelBuilding = true; doCheck = true;
meta = { meta = {
description = "Advanced disassembly library"; description = "Advanced disassembly library";