gnu: sequoia: Update to 1.1.0.
[jackhill/guix/guix.git] / gnu / packages / sequoia.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019, 2020, 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
3 ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages sequoia)
21 #:use-module (guix build-system cargo)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix utils)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages check) ;; python-pytest
29 #:use-module (gnu packages crates-io)
30 #:use-module (gnu packages libffi) ;; python-cffi
31 #:use-module (gnu packages llvm)
32 #:use-module (gnu packages multiprecision)
33 #:use-module (gnu packages nettle)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages python-xyz) ;; python-setuptools
37 #:use-module (gnu packages rust)
38 #:use-module (gnu packages serialization)
39 #:use-module (gnu packages sqlite)
40 #:use-module (gnu packages tls))
41
42 (define-public sequoia
43 (package
44 (name "sequoia")
45 (version "1.1.0")
46 (source
47 (origin
48 (method git-fetch)
49 (uri (git-reference
50 (url "https://gitlab.com/sequoia-pgp/sequoia.git")
51 (commit (string-append "openpgp/v" version))))
52 (sha256
53 (base32 "0knkm0nw1h4ww51vks4jnnp1yc45llfi7j0i70f6vf2bcknnbmci"))
54 (file-name (git-file-name name version))))
55 (build-system cargo-build-system)
56 (outputs '("out" "python"))
57 (native-inputs
58 `(("clang" ,clang)
59 ("pkg-config" ,pkg-config)
60 ("python-pytest" ,python-pytest)
61 ("python-pytest-runner" ,python-pytest-runner)
62 ("python-wrapper" ,python-wrapper)))
63 (inputs
64 `(("capnproto" ,capnproto)
65 ("gmp" ,gmp)
66 ("nettle" ,nettle)
67 ("openssl" ,openssl)
68 ("python" ,python)
69 ("python-cffi" ,python-cffi)
70 ("sqlite" ,sqlite)))
71 (arguments
72 `(#:tests? #f ;; building the tests requires 9.7GB total
73 #:rust ,rust-1.46
74 #:cargo-inputs
75 (("rust-anyhow" ,rust-anyhow-1)
76 ("rust-backtrace" ,rust-backtrace-0.3)
77 ("rust-base64" ,rust-base64-0.13)
78 ;;("rust-buffered-reader" included
79 ("rust-bzip2" ,rust-bzip2-0.4)
80 ("rust-capnp" ,rust-capnp-0.13)
81 ("rust-capnp-rpc" ,rust-capnp-rpc-0.13)
82 ("rust-capnpc" ,rust-capnpc-0.13)
83 ("rust-chrono" ,rust-chrono-0.4) ;; for sqv, sop
84 ("rust-clap" ,rust-clap-2) ;; for sqv
85 ("rust-colored" ,rust-colored-1.9.1)
86 ("rust-crossterm" ,rust-crossterm-0.13)
87 ("rust-ctor" ,rust-ctor-0.1)
88 ("rust-dirs" ,rust-dirs-2)
89 ("rust-dyn-clone" ,rust-dyn-clone-1)
90 ("rust-ed25519-dalek" ,rust-ed25519-dalek-1)
91 ("rust-eax" ,rust-eax-0.3)
92 ;;("rust-failure" included
93 ("rust-filetime" ,rust-filetime-0.2)
94 ("rust-flate2" ,rust-flate2-1)
95 ("rust-fs2" ,rust-fs2-0.4)
96 ("rust-futures" ,rust-futures-0.3)
97 ("rust-futures-util" ,rust-futures-util-0.3)
98 ("rust-http" ,rust-http-0.2)
99 ("rust-hyper" ,rust-hyper-0.13)
100 ("rust-hyper-tls" ,rust-hyper-tls-0.4)
101 ("rust-idna" ,rust-idna-0.2)
102 ("rust-itertools" ,rust-itertools-0.9) ;; for sq
103 ("rust-lalrpop" ,rust-lalrpop-0.19)
104 ("rust-lalrpop-util" ,rust-lalrpop-util-0.19)
105 ("rust-lazy-static" ,rust-lazy-static-1)
106 ("rust-libc" ,rust-libc-0.2)
107 ("rust-memsec" ,rust-memsec-0.6)
108 ("rust-native-tls" ,rust-native-tls-0.2)
109 ("rust-nettle" ,rust-nettle-7)
110 ("rust-num-bigint-dig" ,rust-num-bigint-dig-0.6)
111 ("rust-parity-tokio-ipc" ,rust-parity-tokio-ipc-0.4)
112 ("rust-percent-encoding" ,rust-percent-encoding-2)
113 ("rust-prettytable-rs" ,rust-prettytable-rs-0.8) ;; for sq
114 ("rust-proc-macro2" ,rust-proc-macro2-1)
115 ("rust-quickcheck" ,rust-quickcheck-0.9)
116 ("rust-rand" ,rust-rand-0.7)
117 ("rust-regex" ,rust-regex-1)
118 ("rust-rusqlite" ,rust-rusqlite-0.24)
119 ("rust-sha1collisiondetection" ,rust-sha1collisiondetection-0.2)
120 ("rust-socket2", rust-socket2-0.3)
121 ("rust-structopt" ,rust-structopt-0.3) ;; for sop
122 ("rust-tempfile" ,rust-tempfile-3) ;; for sq
123 ("rust-thiserror" ,rust-thiserror-1)
124 ("rust-tokio" ,rust-tokio-0.2)
125 ("rust-tokio-core" ,rust-tokio-core-0.1)
126 ("rust-unicode-normalization" ,rust-unicode-normalization-0.1)
127 ("rust-url" ,rust-url-2)
128 ("rust-win-crypto-ng" ,rust-win-crypto-ng-0.4)
129 ("rust-winapi" ,rust-winapi-0.3)
130 ("rust-zbase32" ,rust-zbase32-0.1))
131 #:cargo-development-inputs
132 (("rust-assert-cli" ,rust-assert-cli-0.6) ;; dev-dep for for sq, sqv
133 ("rust-bindgen" ,rust-bindgen-0.51) ;; FIXME for nettle-sys and rusqlite
134 ;;("rust-lalrpop" ,rust-lalrpop-0.19)
135 ("rust-quickcheck" ,rust-quickcheck-0.9)
136 ("rust-rand" ,rust-rand-0.7)
137 ("rust-rpassword" ,rust-rpassword-5))
138 #:phases
139 (modify-phases %standard-phases
140 ;; Run make instead of using the rust build system, as
141 ;; suggested by the installation instructions
142 (replace 'build (lambda _ (invoke "make" "build-release") #t))
143 (delete 'package) ;; cargo can't package a multi-crate workspace
144 (replace 'check
145 (lambda* (#:key tests? #:allow-other-keys)
146 (if tests?
147 (invoke "make" "check")
148 #t)))
149 (replace 'install (lambda _ (invoke "make" "install") #t))
150 (add-after 'unpack 'fix-rand-dependency
151 (lambda _
152 (substitute* "ipc/Cargo.toml"
153 ;; required: enable rand::rngs::OsRng in rand >= 0.8
154 (("(^rand =.*,) default-features = false(.*)" _ a b)
155 (string-append a " features = [\"getrandom\"]" b)))
156 #t))
157 (add-after 'unpack 'fix-permissions
158 (lambda _
159 (chmod "sq/src/sq-usage.rs" #o644)
160 (chmod "sqv/src/sqv-usage.rs" #o644)
161 #t))
162 (add-after 'unpack 'fix-environment
163 (lambda* (#:key outputs #:allow-other-keys)
164 ;; adjust prefix
165 (setenv "PREFIX" (assoc-ref outputs "out"))
166 ;; fix install script detection
167 (setenv "INSTALL" "install")
168 #t))
169 (add-after 'unpack 'fix-fo-python-output
170 (lambda* (#:key outputs #:allow-other-keys)
171 (let ((out (assoc-ref outputs "out"))
172 (pyout (assoc-ref outputs "python")))
173 (substitute* "ffi/lang/python/Makefile"
174 ;; adjust prefix for python package
175 (("PREFIX\\s*\\??=.*")
176 (string-append "PREFIX = " pyout "\n"))
177 ;; fix rpath to include the main package
178 (("\\WLDFLAGS=" text)
179 (string-append text "'-Wl,-rpath=" out "/lib '"))
180 ;; make setuptools install into the prefix, see
181 ;; guix/build/python-build-system.scm for explanation
182 (("\\ssetup.py\\s+install\\s")
183 " setup.py install --root=/ --single-version-externally-managed "))
184 #t)))
185 (add-after 'unpack 'fix-pkgconfig-file-substitutes
186 ;; preempt Makefiles replacing PREFIX by pwd
187 (lambda* (#:key outputs #:allow-other-keys)
188 (let ((out (assoc-ref outputs "out")))
189 (substitute* "ffi/sequoia.pc.in"
190 (("PREFIX") out))
191 (substitute* "openpgp-ffi/sequoia-openpgp.pc.in"
192 (("PREFIX") out))
193 #t)))
194 (add-after 'unpack 'keep-SOURCE_DATE_EPOCH
195 (lambda _
196 ;; preempt Makefiles replacing SOURCE_DATE_EPOCH
197 (substitute* "Makefile"
198 (("SOURCE_DATE_EPOCH\\s=" line)
199 (string-append "#" line)))
200 #t))
201 (add-after 'unpack 'set-missing-env-vars
202 (lambda* (#:key inputs #:allow-other-keys)
203 ;; FIXME: why do we need to set this here?
204 (setenv "LIBCLANG_PATH"
205 (string-append (assoc-ref inputs "clang") "/lib"))
206 #t))
207 (add-after 'unpack 'unpin-deps
208 (lambda _
209 ;; As the comment in that file explains, upstream encourages
210 ;; unpinning, as the pinned version is only to make sure the crate
211 ;; compiles on older versions of rustc
212 (substitute* '("openpgp/Cargo.toml" "sq/Cargo.toml")
213 (("= \"=") "= \""))
214 #t)))))
215 (home-page "https://sequoia-pgp.org")
216 (synopsis "New OpenPGP implementation")
217 (description "Sequoia is a new OpenPGP implementation. It consists of
218 several crates, providing both a low-level and a high-level API for dealing
219 with OpenPGP data.")
220 (license license:gpl2+)))
221
222 (define-public sequoia4pEp
223 ;; Currently pEp Engine requires sequoia in not-so-current version
224 (package/inherit sequoia
225 (name "sequoia")
226 (version "0.15.0-pEp")
227 (source
228 (origin
229 (method git-fetch)
230 (uri (git-reference
231 (url "https://gitlab.com/sequoia-pgp/sequoia.git")
232 (commit "0eb1b6cd846ea8c36b3dfdf01ec88383fc64f2fe")))
233 (sha256
234 (base32 "06dqs9whwp9lfibwp8dqm0aw4nm3s3v4jp2n4fz51zcvsld40nfh"))
235 (file-name (git-file-name name version))))
236 (arguments
237 (substitute-keyword-arguments (package-arguments sequoia)
238 ((#:cargo-inputs _)
239 `(("rust-anyhow" ,rust-anyhow-1)
240 ("rust-base64" ,rust-base64-0.11)
241 ("rust-bzip2" ,rust-bzip2-0.3)
242 ("rust-capnp" ,rust-capnp-0.10)
243 ("rust-capnp-rpc" ,rust-capnp-rpc-0.10)
244 ("rust-chrono" ,rust-chrono-0.4)
245 ("rust-clap" ,rust-clap-2)
246 ("rust-crossterm" ,rust-crossterm-0.13)
247 ("rust-dirs" ,rust-dirs-2)
248 ("rust-flate2" ,rust-flate2-1)
249 ("rust-fs2" ,rust-fs2-0.4)
250 ("rust-futures" ,rust-futures-0.1)
251 ("rust-http" ,rust-http-0.1)
252 ("rust-hyper" ,rust-hyper-0.12)
253 ("rust-hyper-tls" ,rust-hyper-tls-0.3)
254 ("rust-idna" ,rust-idna-0.2)
255 ("rust-itertools" ,rust-itertools-0.8)
256 ("rust-lalrpop" ,rust-lalrpop-0.17)
257 ("rust-lalrpop-util" ,rust-lalrpop-util-0.17)
258 ("rust-lazy-static" ,rust-lazy-static-1)
259 ("rust-libc" ,rust-libc-0.2)
260 ("rust-memsec" ,rust-memsec-0.5)
261 ("rust-native-tls" ,rust-native-tls-0.2)
262 ("rust-nettle" ,rust-nettle-7)
263 ("rust-percent-encoding" ,rust-percent-encoding-2)
264 ("rust-prettytable-rs" ,rust-prettytable-rs-0.8)
265 ("rust-proc-macro2" ,rust-proc-macro2-1)
266 ("rust-quickcheck" ,rust-quickcheck-0.9)
267 ("rust-quote" ,rust-quote-1)
268 ("rust-rand" ,rust-rand-0.7)
269 ("rust-regex" ,rust-regex-1)
270 ("rust-rpassword" ,rust-rpassword-4)
271 ("rust-rusqlite" ,rust-rusqlite-0.19)
272 ("rust-sha2" ,rust-sha2-0.8)
273 ("rust-syn" ,rust-syn-1)
274 ("rust-tempfile" ,rust-tempfile-3)
275 ("rust-thiserror" ,rust-thiserror-1)
276 ("rust-tokio" ,rust-tokio-0.1)
277 ("rust-tokio-core" ,rust-tokio-core-0.1)
278 ("rust-tokio-io" ,rust-tokio-io-0.1)
279 ("rust-unicode-normalization" ,rust-unicode-normalization-0.1)
280 ("rust-url" ,rust-url-2)
281 ("rust-zbase32" ,rust-zbase32-0.1)))
282 ((#:cargo-development-inputs _)
283 `(("rust-assert-cli" ,rust-assert-cli-0.6)
284 ("rust-colored" ,rust-colored-1)
285 ("rust-filetime" ,rust-filetime-0.2)))
286 ((#:phases phases)
287 `(modify-phases ,phases
288 (replace 'unpin-deps
289 (lambda _
290 (substitute* (find-files "." "Cargo.toml")
291 (("= \"<") "= \"")
292 (("= \"=") "= \""))
293 #t))))))
294 (properties `((hidden? . #t)))))