nixpkgs/pkgs/tools/misc/bandwidth/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.4 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, nasm }:
2015-04-23 21:45:34 +00:00
let
inherit (stdenv.hostPlatform.parsed.cpu) bits;
arch = "bandwidth${toString bits}";
2015-04-23 21:45:34 +00:00
in
stdenv.mkDerivation rec {
pname = "bandwidth";
2021-12-31 21:36:13 +00:00
version = "1.11.2";
2015-04-23 21:45:34 +00:00
src = fetchurl {
url = "https://zsmith.co/archives/${pname}-${version}.tar.gz";
2021-12-31 21:36:13 +00:00
sha256 = "sha256-mjtvQAOH9rv12XszGdD5hIX197er7Uc74WfVaP32TpM=";
2015-04-23 21:45:34 +00:00
};
postPatch = ''
sed -i 's,ar ,$(AR) ,g' OOC/Makefile
# Remove unnecessary -m32 for 32-bit targets
sed -i 's,-m32,,g' OOC/Makefile
# Fix wrong comment character
sed -i 's,# 32,; 32,g' routines-x86-32bit.asm
# Fix missing symbol exports for macOS clang
echo global _VectorToVector128 >> routines-x86-64bit.asm
echo global _VectorToVector256 >> routines-x86-64bit.asm
'';
nativeBuildInputs = [ nasm ];
2015-04-23 21:45:34 +00:00
buildFlags = [
"AR=${stdenv.cc.targetPrefix}ar"
"CC=${stdenv.cc.targetPrefix}cc"
"ARM_AS=${stdenv.cc.targetPrefix}as"
"ARM_CC=$(CC)"
"UNAMEPROC=${stdenv.hostPlatform.parsed.cpu.name}"
"UNAMEMACHINE=${stdenv.hostPlatform.parsed.cpu.name}"
arch
];
2015-04-23 21:45:34 +00:00
installPhase = ''
mkdir -p $out/bin
cp ${arch} $out/bin/bandwidth
2015-04-23 21:45:34 +00:00
'';
meta = with lib; {
homepage = "https://zsmith.co/bandwidth.html";
2016-04-02 00:16:31 +00:00
description = "Artificial benchmark for identifying weaknesses in the memory subsystem";
license = licenses.gpl2Plus;
platforms = platforms.x86 ++ platforms.arm ++ platforms.aarch64;
maintainers = with maintainers; [ r-burns ];
2015-04-23 21:45:34 +00:00
};
}