about summary refs log tree commit diff
path: root/pkgs/tools/misc/nbench
diff options
context:
space:
mode:
authorBen Siraphob <bensiraphob@gmail.com>2022-03-29 00:11:42 -0500
committerBenno Fünfstück <benno.fuenfstueck@gmail.com>2022-03-29 11:31:06 +0200
commit54066822a56a217514f9cfce6e66588546be7e48 (patch)
tree239290b4ce97413313f99a125d85926d15451552 /pkgs/tools/misc/nbench
parent291eb6f682aa068469539a1187e4cf6d508a85e7 (diff)
nbench: fix darwin build
Diffstat (limited to 'pkgs/tools/misc/nbench')
-rw-r--r--pkgs/tools/misc/nbench/default.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/tools/misc/nbench/default.nix b/pkgs/tools/misc/nbench/default.nix
index dc9dcb1e5bec8..16e67b848d65d 100644
--- a/pkgs/tools/misc/nbench/default.nix
+++ b/pkgs/tools/misc/nbench/default.nix
@@ -9,13 +9,15 @@ stdenv.mkDerivation rec {
     sha256 = "1b01j7nmm3wd92ngvsmn2sbw43sl9fpx4xxmkrink68fz1rx0gbj";
   };
 
-  buildInputs = [ stdenv.cc.libc.static ];
   prePatch = ''
     substituteInPlace nbench1.h --replace '"NNET.DAT"' "\"$out/NNET.DAT\""
+    substituteInPlace sysspec.h --replace "malloc.h" "stdlib.h"
+  '' + lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile --replace "-static" ""
   '';
-  preBuild = ''
-    makeFlagsArray=(CC=$CC)
-  '';
+
+  makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
+
   installPhase = ''
     mkdir -p $out/bin
     cp nbench $out/bin
@@ -25,7 +27,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://www.math.utah.edu/~mayer/linux/bmark.html";
     description = "A synthetic computing benchmark program";
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     maintainers = with lib.maintainers; [ bennofs ];
   };
 }