about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/b2sum/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/b2sum/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/b2sum/default.nix26
1 files changed, 15 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/tools/security/b2sum/default.nix b/nixpkgs/pkgs/tools/security/b2sum/default.nix
index e5de613bee7f..2b08da598fa3 100644
--- a/nixpkgs/pkgs/tools/security/b2sum/default.nix
+++ b/nixpkgs/pkgs/tools/security/b2sum/default.nix
@@ -1,31 +1,35 @@
 { lib, stdenv, fetchFromGitHub, openmp ? null }:
 
-with lib;
-
-stdenv.mkDerivation {
+stdenv.mkDerivation (finalAttrs: {
   pname = "b2sum";
-  version = "unstable-2018-06-11";
+  version = "20190724";
 
   src = fetchFromGitHub {
     owner = "BLAKE2";
     repo = "BLAKE2";
-    rev = "320c325437539ae91091ce62efec1913cd8093c2";
-    sha256 = "E60M9oP/Sdfg/L3ZxUcDtUXhFz9oP72IybdtVUJh9Sk=";
+    rev = finalAttrs.version;
+    sha256 = "sha256-6BVl3Rh+CRPQq3QxcUlk5ArvjIj/IcPCA2/Ok0Zu7UI=";
   };
 
+  # 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/"
+  '';
+
   sourceRoot = "source/b2sum";
 
   buildInputs = [ openmp ];
 
-  buildFlags = [ (optional (openmp == null) "NO_OPENMP=1") ];
+  buildFlags = [ (lib.optional (openmp == null) "NO_OPENMP=1") ];
   installFlags = [ "PREFIX=$(out)" ];
 
-  meta = {
+  meta = with lib; {
     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 ];
-    # "This code requires at least SSE2."
-    platforms = [ "x86_64-linux" "i686-linux" ] ++ platforms.darwin;
+    platforms = platforms.unix;
   };
-}
+})