summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2020-01-03 23:31:31 +0000
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2020-02-10 20:29:01 +0100
commita8c0c21f7851e201bf113854f0f80519afa551fe (patch)
tree9b95547893f05ced6a11785d009f2afcb4dd5a68
parentba30ee33894eac8e24b30bec2e364d82d0beb065 (diff)
downloadnixpkgs-a8c0c21f7851e201bf113854f0f80519afa551fe.tar
nixpkgs-a8c0c21f7851e201bf113854f0f80519afa551fe.tar.gz
nixpkgs-a8c0c21f7851e201bf113854f0f80519afa551fe.tar.bz2
nixpkgs-a8c0c21f7851e201bf113854f0f80519afa551fe.tar.lz
nixpkgs-a8c0c21f7851e201bf113854f0f80519afa551fe.tar.xz
nixpkgs-a8c0c21f7851e201bf113854f0f80519afa551fe.tar.zst
nixpkgs-a8c0c21f7851e201bf113854f0f80519afa551fe.zip
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
-rw-r--r--pkgs/development/libraries/capstone/default.nix22
1 files 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 ];
   };
 }