2021-12-27 00:04:38 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config }:
|
2014-04-08 13:04:11 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "capstone";
|
2020-05-17 00:19:57 +01:00
|
|
|
version = "4.0.2";
|
2014-04-08 13:04:11 +01:00
|
|
|
|
2021-12-27 00:04:38 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aquynh";
|
|
|
|
repo = "capstone";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "sha256-XMwQ7UaPC8YYu4yxsE4bbR3leYPfBHu5iixSLz05r3g=";
|
2014-04-08 13:04:11 +01:00
|
|
|
};
|
|
|
|
|
2020-01-03 23:31:31 +00:00
|
|
|
# replace faulty macos detection
|
2021-01-21 17:00:13 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
2020-01-03 23:31:31 +00:00
|
|
|
sed -i 's/^IS_APPLE := .*$/IS_APPLE := 1/' Makefile
|
|
|
|
'';
|
|
|
|
|
2021-01-24 09:19:10 +00:00
|
|
|
configurePhase = "patchShebangs make.sh ";
|
2020-01-03 23:31:31 +00:00
|
|
|
buildPhase = "PREFIX=$out ./make.sh";
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
# first remove fuzzing steps from check target
|
|
|
|
substituteInPlace Makefile --replace "fuzztest fuzzallcorp" ""
|
|
|
|
make check
|
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
installPhase = (lib.optionalString stdenv.isDarwin "HOMEBREW_CAPSTONE=1 ")
|
2020-01-03 23:31:31 +00:00
|
|
|
+ "PREFIX=$out ./make.sh install";
|
2021-01-19 21:20:11 +00:00
|
|
|
|
2017-01-14 23:45:52 +00:00
|
|
|
nativeBuildInputs = [
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2017-01-14 23:45:52 +00:00
|
|
|
];
|
2016-10-03 11:51:16 +01:00
|
|
|
|
2016-09-01 09:46:11 +01:00
|
|
|
enableParallelBuilding = true;
|
2014-04-08 13:04:11 +01:00
|
|
|
|
|
|
|
meta = {
|
2016-06-20 11:53:46 +01:00
|
|
|
description = "Advanced disassembly library";
|
2014-04-08 13:04:11 +01:00
|
|
|
homepage = "http://www.capstone-engine.org";
|
2021-01-21 17:00:13 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ thoughtpolice ris ];
|
2022-05-05 01:52:27 +01:00
|
|
|
mainProgram = "cstool";
|
|
|
|
platforms = lib.platforms.unix;
|
2014-04-08 13:04:11 +01:00
|
|
|
};
|
|
|
|
}
|