From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: [PATCH 2/6] gnu: Add crypto++. Date: Sun, 15 Jan 2017 21:33:34 +0100 Message-ID: <20170115203338.19769-3-mbakke@fastmail.com> References: <20170115203338.19769-1-mbakke@fastmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSrV6-0002ff-Bg for guix-devel@gnu.org; Sun, 15 Jan 2017 15:34:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cSrV4-0002Ul-J4 for guix-devel@gnu.org; Sun, 15 Jan 2017 15:34:04 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:50646) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cSrV4-0002Uh-EV for guix-devel@gnu.org; Sun, 15 Jan 2017 15:34:02 -0500 In-Reply-To: <20170115203338.19769-1-mbakke@fastmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Cc: Marius Bakke * gnu/packages/crypto.scm (crypto++): New variable. --- gnu/packages/crypto.scm | 90 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm index e4a8a4bd5..2bf64f1f6 100644 --- a/gnu/packages/crypto.scm +++ b/gnu/packages/crypto.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2016 Tobias Geerinckx-Rice ;;; Copyright © 2016 ng0 ;;; Copyright © 2016 Eric Bavier +;;; Copyright © 2017 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -46,12 +47,99 @@ #:use-module (gnu packages tcl) #:use-module (gnu packages tls) #:use-module (gnu packages xml) + #:use-module (gnu packages zip) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system cmake) - #:use-module (guix build-system gnu)) + #:use-module (guix build-system gnu) + #:use-module (guix utils) + #:use-module (srfi srfi-26) + #:use-module (ice-9 match)) + +(define-public crypto++ + (package + (name "crypto++") + (version "5.6.5") + (source (origin + (method url-fetch) + (uri (let ((numeric-version + (match (string-split version #\.) + ((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 + (list (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 + ;; ??? Why are we in the TestData folder. + (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 version))) + (with-directory-excursion (string-append out "/lib") + (symlink (string-append "libcryptopp.so." ,version) + (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. + (license (list license:boost1.0 + license:public-domain)))) (define-public libsodium (package -- 2.11.0