2021-10-28 06:52:43 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, openmp ? null }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "b2sum";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "20190724";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "BLAKE2";
|
|
|
|
repo = "BLAKE2";
|
2022-11-21 17:40:18 +00:00
|
|
|
rev = finalAttrs.version;
|
|
|
|
sha256 = "sha256-6BVl3Rh+CRPQq3QxcUlk5ArvjIj/IcPCA2/Ok0Zu7UI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
# Use the generic C implementation rather than the SSE optimised version on non-x86 platforms
|
|
|
|
postPatch = lib.optionalString (!stdenv.hostPlatform.isx86) ''
|
|
|
|
substituteInPlace makefile \
|
|
|
|
--replace "#FILES=b2sum.c ../ref/" "FILES=b2sum.c ../ref/" \
|
|
|
|
--replace "FILES=b2sum.c ../sse/" "#FILES=b2sum.c ../sse/"
|
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
sourceRoot = "${finalAttrs.src.name}/b2sum";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [ openmp ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
buildFlags = [ (lib.optional (openmp == null) "NO_OPENMP=1") ];
|
2020-04-24 23:36:52 +00:00
|
|
|
installFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "The b2sum utility is similar to the md5sum or shasum utilities but for BLAKE2";
|
|
|
|
homepage = "https://blake2.net";
|
|
|
|
license = with licenses; [ asl20 cc0 openssl ];
|
|
|
|
maintainers = with maintainers; [ kirelagin ];
|
2022-11-04 12:27:35 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-11-21 17:40:18 +00:00
|
|
|
})
|