Commit | Line | Data |
---|---|---|
4c4ae8b5 HG |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2019, 2020 Hartmut Goebel <h.goebel@crazy-compilers.com> | |
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 sequoia) | |
20 | #:use-module (guix build-system cargo) | |
21 | #:use-module (guix download) | |
22 | #:use-module (guix git-download) | |
23 | #:use-module ((guix licenses) #:prefix license:) | |
24 | #:use-module (guix packages) | |
25 | #:use-module (gnu packages) | |
26 | #:use-module (gnu packages check) ;; python-pytest | |
27 | #:use-module (gnu packages crates-io) | |
28 | #:use-module (gnu packages libffi) ;; python-cffi | |
29 | #:use-module (gnu packages llvm) | |
30 | #:use-module (gnu packages multiprecision) | |
31 | #:use-module (gnu packages nettle) | |
32 | #:use-module (gnu packages pkg-config) | |
33 | #:use-module (gnu packages python) | |
34 | #:use-module (gnu packages python-xyz) ;; python-setuptools | |
6f9edf40 | 35 | #:use-module (gnu packages rust) |
4c4ae8b5 HG |
36 | #:use-module (gnu packages serialization) |
37 | #:use-module (gnu packages sqlite) | |
38 | #:use-module (gnu packages tls)) | |
39 | ||
40 | (define-public sequoia | |
41 | (package | |
42 | (name "sequoia") | |
a240686c | 43 | (version "1.0.0") |
4c4ae8b5 HG |
44 | (source |
45 | (origin | |
46 | (method git-fetch) | |
47 | (uri (git-reference | |
48 | (url "https://gitlab.com/sequoia-pgp/sequoia.git") | |
49 | (commit (string-append "v" version)))) | |
50 | (sha256 | |
a240686c | 51 | (base32 "0y80bl786m29ww3272qsl1ql0xc3pwd6iiqlkv3nmhnjsmygbn0d")) |
4c4ae8b5 HG |
52 | (file-name (git-file-name name version)))) |
53 | (build-system cargo-build-system) | |
54 | (outputs '("out" "python")) | |
55 | (native-inputs | |
56 | `(("clang" ,clang) | |
57 | ("pkg-config" ,pkg-config) | |
58 | ("python-pytest" ,python-pytest) | |
6f9edf40 HG |
59 | ("python-pytest-runner" ,python-pytest-runner) |
60 | ("python-wrapper" ,python-wrapper))) | |
4c4ae8b5 HG |
61 | (inputs |
62 | `(("capnproto" ,capnproto) | |
63 | ("gmp" ,gmp) | |
64 | ("nettle" ,nettle) | |
65 | ("openssl" ,openssl) | |
66 | ("python" ,python) | |
67 | ("python-cffi" ,python-cffi) | |
68 | ("sqlite" ,sqlite))) | |
69 | (arguments | |
70 | `(#:tests? #f ;; building the tests requires 9.7GB total | |
6f9edf40 | 71 | #:rust ,rust-1.46 |
4c4ae8b5 | 72 | #:cargo-inputs |
d76f073a | 73 | (("rust-anyhow" ,rust-anyhow-1) |
6f9edf40 HG |
74 | ("rust-backtrace" ,rust-backtrace-0.3) |
75 | ("rust-base64" ,rust-base64-0.13) | |
4c4ae8b5 | 76 | ;;("rust-buffered-reader" included |
6f9edf40 | 77 | ("rust-bzip2" ,rust-bzip2-0.4) |
a240686c HG |
78 | ("rust-capnp" ,rust-capnp-0.13) |
79 | ("rust-capnp-rpc" ,rust-capnp-rpc-0.13) | |
80 | ("rust-capnpc" ,rust-capnpc-0.13) | |
6f9edf40 HG |
81 | ("rust-chrono" ,rust-chrono-0.4) ;; for sqv, sop |
82 | ("rust-clap" ,rust-clap-2) ;; for sqv | |
4c4ae8b5 HG |
83 | ("rust-colored" ,rust-colored-1.9.1) |
84 | ("rust-crossterm" ,rust-crossterm-0.13) | |
df4d2dda | 85 | ("rust-ctor" ,rust-ctor-0.1) |
880e6334 | 86 | ("rust-dirs" ,rust-dirs-2) |
6f9edf40 HG |
87 | ("rust-dyn-clone" ,rust-dyn-clone-1) |
88 | ("rust-ed25519-dalek" ,rust-ed25519-dalek-1) | |
a240686c | 89 | ("rust-eax" ,rust-eax-0.3) |
4c4ae8b5 HG |
90 | ;;("rust-failure" included |
91 | ("rust-filetime" ,rust-filetime-0.2) | |
93922eec | 92 | ("rust-flate2" ,rust-flate2-1) |
4c4ae8b5 | 93 | ("rust-fs2" ,rust-fs2-0.4) |
a240686c HG |
94 | ("rust-futures" ,rust-futures-0.3) |
95 | ("rust-futures-util" ,rust-futures-util-0.3) | |
96 | ("rust-http" ,rust-http-0.2) | |
97 | ("rust-hyper" ,rust-hyper-0.13) | |
98 | ("rust-hyper-tls" ,rust-hyper-tls-0.4) | |
df4d2dda | 99 | ("rust-idna" ,rust-idna-0.2) |
6f9edf40 HG |
100 | ("rust-itertools" ,rust-itertools-0.9) ;; for sq |
101 | ("rust-lalrpop" ,rust-lalrpop-0.19) | |
102 | ("rust-lalrpop-util" ,rust-lalrpop-util-0.19) | |
df4d2dda | 103 | ("rust-lazy-static" ,rust-lazy-static-1) |
4c4ae8b5 | 104 | ("rust-libc" ,rust-libc-0.2) |
6f9edf40 | 105 | ("rust-memsec" ,rust-memsec-0.6) |
4c4ae8b5 | 106 | ("rust-native-tls" ,rust-native-tls-0.2) |
df4d2dda | 107 | ("rust-nettle" ,rust-nettle-7) |
6f9edf40 | 108 | ("rust-num-bigint-dig" ,rust-num-bigint-dig-0.6) |
4c4ae8b5 | 109 | ("rust-parity-tokio-ipc" ,rust-parity-tokio-ipc-0.4) |
2cc9d2a7 | 110 | ("rust-percent-encoding" ,rust-percent-encoding-2) |
6f9edf40 | 111 | ("rust-prettytable-rs" ,rust-prettytable-rs-0.8) ;; for sq |
0a568bbc | 112 | ("rust-proc-macro2" ,rust-proc-macro2-1) |
df4d2dda EF |
113 | ("rust-quickcheck" ,rust-quickcheck-0.9) |
114 | ("rust-rand" ,rust-rand-0.7) | |
6cd7b355 | 115 | ("rust-regex" ,rust-regex-1) |
6f9edf40 | 116 | ("rust-rusqlite" ,rust-rusqlite-0.24) |
a240686c HG |
117 | ("rust-sha1collisiondetection" ,rust-sha1collisiondetection-0.2) |
118 | ("rust-socket2", rust-socket2-0.3) | |
6f9edf40 HG |
119 | ("rust-structopt" ,rust-structopt-0.3) ;; for sop |
120 | ("rust-tempfile" ,rust-tempfile-3) ;; for sq | |
262e40d0 | 121 | ("rust-thiserror" ,rust-thiserror-1) |
a240686c | 122 | ("rust-tokio" ,rust-tokio-0.2) |
4c4ae8b5 | 123 | ("rust-tokio-core" ,rust-tokio-core-0.1) |
df4d2dda | 124 | ("rust-unicode-normalization" ,rust-unicode-normalization-0.1) |
ff4d0937 | 125 | ("rust-url" ,rust-url-2) |
a240686c | 126 | ("rust-win-crypto-ng" ,rust-win-crypto-ng-0.4) |
6f9edf40 | 127 | ("rust-winapi" ,rust-winapi-0.3) |
4c4ae8b5 HG |
128 | ("rust-zbase32" ,rust-zbase32-0.1)) |
129 | #:cargo-development-inputs | |
6f9edf40 HG |
130 | (("rust-assert-cli" ,rust-assert-cli-0.6) ;; dev-dep for for sq, sqv |
131 | ("rust-bindgen" ,rust-bindgen-0.51) ;; FIXME for nettle-sys and rusqlite | |
132 | ;;("rust-lalrpop" ,rust-lalrpop-0.19) | |
133 | ("rust-quickcheck" ,rust-quickcheck-0.9) | |
134 | ("rust-rand" ,rust-rand-0.7) | |
135 | ("rust-rpassword" ,rust-rpassword-5)) | |
4c4ae8b5 HG |
136 | #:phases |
137 | (modify-phases %standard-phases | |
138 | ;; Run make instead of using the rust build system, as | |
139 | ;; suggested by the installation instructions | |
140 | (replace 'build (lambda _ (invoke "make" "build-release") #t)) | |
141 | (replace 'check | |
142 | (lambda* (#:key tests? #:allow-other-keys) | |
143 | (if tests? | |
144 | (invoke "make" "check") | |
145 | #t))) | |
146 | (replace 'install (lambda _ (invoke "make" "install") #t)) | |
6f9edf40 | 147 | (add-after 'unpack 'fix-environment |
4c4ae8b5 | 148 | (lambda* (#:key outputs #:allow-other-keys) |
6f9edf40 | 149 | ;; adjust prefix |
4c4ae8b5 | 150 | (setenv "PREFIX" (assoc-ref outputs "out")) |
6f9edf40 HG |
151 | ;; fix install script detection |
152 | (setenv "INSTALL" "install") | |
4c4ae8b5 HG |
153 | #t)) |
154 | (add-after 'unpack 'fix-fo-python-output | |
155 | (lambda* (#:key outputs #:allow-other-keys) | |
156 | (let ((out (assoc-ref outputs "out")) | |
157 | (pyout (assoc-ref outputs "python"))) | |
158 | (substitute* "ffi/lang/python/Makefile" | |
159 | ;; adjust prefix for python package | |
160 | (("PREFIX\\s*\\??=.*") | |
161 | (string-append "PREFIX = " pyout "\n")) | |
162 | ;; fix rpath to include the main package | |
163 | (("\\WLDFLAGS=" text) | |
164 | (string-append text "'-Wl,-rpath=" out "/lib '")) | |
165 | ;; make setuptools install into the prefix, see | |
166 | ;; guix/build/python-build-system.scm for explanation | |
167 | (("\\ssetup.py\\s+install\\s") | |
168 | " setup.py install --root=/ --single-version-externally-managed ")) | |
169 | #t))) | |
fbe17e24 HG |
170 | (add-after 'unpack 'fix-pkgconfig-file-substitutes |
171 | ;; preempt Makefiles replacing PREFIX by pwd | |
172 | (lambda* (#:key outputs #:allow-other-keys) | |
173 | (let ((out (assoc-ref outputs "out"))) | |
174 | (substitute* "ffi/sequoia.pc.in" | |
175 | (("PREFIX") out)) | |
176 | (substitute* "openpgp-ffi/sequoia-openpgp.pc.in" | |
177 | (("PREFIX") out)) | |
178 | #t))) | |
6f9edf40 HG |
179 | (add-after 'unpack 'keep-SOURCE_DATE_EPOCH |
180 | (lambda _ | |
181 | ;; preempt Makefiles replacing SOURCE_DATE_EPOCH | |
182 | (substitute* "Makefile" | |
183 | (("SOURCE_DATE_EPOCH\\s=" line) | |
184 | (string-append "#" line))) | |
185 | #t)) | |
4c4ae8b5 HG |
186 | (add-after 'unpack 'set-missing-env-vars |
187 | (lambda* (#:key inputs #:allow-other-keys) | |
188 | ;; FIXME: why do we need to set this here? | |
189 | (setenv "LIBCLANG_PATH" | |
190 | (string-append (assoc-ref inputs "clang") "/lib")) | |
2dab855b JK |
191 | #t)) |
192 | (add-after 'unpack 'unpin-deps | |
193 | (lambda _ | |
194 | ;; As the comment in that file explains, upstream encourages | |
195 | ;; unpinning, as the pinned version is only to make sure the crate | |
196 | ;; compiles on older versions of rustc | |
6f9edf40 | 197 | (substitute* '("openpgp/Cargo.toml" "sq/Cargo.toml") |
2dab855b | 198 | (("= \"=") "= \"")) |
4c4ae8b5 HG |
199 | #t))))) |
200 | (home-page "https://sequoia-pgp.org") | |
201 | (synopsis "New OpenPGP implementation") | |
202 | (description "Sequoia is a new OpenPGP implementation. It consists of | |
203 | several crates, providing both a low-level and a high-level API for dealing | |
204 | with OpenPGP data.") | |
205 | (license license:gpl2+))) | |
4d0fe40f EF |
206 | |
207 | (define-public sequoia4pEp | |
208 | ;; Currently pEp Engine requires sequoia in not-so-current version | |
209 | (package/inherit sequoia | |
210 | (name "sequoia") | |
211 | (version "0.15.0-pEp") | |
212 | (source | |
213 | (origin | |
214 | (method git-fetch) | |
215 | (uri (git-reference | |
216 | (url "https://gitlab.com/sequoia-pgp/sequoia.git") | |
217 | (commit "0eb1b6cd846ea8c36b3dfdf01ec88383fc64f2fe"))) | |
218 | (sha256 | |
219 | (base32 "06dqs9whwp9lfibwp8dqm0aw4nm3s3v4jp2n4fz51zcvsld40nfh")) | |
220 | (file-name (git-file-name name version)))) | |
221 | (properties `((hidden? . #t))))) |