Subject: [bug#27475] Add kashmir, crypto++, opendht-with-msgpack-c++-11, and some updates.

From: Adonay Felipe Nogueira <[email-masked]>
Date: Wed, 22 Nov 2017 00:16:08 -0200

Thank you very much for the feedback! ;)

Here follows an updated patch.

The "release-revision.commit" is taken from [1], I just kept 'revision
as a number when let'ing, and now in this new patch also attempted to
make it so that 'version has checks for the existance of 'revision and
'commit.

As for any other detail (including: whether the msgpack "c++-11" variant
is really needed; or if the "upcoming" packages for GNU Ring will work
if these package definitions are based on the *stable* releases and what
are the drawbacks), I'll unfortunatelly not be able to answer these, as
I'm not a developer of these packages (neither of GNU Ring).

>From here on you will be reading text that deserves to be discussed in
another thread.

Some months ago I made an implicit mention of GNU Guix in the GNU Ring
discussion resources, but so far I'm not aware of GNU Ring project
making package definitions for GNU Guix.

There are lots of people interested in using GNU Ring and I was also
made aware that some people downloaded the patches I made for
Guix. Although I don't know what those people interested do or what are
their current limitations, but at least in my case, I'm not a developer
and currently have some time constraints (because I'm looking for a job
and also having to work on my Bachelor's final work).

[1] [[info:guix#Version Numbers]]

>From 5acce278858ee381702d3cae50235feadbbae9fe Mon Sep 17 00:00:00 2001
From: Adonay Felipe Nogueira <[email-masked]>
Date: Tue, 21 Nov 2017 23:35:08 -0200
Subject: [PATCH] Update opendht, argon2. Add kashmir, secp256k1,
 opendht-with-msgpack-c++-11

This adds packages that are needed for GNU Ring, but which need less
adaptations specific for it.

* gnu/packages/cpp.scm (kashmir): New package.
* gnu/packages/crypto.scm
(secp256k1): New package.
(opendht): Update to 1.4.0-5.a789ffe.
(opendht-with-msgpack-c++-11): New package.
* gnu/packages/password-utils.scm (argon2): Update to 20161029-4.1eea010.
* gnu/packages/serialization.scm (msgpack-c++-11): New package.
---
 gnu/packages/cpp.scm            |  81 +++++++++++++++++++++++++++++-
 gnu/packages/crypto.scm         |  69 +++++++++++++++++++++++++-
 gnu/packages/password-utils.scm | 106 +++++++++++++++++++++++++++-------------
 gnu/packages/serialization.scm  |  12 +++++
 4 files changed, 233 insertions(+), 35 deletions(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 5ad9fd3..239046a 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.
 ;;;
@@ -21,8 +22,86 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #: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")
+	(revision 1)
+        (commit "2f3913f49c4ac7f9bff9224db5178f6f8f0ff3ee"))
+    (package
+      (name "kashmir")
+      (version (string-append release
+                              (if (and (defined? 'revision)
+                                       (not (zero? revision)))
+                                  (string-append "-"
+                                                 (number->string revision))
+                                  "")
+                              (if (defined? 'commit)
+                                  (string-append "."
+                                                 (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
+                  "0pwpl0m61qyrnnw9iaacg9sh9lqafqyaqmmas0swjakww1b968si"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (ice-9 ftw)
+                        (ice-9 regex))
+           (let ((gzip (assoc-ref %build-inputs "gzip"))
+                 (source (assoc-ref %build-inputs "source"))
+                 (tar (assoc-ref %build-inputs "tar"))
+                 (dot-symlinks-regex (make-regexp "^\\.\\.?$"))
+                 (license-text-file-regex (make-regexp "^LICENSE" regexp/icase)))
+             (setenv "PATH" (string-append gzip "/bin:"
+                                           tar "/bin"))
+             (mkdir-p %output)
+             (system* "tar" "-xv" "--strip-components=1" "-f" source "-C" %output)
+             (chdir %output)
+             (copy-recursively "kashmir"
+                               (string-append "include/"
+                                              ,name))
+             (for-each (lambda (license-text-file)
+                         (install-file license-text-file
+                                       (string-append "share/doc/"
+                                                      ,name))
+                         (delete-file license-text-file))
+                       (scandir "."
+                                (lambda (current-basename)
+                                  (regexp-exec license-text-file-regex
+                                               current-basename))))
+             (for-each (lambda (useless-basename)
+                         (delete-file-recursively useless-basename))
+                       (scandir "."
+                                (lambda (current-basename)
+                                  (and (not (regexp-exec dot-symlinks-regex
+                                                         current-basename))
+                                       (not (regexp-exec license-text-file-regex
+                                                         current-basename))
+                                       (not (string-match "^(share|include)$"
+                                                          current-basename))))))))))
+      (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
diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index 7f02400..2b23933 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -7,6 +7,8 @@
 ;;; Copyright © 2016, 2017 ng0 <[email-masked]>
 ;;; Copyright © 2016, 2017 Eric Bavier <[email-masked]>
 ;;; Copyright © 2017 Pierre Langlois <[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.
 ;;;
@@ -39,10 +41,12 @@
   #:use-module (gnu packages libbsd)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages password-utils)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages search)
   #:use-module (gnu packages serialization)
@@ -56,7 +60,9 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system perl))
+  #:use-module (guix build-system perl)
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1))
 
 (define-public libsodium
   (package
@@ -112,6 +118,59 @@ communication, encryption, decryption, signatures, etc.")
                    license:public-domain))
     (home-page "https://www.hadrons.org/software/libmd/")))
 
+(define-public secp256k1
+  (let ((release "0.1")
+	(revision 1)
+        (commit "0b7024185045a49a1a6a4c5615bf31c94f63d9c4"))
+    (package
+      (name "secp256k1")
+      (version (string-append release
+                              (if (and (defined? 'revision)
+                                       (not (zero? revision)))
+                                  (string-append "-"
+                                                 (number->string revision))
+                                  "")
+                              (if (defined? 'commit)
+                                  (string-append "."
+                                                 (string-take commit 7))
+                                  "")))
+      (source (origin
+                (method url-fetch)
+                (uri (string-append "https://github.com/bitcoin-core/" name
+                                    "/archive/" commit ".tar.gz"))
+                (file-name (string-append name "-" version ".tar.gz"))
+                (sha256
+                 (base32
+                  "16xzxjc0y38k7cs6j1caipw03y8c7zycv3amb12r3jakz00b2ra6"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-before 'configure 'run-autogen
+             (lambda _
+               (zero? (system* "./autogen.sh"))
+               #t)))))
+      (inputs
+       `(("gmp" ,gmp)))
+      (native-inputs
+       `(("autoconf" ,autoconf)
+         ("automake" ,automake)
+         ("libtool" ,libtool)))
+      (home-page "https://github.com/bitcoin-core/secp256k1/")
+      (synopsis "Optimized C library for EC operations on curve secp256k1")
+      (description "Library that has the following features:
+@itemize
+@item secp256k1 ECDSA signing/verification and key generation;
+@item adding/multiplying private/public keys;
+@item serialization/parsing of private keys, public keys, signatures;
+@item constant time, constant memory access signing and pubkey generation;
+@item derandomized DSA (via RFC6979 or with a caller provided function).
+@end itemize")
+      (license license:expat
+               ;; TODO Should we list *all* the licenses found?
+               ;; license:asl2.0
+               ))))
+
 (define-public signify
   (package
     (name "signify")
@@ -205,6 +264,14 @@ be used to manage peer-to-peer network connections as needed for real time
 communication.")
     (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
     (name "encfs")
diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index a758817..4c495d5 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2017 Jelle Licht <[email-masked]>
 ;;; Copyright © 2017 Eric Bavier <[email-masked]>
 ;;; Copyright © 2017 Nicolas Goaziou <[email-masked]>
+;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,8 +34,10 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module ((guix build utils) #:select (install-file substitute*))
   #:use-module (guix download)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages aidc)
@@ -406,39 +409,76 @@ 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
-winner of the 2015 Password Hashing Competition.")
-    (license license:cc0)))
+  (let ((release "20161029")
+	(revision 4)
+        (commit "1eea0104e7cb2a38c617cf90ffa46ce5db6aceda"))
+    (package
+      (name "argon2")
+      (version (string-append release
+                              (if (and (defined? 'revision)
+                                       (not (zero? revision)))
+                                  (string-append "-"
+                                                 (number->string revision))
+                                  "")
+                              (if (defined? 'commit)
+                                  (string-append "."
+                                                 (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"))
+                (sha256
+                 (base32
+                  "0rjy1hg8l6m2d1r1lyq2z3w43smxbq38qfmzvwf0ifxka64mn8is"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:test-target "test"
+         #:make-flags '("CC=gcc"
+                        "OPTTARGET=no-opt")
+         #: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))
+               #t))
+           (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")))
+               #t)))))
+      (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))))
 
 (define-public python-bcrypt
   (package
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 03365ad..37b1231 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2017 Gregor Giesen <[email-masked]>
 ;;; Copyright © 2017 Frederick M. Muriithi <[email-masked]>
 ;;; Copyright © 2017 ng0 <[email-masked]>
+;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@
   #:use-module (guix utils)
   #:use-module (guix build-system cmake)
   #: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 boost)
@@ -137,6 +139,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

2017-10-11T17:22:54+0100 Christopher Baines wrote:
>
> I've just noticed that no one has taken a look at this yet! Not quite
> sure how that has happened. Here are my comments.
>
> The first general comment is that these patches don't quite apply now,
> so it would be useful to send another set which do apply cleanly.
>
> Starting with the kashmir package.
>
>
> Looks like this patch may have got caught up in the recent hash changes
> from GitHub. I had to change the sha256 before this would build.
>
> The directory structure in this package looks a little odd. The Debian
> package has kashmir-dependency/kashmir as include/kashmir, which might
> be a little more usual.
>
> guix lint also reports some issues:
>
> /home/chris/.config/guix/latest/gnu/packages/cpp.scm:36:4:
> [email-masked]: tabulation on line 39, column 0
> + more tab issues
> /home/chris/.config/guix/latest/gnu/packages/cpp.scm:36:4:
> [email-masked]: tabulation on line 71, column 0
> /home/chris/.config/guix/latest/gnu/packages/cpp.scm:36:4:
> [email-masked]: line 72 is way too long (98 characters)
> /home/chris/.config/guix/latest/gnu/packages/cpp.scm:36:4:
> [email-masked]: line 73 is way too long (176 characters)
>
>
> As for the crypto++ package.
>
> guix lint reports lots of tabs.
>
>
> I think you could get rid of this phase by adding "shared" to the
> #:make-flags.
>
> I'm not sure why the binary is has .exe in the name? Even
> the inbuilt help calls it cryptest:
>
>   Unrecognized command. Run "cryptest h" to obtain usage information.
>
> I have no idea what this does, but running it in a container fails, as
> it seems to be looking for data in the doc output:
>
>   → guix environment --container --ad-hoc crypto++:bin -- cryptest.exe
>   CryptoPP::Exception caught: FileStore: error opening file for reading:
>  TestData/usage.dat
>
>
> On to the opendht update.
>
>
> I'm not why this revision is being used?
>
> Also, with the msgpack-c++-11 package, I built both msgpack and
> msgpack-c++-11 and diffed the contents with diffoscope, and they are
> practically identical as far as I can see. I'm guessing there was
> supposed to be a difference?
>
>
> Last but not least, for the argon2 package, for which I don't have any
> questions or suggestions. Ignoring the tabs, I think it looks fine.
>
> I hope this helps Adonay :)

-- 
- https://libreplanet.org/wiki/User:Adfeno
- Palestrante e consultor sobre /software/ livre (não confundir com
  gratis).
- "WhatsApp"? Ele não é livre. Por favor, veja formas de se comunicar
  instantaneamente comigo no endereço abaixo.
- Contato: https://libreplanet.org/wiki/User:Adfeno#vCard
- Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft
  Office, MP3, MP4, WMA, WMV.
- Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU
  GIMP, Inkscape SVG, JPG, LibreOffice (padrão ODF), OGG, OPUS, PDF
  (apenas sem DRM), PNG, TXT, WEBM.