build: container: Add #:host-uids argument to call-with-container.
[jackhill/guix/guix.git] / gnu / packages / nettle.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages nettle)
20 #:use-module (guix utils)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages multiprecision)
26 #:use-module (gnu packages m4))
27
28 (define-public nettle-2
29 (package
30 (name "nettle")
31 (version "2.7.1")
32 (source (origin
33 (method url-fetch)
34 (uri (string-append "mirror://gnu/nettle/nettle-"
35 version ".tar.gz"))
36 (sha256
37 (base32
38 "0h2vap31yvi1a438d36lg1r1nllfx3y19r4rfxv7slrm6kafnwdw"))))
39 (build-system gnu-build-system)
40 (arguments
41 ;; 'sexp-conv' and other programs need to have their RUNPATH point to
42 ;; $libdir, which is not the case by default. Work around it.
43 '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
44 (assoc-ref %outputs "out")
45 "/lib"))))
46 (outputs '("out" "debug"))
47 (native-inputs `(("m4" ,m4)))
48 (propagated-inputs `(("gmp" ,gmp)))
49 (home-page "http://www.lysator.liu.se/~nisse/nettle/")
50 (synopsis "C library for low-level cryptographic functionality")
51 (description
52 "GNU Nettle is a low-level cryptographic library. It is designed to
53 fit in easily in almost any context. It can be easily included in
54 cryptographic toolkits for object-oriented languages or in applications
55 themselves.")
56 (license gpl2+)))
57
58 (define-public nettle
59 ;; This version is not API-compatible with version 2. In particular, lsh
60 ;; cannot use it yet. So keep it separate.
61 (package (inherit nettle-2)
62 (version "3.1.1")
63 (source (origin
64 (method url-fetch)
65 (uri (string-append "mirror://gnu/nettle/nettle-"
66 version ".tar.gz"))
67 (sha256
68 (base32
69 "0k1x57zviysvi91lkk66cg8v819vywm5g5yqs22wppfqcifx5m2z"))))
70 (arguments
71 `(#:phases
72 (modify-phases %standard-phases
73 (add-after
74 'configure 'disable-ifunc-init-method
75 (lambda _
76 ;; Work around problems with the ifunc initialization method in
77 ;; nettle. For details, see
78 ;; <http://lists.lysator.liu.se/pipermail/nettle-bugs/2015/003389.html>
79 ;; and <https://sourceware.org/ml/libc-help/2015-06/msg00010.html>.
80 (substitute* "config.h"
81 (("#define HAVE_LINK_IFUNC 1")
82 "/* #undef HAVE_LINK_IFUNC */"))
83 #t)))
84 ,@(substitute-keyword-arguments (package-arguments nettle-2)
85 ((#:configure-flags flags)
86 ;; Build "fat" binaries where the right implementation is chosen
87 ;; at run time based on CPU features (starting from 3.1.)
88 `(cons "--enable-fat" ,flags)))))))