From a8c0c21f7851e201bf113854f0f80519afa551fe Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Fri, 3 Jan 2020 23:31:31 +0000 Subject: [PATCH] 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 --- .../libraries/capstone/default.nix | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/capstone/default.nix b/pkgs/development/libraries/capstone/default.nix index 956fd74da58..b8d00984cd6 100644 --- a/pkgs/development/libraries/capstone/default.nix +++ b/pkgs/development/libraries/capstone/default.nix @@ -9,9 +9,23 @@ stdenv.mkDerivation rec { 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 = '' ./make.sh ''; - installPhase = '' env PREFIX=$out ./make.sh install ''; + 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 @@ -23,7 +37,7 @@ stdenv.mkDerivation rec { description = "Advanced disassembly library"; homepage = "http://www.capstone-engine.org"; license = stdenv.lib.licenses.bsd3; - platforms = stdenv.lib.platforms.linux; - maintainers = [ stdenv.lib.maintainers.thoughtpolice ]; + platforms = stdenv.lib.platforms.unix; + maintainers = with stdenv.lib.maintainers; [ thoughtpolice ris ]; }; }