bandwidth: fix build on darwin, fix license, adopt (#101522)

Cleaned up rules a bit for platform-independent building.
License was incorrectly listed as MIT, it is actually GPL2+.
Taking on maintainership as it appears to be orphaned.
This commit is contained in:
r-burns 2020-11-09 20:12:31 -08:00 committed by GitHub
parent ccf5ceea05
commit 6bc3e86662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,8 @@
{ stdenv, fetchurl, nasm }: { stdenv, fetchurl, nasm }:
let let
arch = inherit (stdenv.hostPlatform.parsed.cpu) bits;
if stdenv.hostPlatform.system == "x86_64-linux" then "bandwidth64" arch = "bandwidth${toString bits}";
else if stdenv.hostPlatform.system == "i686-linux" then "bandwidth32"
else if stdenv.hostPlatform.system == "x86_64-darwin" then "bandwidth-mac64"
else if stdenv.hostPlatform.system == "i686-darwin" then "bandwidth-mac32"
else if stdenv.hostPlatform.system == "i686-cygwin" then "bandwidth-win32"
else throw "Unknown architecture";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "bandwidth"; pname = "bandwidth";
@ -18,21 +13,25 @@ stdenv.mkDerivation rec {
sha256 = "0x798xj3vhiwq2hal0vmf92sq4h7yalp3i6ylqwhnnpv99m2zws4"; sha256 = "0x798xj3vhiwq2hal0vmf92sq4h7yalp3i6ylqwhnnpv99m2zws4";
}; };
buildInputs = [ nasm ]; postPatch = ''
sed -i 's,^CC=gcc .*,,' OOC/Makefile Makefile*
sed -i 's,ar ,$(AR) ,g' OOC/Makefile
'';
buildFlags = [ arch ] nativeBuildInputs = [ nasm ];
++ stdenv.lib.optionals stdenv.cc.isClang [ "CC=clang" "LD=clang" ];
buildFlags = [ arch ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
cp ${arch} $out/bin cp ${arch} $out/bin/bandwidth
ln -s ${arch} $out/bin/bandwidth
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = "https://zsmith.co/bandwidth.html"; homepage = "https://zsmith.co/bandwidth.html";
description = "Artificial benchmark for identifying weaknesses in the memory subsystem"; description = "Artificial benchmark for identifying weaknesses in the memory subsystem";
license = licenses.mit; license = licenses.gpl2Plus;
platforms = platforms.unix; platforms = platforms.x86;
maintainers = with maintainers; [ r-burns ];
}; };
} }