Commit | Line | Data |
---|---|---|
4c4ae8b5 HG |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2019, 2020 Hartmut Goebel <h.goebel@crazy-compilers.com> | |
ff1c7e40 | 3 | ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il> |
4c4ae8b5 HG |
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) | |
ff1c7e40 | 26 | #:use-module (guix utils) |
4c4ae8b5 HG |
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 | |
6f9edf40 | 37 | #:use-module (gnu packages rust) |
4c4ae8b5 HG |
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") | |
a240686c | 45 | (version "1.0.0") |
4c4ae8b5 HG |
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 "v" version)))) | |
52 | (sha256 | |
a240686c | 53 | (base32 "0y80bl786m29ww3272qsl1ql0xc3pwd6iiqlkv3nmhnjsmygbn0d")) |
4c4ae8b5 HG |
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) | |
6f9edf40 HG |
61 | ("python-pytest-runner" ,python-pytest-runner) |
62 | ("python-wrapper" ,python-wrapper))) | |
4c4ae8b5 HG |
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 | |
6f9edf40 | 73 | #:rust ,rust-1.46 |
4c4ae8b5 | 74 | #:cargo-inputs |
d76f073a | 75 | (("rust-anyhow" ,rust-anyhow-1) |
6f9edf40 HG |
76 | ("rust-backtrace" ,rust-backtrace-0.3) |
77 | ("rust-base64" ,rust-base64-0.13) | |
4c4ae8b5 | 78 | ;;("rust-buffered-reader" included |
6f9edf40 | 79 | ("rust-bzip2" ,rust-bzip2-0.4) |
a240686c HG |
80 | ("rust-capnp" ,rust-capnp-0.13) |
81 | ("rust-capnp-rpc" ,rust-capnp-rpc-0.13) | |
82 | ("rust-capnpc" ,rust-capnpc-0.13) | |
6f9edf40 HG |
83 | ("rust-chrono" ,rust-chrono-0.4) ;; for sqv, sop |
84 | ("rust-clap" ,rust-clap-2) ;; for sqv | |
4c4ae8b5 HG |
85 | ("rust-colored" ,rust-colored-1.9.1) |
86 | ("rust-crossterm" ,rust-crossterm-0.13) | |
df4d2dda | 87 | ("rust-ctor" ,rust-ctor-0.1) |
880e6334 | 88 | ("rust-dirs" ,rust-dirs-2) |
6f9edf40 HG |
89 | ("rust-dyn-clone" ,rust-dyn-clone-1) |
90 | ("rust-ed25519-dalek" ,rust-ed25519-dalek-1) | |
a240686c | 91 | ("rust-eax" ,rust-eax-0.3) |
4c4ae8b5 HG |
92 | ;;("rust-failure" included |
93 | ("rust-filetime" ,rust-filetime-0.2) | |
93922eec | 94 | ("rust-flate2" ,rust-flate2-1) |
4c4ae8b5 | 95 | ("rust-fs2" ,rust-fs2-0.4) |
a240686c HG |
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) | |
df4d2dda | 101 | ("rust-idna" ,rust-idna-0.2) |
6f9edf40 HG |
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) | |
df4d2dda | 105 | ("rust-lazy-static" ,rust-lazy-static-1) |
4c4ae8b5 | 106 | ("rust-libc" ,rust-libc-0.2) |
6f9edf40 | 107 | ("rust-memsec" ,rust-memsec-0.6) |
4c4ae8b5 | 108 | ("rust-native-tls" ,rust-native-tls-0.2) |
df4d2dda | 109 | ("rust-nettle" ,rust-nettle-7) |
6f9edf40 | 110 | ("rust-num-bigint-dig" ,rust-num-bigint-dig-0.6) |
4c4ae8b5 | 111 | ("rust-parity-tokio-ipc" ,rust-parity-tokio-ipc-0.4) |
2cc9d2a7 | 112 | ("rust-percent-encoding" ,rust-percent-encoding-2) |
6f9edf40 | 113 | ("rust-prettytable-rs" ,rust-prettytable-rs-0.8) ;; for sq |
0a568bbc | 114 | ("rust-proc-macro2" ,rust-proc-macro2-1) |
df4d2dda EF |
115 | ("rust-quickcheck" ,rust-quickcheck-0.9) |
116 | ("rust-rand" ,rust-rand-0.7) | |
6cd7b355 | 117 | ("rust-regex" ,rust-regex-1) |
6f9edf40 | 118 | ("rust-rusqlite" ,rust-rusqlite-0.24) |
a240686c HG |
119 | ("rust-sha1collisiondetection" ,rust-sha1collisiondetection-0.2) |
120 | ("rust-socket2", rust-socket2-0.3) | |
6f9edf40 HG |
121 | ("rust-structopt" ,rust-structopt-0.3) ;; for sop |
122 | ("rust-tempfile" ,rust-tempfile-3) ;; for sq | |
262e40d0 | 123 | ("rust-thiserror" ,rust-thiserror-1) |
a240686c | 124 | ("rust-tokio" ,rust-tokio-0.2) |
4c4ae8b5 | 125 | ("rust-tokio-core" ,rust-tokio-core-0.1) |
df4d2dda | 126 | ("rust-unicode-normalization" ,rust-unicode-normalization-0.1) |
ff4d0937 | 127 | ("rust-url" ,rust-url-2) |
a240686c | 128 | ("rust-win-crypto-ng" ,rust-win-crypto-ng-0.4) |
6f9edf40 | 129 | ("rust-winapi" ,rust-winapi-0.3) |
4c4ae8b5 HG |
130 | ("rust-zbase32" ,rust-zbase32-0.1)) |
131 | #:cargo-development-inputs | |
6f9edf40 HG |
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)) | |
4c4ae8b5 HG |
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 | (replace 'check | |
144 | (lambda* (#:key tests? #:allow-other-keys) | |
145 | (if tests? | |
146 | (invoke "make" "check") | |
147 | #t))) | |
148 | (replace 'install (lambda _ (invoke "make" "install") #t)) | |
6f9edf40 | 149 | (add-after 'unpack 'fix-environment |
4c4ae8b5 | 150 | (lambda* (#:key outputs #:allow-other-keys) |
6f9edf40 | 151 | ;; adjust prefix |
4c4ae8b5 | 152 | (setenv "PREFIX" (assoc-ref outputs "out")) |
6f9edf40 HG |
153 | ;; fix install script detection |
154 | (setenv "INSTALL" "install") | |
4c4ae8b5 HG |
155 | #t)) |
156 | (add-after 'unpack 'fix-fo-python-output | |
157 | (lambda* (#:key outputs #:allow-other-keys) | |
158 | (let ((out (assoc-ref outputs "out")) | |
159 | (pyout (assoc-ref outputs "python"))) | |
160 | (substitute* "ffi/lang/python/Makefile" | |
161 | ;; adjust prefix for python package | |
162 | (("PREFIX\\s*\\??=.*") | |
163 | (string-append "PREFIX = " pyout "\n")) | |
164 | ;; fix rpath to include the main package | |
165 | (("\\WLDFLAGS=" text) | |
166 | (string-append text "'-Wl,-rpath=" out "/lib '")) | |
167 | ;; make setuptools install into the prefix, see | |
168 | ;; guix/build/python-build-system.scm for explanation | |
169 | (("\\ssetup.py\\s+install\\s") | |
170 | " setup.py install --root=/ --single-version-externally-managed ")) | |
171 | #t))) | |
fbe17e24 HG |
172 | (add-after 'unpack 'fix-pkgconfig-file-substitutes |
173 | ;; preempt Makefiles replacing PREFIX by pwd | |
174 | (lambda* (#:key outputs #:allow-other-keys) | |
175 | (let ((out (assoc-ref outputs "out"))) | |
176 | (substitute* "ffi/sequoia.pc.in" | |
177 | (("PREFIX") out)) | |
178 | (substitute* "openpgp-ffi/sequoia-openpgp.pc.in" | |
179 | (("PREFIX") out)) | |
180 | #t))) | |
6f9edf40 HG |
181 | (add-after 'unpack 'keep-SOURCE_DATE_EPOCH |
182 | (lambda _ | |
183 | ;; preempt Makefiles replacing SOURCE_DATE_EPOCH | |
184 | (substitute* "Makefile" | |
185 | (("SOURCE_DATE_EPOCH\\s=" line) | |
186 | (string-append "#" line))) | |
187 | #t)) | |
4c4ae8b5 HG |
188 | (add-after 'unpack 'set-missing-env-vars |
189 | (lambda* (#:key inputs #:allow-other-keys) | |
190 | ;; FIXME: why do we need to set this here? | |
191 | (setenv "LIBCLANG_PATH" | |
192 | (string-append (assoc-ref inputs "clang") "/lib")) | |
2dab855b JK |
193 | #t)) |
194 | (add-after 'unpack 'unpin-deps | |
195 | (lambda _ | |
196 | ;; As the comment in that file explains, upstream encourages | |
197 | ;; unpinning, as the pinned version is only to make sure the crate | |
198 | ;; compiles on older versions of rustc | |
6f9edf40 | 199 | (substitute* '("openpgp/Cargo.toml" "sq/Cargo.toml") |
2dab855b | 200 | (("= \"=") "= \"")) |
4c4ae8b5 HG |
201 | #t))))) |
202 | (home-page "https://sequoia-pgp.org") | |
203 | (synopsis "New OpenPGP implementation") | |
204 | (description "Sequoia is a new OpenPGP implementation. It consists of | |
205 | several crates, providing both a low-level and a high-level API for dealing | |
206 | with OpenPGP data.") | |
207 | (license license:gpl2+))) | |
4d0fe40f EF |
208 | |
209 | (define-public sequoia4pEp | |
210 | ;; Currently pEp Engine requires sequoia in not-so-current version | |
211 | (package/inherit sequoia | |
212 | (name "sequoia") | |
213 | (version "0.15.0-pEp") | |
214 | (source | |
215 | (origin | |
216 | (method git-fetch) | |
217 | (uri (git-reference | |
218 | (url "https://gitlab.com/sequoia-pgp/sequoia.git") | |
219 | (commit "0eb1b6cd846ea8c36b3dfdf01ec88383fc64f2fe"))) | |
220 | (sha256 | |
221 | (base32 "06dqs9whwp9lfibwp8dqm0aw4nm3s3v4jp2n4fz51zcvsld40nfh")) | |
222 | (file-name (git-file-name name version)))) | |
ff1c7e40 EF |
223 | (arguments |
224 | (substitute-keyword-arguments (package-arguments sequoia) | |
225 | ((#:cargo-inputs _) | |
226 | `(("rust-anyhow" ,rust-anyhow-1) | |
227 | ("rust-base64" ,rust-base64-0.11) | |
228 | ("rust-bzip2" ,rust-bzip2-0.3) | |
229 | ("rust-capnp" ,rust-capnp-0.10) | |
230 | ("rust-capnp-rpc" ,rust-capnp-rpc-0.10) | |
231 | ("rust-chrono" ,rust-chrono-0.4) | |
232 | ("rust-clap" ,rust-clap-2) | |
233 | ("rust-crossterm" ,rust-crossterm-0.13) | |
234 | ("rust-dirs" ,rust-dirs-2) | |
235 | ("rust-flate2" ,rust-flate2-1) | |
236 | ("rust-fs2" ,rust-fs2-0.4) | |
237 | ("rust-futures" ,rust-futures-0.1) | |
238 | ("rust-http" ,rust-http-0.1) | |
239 | ("rust-hyper" ,rust-hyper-0.12) | |
240 | ("rust-hyper-tls" ,rust-hyper-tls-0.3) | |
241 | ("rust-idna" ,rust-idna-0.2) | |
242 | ("rust-itertools" ,rust-itertools-0.8) | |
243 | ("rust-lalrpop" ,rust-lalrpop-0.17) | |
244 | ("rust-lalrpop-util" ,rust-lalrpop-util-0.17) | |
245 | ("rust-lazy-static" ,rust-lazy-static-1) | |
246 | ("rust-libc" ,rust-libc-0.2) | |
247 | ("rust-memsec" ,rust-memsec-0.5) | |
248 | ("rust-native-tls" ,rust-native-tls-0.2) | |
249 | ("rust-nettle" ,rust-nettle-7) | |
250 | ("rust-percent-encoding" ,rust-percent-encoding-2) | |
251 | ("rust-prettytable-rs" ,rust-prettytable-rs-0.8) | |
252 | ("rust-proc-macro2" ,rust-proc-macro2-1) | |
253 | ("rust-quickcheck" ,rust-quickcheck-0.9) | |
254 | ("rust-quote" ,rust-quote-1) | |
255 | ("rust-rand" ,rust-rand-0.7) | |
256 | ("rust-regex" ,rust-regex-1) | |
257 | ("rust-rpassword" ,rust-rpassword-4) | |
258 | ("rust-rusqlite" ,rust-rusqlite-0.19) | |
259 | ("rust-sha2" ,rust-sha2-0.8) | |
260 | ("rust-syn" ,rust-syn-1) | |
261 | ("rust-tempfile" ,rust-tempfile-3) | |
262 | ("rust-thiserror" ,rust-thiserror-1) | |
263 | ("rust-tokio" ,rust-tokio-0.1) | |
264 | ("rust-tokio-core" ,rust-tokio-core-0.1) | |
265 | ("rust-tokio-io" ,rust-tokio-io-0.1) | |
266 | ("rust-unicode-normalization" ,rust-unicode-normalization-0.1) | |
267 | ("rust-url" ,rust-url-2) | |
268 | ("rust-zbase32" ,rust-zbase32-0.1))) | |
269 | ((#:cargo-development-inputs _) | |
270 | `(("rust-assert-cli" ,rust-assert-cli-0.6) | |
271 | ("rust-colored" ,rust-colored-1) | |
272 | ("rust-filetime" ,rust-filetime-0.2))) | |
273 | ((#:phases phases) | |
274 | `(modify-phases ,phases | |
275 | (replace 'unpin-deps | |
276 | (lambda _ | |
277 | (substitute* (find-files "." "Cargo.toml") | |
278 | (("= \"<") "= \"") | |
279 | (("= \"=") "= \"")) | |
280 | #t)))))) | |
4d0fe40f | 281 | (properties `((hidden? . #t))))) |