Subject: Add kashmir, crypto++, opendht-with-msgpack-c++-11, and some updates.

From: Adonay Felipe Nogueira <[email-masked]>
Date: Sat, 24 Jun 2017 13:26:48 -0300

Hi Guix! :)

Here follows a series of patches, it's part of the attempt to package
GNU Ring. However, these contributions don't need custom patches from
Savir Faire Linux. The only doubt is in regards to the need to have a
variant of msgpack that uses C++ 11 instead, and have a variant of
opendht that makes use of such msgpack variant instead.

Respectfully, Adonay.
-- 
- [[https://libreplanet.org/wiki/User:Adfeno]]
- Palestrante e consultor sobre /software/ livre (não confundir com
  gratis).
- "WhatsApp"? Ele não é livre, por isso não uso. Iguais a ele prefiro
  GNU Ring, ou Tox. Quer outras formas de contato? Adicione o vCard
  que está no endereço acima aos teus contatos.
- Pretende me enviar arquivos .doc, .ppt, .cdr, ou .mp3? OK, eu
  aceito, mas não repasso. Entrego apenas em formatos favoráveis ao
  /software/ livre. Favor entrar em contato em caso de dúvida.
>From 4622ca4c1ba0ef42c1b0db1070727c072365fbf6 Mon Sep 17 00:00:00 2001
From: Adonay Felipe Nogueira <[email-masked]>
Date: Sat, 24 Jun 2017 11:53:49 -0300
Subject: [PATCH] gnu: Add kashmir.

* gnu/packages/cpp.scm (kashmir): New variable.
---
 gnu/packages/cpp.scm | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index da19255..228be99 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2017 Ethan R. Jones <[email-masked]>
+;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,9 +21,58 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix build utils)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
-  #:use-module (gnu packages autotools))
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages compression))
+
+(define-public kashmir
+  (let ((release "0")
+	(commit "2f3913f49c4ac7f9bff9224db5178f6f8f0ff3ee")
+	(revision 1))
+    (package
+     (name "kashmir")
+     (version (if (zero? revision)
+		  release
+		  (string-append release "-"
+				 (number->string revision)
+				 "." (string-take commit 7))))
+     (source (origin
+	      (method url-fetch)
+	      (uri (string-append "https://github.com/Corvusoft/" name
+				  "-dependency/archive/" commit ".tar.gz"))
+	      (file-name (string-append name "-" version ".tar.gz"))
+	      (sha256
+	       (base32
+		"11hbh3d7w74gng9qgz3hdrzvxjgil1pymk2bzxv1ajh9vp60xxs9"))))
+     (build-system trivial-build-system)
+     (arguments
+      `(#:modules ((guix build utils))
+	#:builder
+	(begin
+	  (use-modules (guix build utils))
+	  (let ((gzip (assoc-ref %build-inputs "gzip"))
+		(source (assoc-ref %build-inputs "source"))
+		(tar (assoc-ref %build-inputs "tar")))
+	    (setenv "PATH" (string-append gzip "/bin:"
+					  tar "/bin"))
+	    (mkdir-p %output)
+	    (system* "tar" "-xvf" source "-C" %output)
+	    (chdir %output)
+	    (for-each (lambda (file)
+			(rename-file file "kashmir-dependency"))
+		      (find-files "." "kashmir-dependency-" #:directories? #t))))))
+     (native-inputs
+      `(("source" ,source)
+	("tar" ,tar)
+	("gzip" ,gzip)))
+     (synopsis "C++ library providing I/O, MD5, SHA-1, random number string, and UUID operations")
+     (description "The Kashmir Library provides features allowing usage of I/O formatting and state saving; MD5 and SHA-1 hashing; random number streams, and UUID generation.")
+     (home-page "https://github.com/corvusoft/kashmir-dependency")
+     (license license:boost1.0))))
 
 (define-public libzen
   (package
-- 
1.9.1

>From 6e390fd37c1562188c0c40a3d4c9c8987462abd1 Mon Sep 17 00:00:00 2001
From: Adonay Felipe Nogueira <[email-masked]>
Date: Sat, 24 Jun 2017 13:09:46 -0300
Subject: [PATCH] gnu: Add crypto++.

* gnu/packages/crypto.scm (crypto++): New variable.
---
 gnu/packages/crypto.scm | 103 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 102 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index 6f02d86..4d32750 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -6,6 +6,8 @@
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2016 ng0 <[email-masked]>
 ;;; Copyright © 2016, 2017 Eric Bavier <[email-masked]>
+;;; Copyright © 2017 Marius Bakke <[email-masked]>
+;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +31,7 @@
   #:use-module (gnu packages attr)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages boost)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gnupg)
@@ -50,9 +53,107 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build utils)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system python))
+  #:use-module (guix build-system python)
+  #:use-module (guix utils)
+  #:use-module (ice-9 match))
+
+(define-public crypto++
+  (let ((release "5.6.5")
+	(revision 1))
+    (package
+     (name "crypto++")
+     (version (if (zero? revision)
+		  release
+		  (string-append release "-"
+				 (number->string revision))))
+     (source (origin
+	      (method url-fetch)
+	      (uri (let ((numeric-version
+			  (match (string-split release #\.)
+				 ((first-digit other-digits ...)
+				  (string-append first-digit
+						 (string-concatenate
+						  other-digits))))))
+		     (string-append "https://cryptopp.com/cryptopp"
+				    numeric-version ".zip")))
+	      (sha256
+	       (base32
+		"0d1cqdz369ivi082k59025wvxzywvkizw7i0pf5h0a1izs3g8pm7"))))
+     (build-system gnu-build-system)
+     (arguments
+      `(#:make-flags
+	`(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
+	  ,(string-append "BINDIR=" (assoc-ref %outputs "bin") "/bin")
+	  ,(string-append "DATADIR=" (assoc-ref %outputs "doc") "/share")
+	  "DISABLE_CXXFLAGS_OPTIMIZATIONS=1"
+	  ;; Override "/sbin/ldconfig" with simply "echo" since
+	  ;; we don't need ldconfig(8).
+	  "LDCONF=echo")
+	#:phases
+	(modify-phases %standard-phases
+		       (add-after 'unpack 'enter-source
+				  ;; They have made a zip-bomb.
+				  (lambda _ (chdir "..") #t))
+		       (add-after 'enter-source 'disable-optimizations
+				  (lambda _
+				    ;; XXX: The disable optimizations
+				    ;; flag above is not recognized in
+				    ;; the current version. See
+				    ;; https://github.com/weidai11/cryptopp/pull/354.
+				    ;; For now, just remove it the dirty
+				    ;; way.
+				    (substitute* "GNUmakefile"
+						 (("-march=native") ""))
+				    #t))
+		       (delete 'configure)
+		       (add-after 'build 'build-shared
+				  (lambda _
+				    ;; By default, only the static
+				    ;; library is built.
+				    (zero?
+				     (system* "make" "shared"))))
+		       (add-after 'install 'move-static-library
+				  (lambda* (#:key outputs #:allow-other-keys)
+					   (let* ((out (assoc-ref outputs "out"))
+						  (lib (string-append out "/lib"))
+						  (static (assoc-ref outputs "static"))
+						  (slib (string-append static "/lib")))
+					     (mkdir-p slib)
+					     (for-each (lambda (file)
+							 (install-file file slib)
+							 (delete-file file))
+						       (find-files lib "\\.l?a$"))
+					     #t)))
+		       (add-after 'move-static-library 'add-so-version-symlink
+				  ;; The library is named
+				  ;; MAJOR.MINOR.PATCHLEVEL. Some
+				  ;; programs expect a MAJOR.MINOR
+				  ;; symlink.
+				  (lambda* (#:key outputs #:allow-other-keys)
+					   (let ((out (assoc-ref outputs "out"))
+						 (major+minor ,(version-major+minor release)))
+					     (with-directory-excursion (string-append out "/lib")
+								       (symlink (string-append "libcryptopp.so." ,release)
+										(string-append "libcryptopp.so." major+minor))
+								       #t)))))))
+     (outputs
+      '("out" ; 6.4M shared library and headers
+	"bin" ; 6.3M cryptest.exe
+	"doc" ; 6.4M documentation and examples
+	"static")) ; 15M static library
+     (native-inputs
+      `(("unzip" ,unzip)))
+     (synopsis "C++ class library of cryptographic schemes")
+     (description "Crypto++ is a large collection of cryptograhic
+algorithms and related utilities for C++.")
+     (home-page "https://cryptopp.com")
+     ;; The compilation is licensed under Boost 1.0, while
+     ;; most individual files are in the public domain.
+     ;; Should we add two licenses?
+     (license license:boost1.0))))
 
 (define-public libsodium
   (package
-- 
1.9.1

>From f8af42e7a9348610d5a413c0838ae22dda47da0b Mon Sep 17 00:00:00 2001
From: Adonay Felipe Nogueira <[email-masked]>
Date: Sat, 24 Jun 2017 12:54:16 -0300
Subject: [PATCH] gnu: Add msgpack-c++-11 and opendht variant. opendht: Update
 to 1.3.3-5.

* gnu/packages/crypto.scm (opendht): Update to 1.3.3-5.
* gnu/packages/crypto.scm (opendht-with-msgpack-c++-11): New variable.
* gnu/packages/serialization.scm (msgpack-c++-11): New variable.
---
 gnu/packages/crypto.scm        | 98 +++++++++++++++++++++---------------------
 gnu/packages/serialization.scm | 12 +++++-
 2 files changed, 60 insertions(+), 50 deletions(-)

diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index 6f02d86..38211be 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2016 ng0 <[email-masked]>
 ;;; Copyright © 2016, 2017 Eric Bavier <[email-masked]>
+;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -117,58 +118,57 @@ OpenBSD tool of the same name.")
                                           "See base64.c in the distribution for
                                            the license from IBM.")))))
 
-
 (define-public opendht
-  (package
-    (name "opendht")
-    (version "0.6.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri
-        (string-append
-         "https://github.com/savoirfairelinux/" name
-         "/archive/" version ".tar.gz"))
-       (file-name (string-append name "-" version ".tar.gz"))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           (delete-file-recursively "src/argon2")
-           (substitute* "src/Makefile.am"
-             (("./argon2/libargon2.la") "")
-             (("SUBDIRS = argon2") ""))
-           (substitute* "src/crypto.cpp"
-             (("argon2/argon2.h") "argon2.h"))
-           (substitute* "configure.ac"
-             (("src/argon2/Makefile") ""))))
-       (sha256
-        (base32
-         "09yvkmbqbym3b5md4n96qc1s9sf2n8ji404hagih45rmsj49599x"))))
-    (build-system gnu-build-system)
-    (inputs
-     `(("gnutls" ,gnutls)
-       ("nettle" ,nettle)
-       ("readline" ,readline)
-       ("argon2" ,argon2)))
-    (propagated-inputs
-     `(("msgpack" ,msgpack)))           ;included in several installed headers
-    (native-inputs
-     `(("autoconf" ,autoconf)
-       ("pkg-config" ,pkg-config)
-       ("automake" ,automake)
-       ("libtool" ,libtool)))
-    (arguments
-     `(#:configure-flags '("--disable-tools" "--disable-python")
-       #:phases (modify-phases %standard-phases
-                  (add-before 'configure 'autoconf
-                    (lambda _
-                      (zero? (system* "autoreconf" "-vfi")))))))
-    (home-page "https://github.com/savoirfairelinux/opendht/")
-    (synopsis "Distributed Hash Table (DHT) library")
-    (description "OpenDHT is a Distributed Hash Table (DHT) library.  It may
+  (let ((release "1.3.3")
+	(revision 5))
+    (package
+     (name "opendht")
+     (version (if (zero? revision)
+		  release
+		  (string-append release "-"
+				 (number->string revision))))
+     (source (origin
+	      (method url-fetch)
+	      (uri (string-append "https://github.com/savoirfairelinux/" name
+				  "/archive/" release ".tar.gz"))
+	      (file-name (string-append name "-" version ".tar.gz"))
+	      (sha256
+	       (base32
+		"07c8pj3wd7vmz505w508nlc4pssv38ca9s1asv8ydq9qvppd780b"))))
+     (build-system gnu-build-system)
+     (inputs
+      `(("gnutls" ,gnutls)
+	("nettle" ,nettle)
+	("readline" ,readline)))
+     (propagated-inputs
+      `(("argon2" ,argon2)
+	("msgpack" ,msgpack))) ; included in several installed headers
+     (native-inputs
+      `(("autoconf" ,autoconf)
+	("pkg-config" ,pkg-config)
+	("automake" ,automake)
+	("libtool" ,libtool)))
+     (arguments
+      `(#:configure-flags '("--with-argon2")
+	#:phases (modify-phases %standard-phases
+				(add-before 'configure 'autoconf
+					    (lambda _
+					      (zero?
+					       (system* "autoreconf" "-vfi")))))))
+     (home-page "https://github.com/savoirfairelinux/opendht/")
+     (synopsis "Distributed Hash Table (DHT) library")
+     (description "OpenDHT is a Distributed Hash Table (DHT) library.  It may
 be used to manage peer-to-peer network connections as needed for real time
 communication.")
-    (license license:gpl3)))
+     (license license:gpl3+))))
+
+(define-public opendht-with-msgpack-c++-11
+  (package
+   (inherit opendht)
+   (name "opendht-with-msgpack-c++-11")
+   (propagated-inputs
+    `(("msgpack-c++-11" ,msgpack-c++-11)
+      ,@(alist-delete "msgpack" (package-propagated-inputs opendht))))))
 
 (define-public encfs
   (package
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 6a3d8f9..ad50ef5 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016 Marius Bakke <[email-masked]>
 ;;; Copyright © 2016 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2017 Corentin Bocquillon <[email-masked]>
+;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -88,7 +89,6 @@ arbitrary data types and reversibly turns them into different representations,
 such as compact binary encodings, XML, or JSON.")
     (license license:bsd-3)))
 
-
 (define-public msgpack
   (package
     (name "msgpack")
@@ -133,6 +133,16 @@ such as compact binary encodings, XML, or JSON.")
 serialization.")
     (license license:boost1.0)))
 
+(define-public msgpack-c++-11
+  (package
+   (inherit msgpack)
+   (name "msgpack-c++-11")
+   (arguments
+    (substitute-keyword-arguments (package-arguments msgpack)
+				  ((#:make-flags msgpack-make-flags)
+				   `(append ,msgpack-make-flags
+					    '("-DMSGPACK_CXX11=ON")))))))
+
 (define-public libmpack
   (package
     (name "libmpack")
-- 
1.9.1

>From b61ac13661a9188394285ac83991d5eb3853d1d6 Mon Sep 17 00:00:00 2001
From: Adonay Felipe Nogueira <[email-masked]>
Date: Sat, 24 Jun 2017 12:02:01 -0300
Subject: [PATCH] gnu: argon2: Update to 20161029-4.9e3ae0f.

* gnu/packages/password-utils.scm (argon2): Update to 20161029-4.9e3ae0f.
---
 gnu/packages/password-utils.scm | 94 +++++++++++++++++++++++++++--------------
 1 file changed, 62 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 9cfacdb..0c56acc 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2017 Leo Famulari <[email-masked]>
 ;;; Copyright © 2017 Clément Lassieur <[email-masked]>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@
 
 (define-module (gnu packages password-utils)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix build utils)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix download)
@@ -346,39 +348,67 @@ through the pass command.")
     (license license:gpl2+)))
 
 (define-public argon2
-  (package
-    (name "argon2")
-    (version "20161029")
-    (source
-     (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://github.com/P-H-C/phc-winner-argon2/archive/"
-                       version ".tar.gz"))
-       (file-name (string-append name "-" version ".tar.gz"))
-       (sha256
-        (base32
-         "1rymikbysasdadm325jx69i0q19d9srqkny69jwmhswlidr4j07y"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:test-target "test"
-       #:make-flags '("CC=gcc")
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (replace 'install
-           (lambda _
-             (let ((out (assoc-ref %outputs "out")))
-               (install-file "argon2" (string-append out "/bin"))
-               (install-file "libargon2.a" (string-append out "/lib"))
-               (install-file "libargon2.so" (string-append out "/lib"))
-               (copy-recursively "include"
-                                 (string-append out "/include"))))))))
-    (home-page "https://www.argon2.com/")
-    (synopsis "Password hashing library")
-    (description "Argon2 provides a key derivation function that was declared
+  (let ((release "20161029")
+	(commit "9e3ae0f5e91eced6de3c28a9b61f2d91200119e3")
+	(revision 4))
+    (package
+     (name "argon2")
+     (version (if (zero? revision)
+		  release
+		  (string-append release "-"
+				 (number->string revision)
+				 "." (string-take commit 7))))
+     (source (origin
+	      (method url-fetch)
+	      (uri (string-append "https://github.com/P-H-C/phc-winner-argon2/archive/"
+				  commit ".tar.gz"))
+	      (file-name (string-append name "-" version ".tar.gz"))
+	      (modules '((guix build utils)))
+	      (snippet
+	       '(begin
+		  (substitute* "Makefile"
+			       (("ifneq \\(\\$\\(OPTTEST\\), 0\\)")
+				"ifneq (1, 0)"))))
+	      (sha256
+	       (base32
+		"122rpbrl2lbhgwj7sanbgyn81dnp3azr8ydxr5sc0rwqlyg3iqdp"))))
+     (build-system gnu-build-system)
+     (arguments
+      `(#:test-target "test"
+	#:make-flags '("CC=gcc")
+	#:phases
+	(modify-phases %standard-phases
+		       (delete 'configure)
+		       (add-after 'unpack 'fix-pkg-config-and-makefile
+				  (lambda _
+				    (substitute* "libargon2.pc"
+						 (("/usr")
+						  (assoc-ref %outputs "out"))
+						 (("@HOST_MULTIARCH@")
+						  ,(or (%current-target-system)
+						       (%current-system)))
+						 (("@UPSTREAM_VER@")
+						  ,release))))
+		       (replace 'install
+				(lambda _
+				  (let ((out (assoc-ref %outputs "out")))
+				    (install-file "argon2"
+						  (string-append out "/bin"))
+				    (install-file "libargon2.a"
+						  (string-append out "/lib"))
+				    (install-file "libargon2.so.0"
+						  (string-append out "/lib"))
+				    (install-file "libargon2.pc"
+						  (string-append out "/lib/pkgconfig"))
+				    (copy-recursively "include"
+						      (string-append out "/include"))
+				    (symlink (string-append out "/lib/libargon2.so.0")
+					     (string-append out "/lib/libargon2.so"))))))))
+     (home-page "https://www.argon2.com/")
+     (synopsis "Password hashing library")
+     (description "Argon2 provides a key derivation function that was declared
 winner of the 2015 Password Hashing Competition.")
-    (license license:cc0)))
+     (license license:cc0))))
 
 (define-public python-bcrypt
   (package
-- 
1.9.1