nixpkgs/pkgs/development/libraries/capstone/default.nix
Robert Scott a8c0c21f78 capstone: enable for darwin, enable tests & fix pkg-config output
turns out capstone.pc is generated during the buildPhase, so needs
PREFIX set here too for it to be correct
2020-02-10 20:29:01 +01:00

44 lines
1.2 KiB
Nix

{ stdenv, fetchurl, pkgconfig }:
stdenv.mkDerivation rec {
pname = "capstone";
version = "4.0.1";
src = fetchurl {
url = "https://github.com/aquynh/capstone/archive/${version}.tar.gz";
sha256 = "1isxw2qwy1fi3m3w7igsr5klzczxc5cxndz0a78dfss6ps6ymfvr";
};
# replace faulty macos detection
postPatch = stdenv.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 = (stdenv.lib.optionalString stdenv.isDarwin "HOMEBREW_CAPSTONE=1 ")
+ "PREFIX=$out ./make.sh install";
nativeBuildInputs = [
pkgconfig
];
enableParallelBuilding = true;
meta = {
description = "Advanced disassembly library";
homepage = "http://www.capstone-engine.org";
license = stdenv.lib.licenses.bsd3;
platforms = stdenv.lib.platforms.unix;
maintainers = with stdenv.lib.maintainers; [ thoughtpolice ris ];
};
}