2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, nasm }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2020-11-12 09:05:59 +00:00
|
|
|
inherit (stdenv.hostPlatform.parsed.cpu) bits;
|
|
|
|
arch = "bandwidth${toString bits}";
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bandwidth";
|
2022-01-03 16:56:52 +00:00
|
|
|
version = "1.11.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://zsmith.co/archives/${pname}-${version}.tar.gz";
|
2022-01-03 16:56:52 +00:00
|
|
|
sha256 = "sha256-mjtvQAOH9rv12XszGdD5hIX197er7Uc74WfVaP32TpM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i 's,ar ,$(AR) ,g' OOC/Makefile
|
2021-09-18 10:52:07 +00:00
|
|
|
# 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
|
2020-11-12 09:05:59 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ nasm ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +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
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2020-11-12 09:05:59 +00:00
|
|
|
cp ${arch} $out/bin/bandwidth
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://zsmith.co/bandwidth.html";
|
|
|
|
description = "Artificial benchmark for identifying weaknesses in the memory subsystem";
|
2020-11-12 09:05:59 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = platforms.x86 ++ platforms.arm ++ platforms.aarch64;
|
2020-11-12 09:05:59 +00:00
|
|
|
maintainers = with maintainers; [ r-burns ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|