gnu: libretro-lowresnx: Update to 1.2.
[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 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages nettle)
23 #:use-module (guix utils)
24 #:use-module (guix licenses)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages multiprecision)
29 #:use-module (gnu packages m4))
30
31 (define-public nettle-2
32 (package
33 (name "nettle")
34 (version "2.7.1")
35 (source (origin
36 (method url-fetch)
37 (uri (string-append "mirror://gnu/nettle/nettle-"
38 version ".tar.gz"))
39 (sha256
40 (base32
41 "0h2vap31yvi1a438d36lg1r1nllfx3y19r4rfxv7slrm6kafnwdw"))))
42 (build-system gnu-build-system)
43 (arguments
44 ;; 'sexp-conv' and other programs need to have their RUNPATH point to
45 ;; $libdir, which is not the case by default. Work around it.
46 '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
47 (assoc-ref %outputs "out")
48 "/lib"))
49 #:phases (modify-phases %standard-phases
50 (add-after 'install 'move-static-libraries
51 (lambda* (#:key outputs #:allow-other-keys)
52 (let ((out (assoc-ref outputs "out"))
53 (slib (string-append (assoc-ref outputs "static")
54 "/lib")))
55 (mkdir-p slib)
56 (with-directory-excursion (string-append out "/lib")
57 (for-each (lambda (ar)
58 (rename-file ar (string-append
59 slib "/"
60 (basename ar))))
61 (find-files "." "\\.a$")))
62 #t))))))
63 (outputs '("out" "debug" "static"))
64 (native-inputs `(("m4" ,m4)))
65 (propagated-inputs `(("gmp" ,gmp)))
66 (home-page "https://www.lysator.liu.se/~nisse/nettle/")
67 (synopsis "C library for low-level cryptographic functionality")
68 (description
69 "GNU Nettle is a low-level cryptographic library. It is designed to
70 fit in easily in almost any context. It can be easily included in
71 cryptographic toolkits for object-oriented languages or in applications
72 themselves.")
73 (license gpl2+)))
74
75 (define-public nettle-3.5
76 ;; This version is not API-compatible with version 2. In particular, lsh
77 ;; cannot use it yet. So keep it separate.
78 (package (inherit nettle-2)
79 (version "3.5.1")
80 (source (origin
81 (method url-fetch)
82 (uri (string-append "mirror://gnu/nettle/nettle-"
83 version ".tar.gz"))
84 (sha256
85 (base32
86 "06clvkdfxhlbagn4afssylmn5vrak59dlmnvy8b2xc31hycs3k3m"))))
87 (arguments
88 (substitute-keyword-arguments (package-arguments nettle-2)
89 ((#:configure-flags flags)
90 ;; Build "fat" binaries where the right implementation is chosen
91 ;; at run time based on CPU features (starting from 3.1.)
92 `(cons "--enable-fat" ,flags))))))
93
94 (define-public nettle-3.7
95 (package (inherit nettle-3.5)
96 (version "3.7.2")
97 (source (origin
98 (method url-fetch)
99 (uri (string-append "mirror://gnu/nettle/nettle-"
100 version ".tar.gz"))
101 (sha256
102 (base32
103 "0qpi1qp3bcvqdsaxy2pzg530db95x8qjahkynxgwvr6dy5760ald"))))))
104
105 ;;; Upgrading Nettle on master would cause 10000+ packages to be rebuilt.
106 (define-public nettle nettle-3.5)