Subject: bug#25787: [PATCH 3/6] gnu: Add cryptopp.

From: Pierre Langlois <[email-masked]>
Date: Sat, 18 Feb 2017 18:01:13 +0000

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

diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index fd2b5a36b..a8756e2ab 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 Eric Bavier <[email-masked]>
+;;; Copyright © 2017 Pierre Langlois <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -414,3 +415,46 @@ utility as a demonstration of the @code{scrypt} key derivation function.
 @code{Scrypt} is designed to be far more resistant against hardware brute-force
 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
     (license license:bsd-2)))
+
+(define-public cryptopp
+  (let ((version "5.6.5"))
+    (package
+      (name "cryptopp")
+      (version version)
+      (source (origin
+                (method url-fetch)
+                (uri (string-append
+                       "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_"
+                       (string-join (string-split version #\.) "_") ".tar.gz"))
+                (file-name (string-append name "-" version ".tar.gz"))
+                (sha256
+                 (base32
+                   "11p6mak784mx8hjasg9alwk4g3q5bsfrik9lv73a34dinca5bzbr"))))
+      (build-system cmake-build-system)
+      (arguments
+        '(#:phases
+           (modify-phases %standard-phases
+             ;; A libcrypto++.pc file is not included, create it.
+             (add-after 'install 'install-pkg-config
+               (lambda* (#:key outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out"))
+                        (pkgconfig-path (string-append out "/lib/pkgconfig")))
+                   (mkdir-p pkgconfig-path)
+                   (with-output-to-file
+                     (string-append pkgconfig-path "/libcrypto++.pc")
+                     (lambda _
+                       (format #t
+                         "prefix=~@*~a~@
+                          libdir=${prefix}/lib~@
+                          includedir=${prefix}/include~@
+                          Name: libcrypto++-~1@*~a~@
+                          Description: Class library of cryptographic schemes~@
+                          Version: ~1@*~a~@
+                          Libs: -L${libdir} -lcryptopp~@
+                          Cflags: -I${includedir}~%"
+                         out version)))))))))
+      (home-page "https://cryptopp.com/")
+      (synopsis "C++ class library of cryptographic schemes")
+      (description "Crypto++ is a free C++ class library of cryptographic
+schemes.")
+      (license (list license:boost1.0 license:public-domain)))))
-- 
2.11.1