Subject: [PATCH 1/2] gnu: Add libb2.

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Sat, 6 Jan 2018 16:54:17 +0100

* gnu/packages/digest.scm (libb2): New public variable.
---
 gnu/packages/digest.scm | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/digest.scm b/gnu/packages/digest.scm
index 5f14ab913..456980ea5 100644
--- a/gnu/packages/digest.scm
+++ b/gnu/packages/digest.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -17,9 +17,11 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages digest)
+  #:use-module (gnu packages autotools)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
 
 (define-public xxhash
@@ -53,3 +55,47 @@ The code is highly portable, and hashes of the same length are identical on all
 platforms (both big and little endian).")
     (license (list license:bsd-2        ; xxhash library (xxhash.[ch])
                    license:gpl2+))))    ; xxhsum.c
+
+(define-public libb2
+  (let ((revision "1")                  ; upstream doesn't ‘do’ releases
+        (commit "60ea749837362c226e8501718f505ab138e5c19d"))
+    (package
+      (name "libb2")
+      (version (string-append "0.0.0-" revision "." (string-take commit 7)))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/BLAKE2/libb2")
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "07a2m8basxrsj9dsp5lj24y8jraj85lfy56756a7za1nfkgy04z7"))))
+      (build-system gnu-build-system)
+      (native-inputs
+       `(("autoconf" ,autoconf)
+         ("automake" ,automake)
+         ("libtool" ,libtool)))
+      (arguments
+       `(#:configure-flags
+         (list "--enable-fat"           ; detect optimisations at run time...
+               "--disable-native")      ; ...not build time
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'bootstrap
+             (lambda _
+               (invoke "sh" "autogen.sh")
+               #t)))))
+      (home-page "https://blake2.net/")
+      (synopsis "Library implementing the BLAKE2 family of hash functions")
+      (description
+       "libb2 is a portable implementation of the BLAKE2 family of cryptographic
+hash functions.  It includes optimised implementations for IA-32 and AMD64
+processors, and an interface layer that automatically selects the best
+implementation for the processor it is run on.
+
+@dfn{BLAKE2} (RFC 7693) is a family of high-speed cryptographic hash functions
+that are faster than MD5, SHA-1, SHA-2, and SHA-3, yet are at least as secure
+as the latest standard, SHA-3.  It is an improved version of the SHA-3 finalist
+BLAKE.")
+      (license license:public-domain))))
-- 
2.15.0