2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config }:
|
2014-04-08 12:04:11 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "capstone";
|
2020-05-16 23:19:57 +00:00
|
|
|
version = "4.0.2";
|
2014-04-08 12:04:11 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-07-22 07:56:46 +00:00
|
|
|
url = "https://github.com/aquynh/capstone/archive/${version}.tar.gz";
|
2020-05-16 23:19:57 +00:00
|
|
|
sha256 = "0sjjbqps48az4map0kmai7j7dak3gy0xcq0sgx8fg09g0acdg0bw";
|
2014-04-08 12:04:11 +00: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 10:51:16 +00:00
|
|
|
|
2016-09-01 08:46:11 +00:00
|
|
|
enableParallelBuilding = true;
|
2014-04-08 12:04:11 +00:00
|
|
|
|
|
|
|
meta = {
|
2016-06-20 10:53:46 +00:00
|
|
|
description = "Advanced disassembly library";
|
2014-04-08 12:04:11 +00:00
|
|
|
homepage = "http://www.capstone-engine.org";
|
2021-01-21 17:00:13 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = with lib.maintainers; [ thoughtpolice ris ];
|
2014-04-08 12:04:11 +00:00
|
|
|
};
|
|
|
|
}
|