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") | |
6f9edf40 | 43 | (version "0.20.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 | |
6f9edf40 | 51 | (base32 "1c76sz4y0n4jhf1gq4b87v5c07i09mmd3i6sqki09bd96m3ldgkf")) |
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) |
4c4ae8b5 HG |
78 | ("rust-capnp" ,rust-capnp-0.10) |
79 | ("rust-capnp-rpc" ,rust-capnp-rpc-0.10) | |
80 | ("rust-capnpc" ,rust-capnpc-0.10) | |
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) |
4c4ae8b5 | 86 | ("rust-dirs" ,rust-dirs-2.0) |
6f9edf40 HG |
87 | ("rust-dyn-clone" ,rust-dyn-clone-1) |
88 | ("rust-ed25519-dalek" ,rust-ed25519-dalek-1) | |
4c4ae8b5 HG |
89 | ;;("rust-failure" included |
90 | ("rust-filetime" ,rust-filetime-0.2) | |
93922eec | 91 | ("rust-flate2" ,rust-flate2-1) |
4c4ae8b5 HG |
92 | ("rust-fs2" ,rust-fs2-0.4) |
93 | ("rust-futures" ,rust-futures-0.1) | |
94 | ("rust-http" ,rust-http-0.1) | |
95 | ("rust-hyper" ,rust-hyper-0.12) | |
96 | ("rust-hyper-tls" ,rust-hyper-tls-0.3) | |
df4d2dda | 97 | ("rust-idna" ,rust-idna-0.2) |
6f9edf40 HG |
98 | ("rust-itertools" ,rust-itertools-0.9) ;; for sq |
99 | ("rust-lalrpop" ,rust-lalrpop-0.19) | |
100 | ("rust-lalrpop-util" ,rust-lalrpop-util-0.19) | |
df4d2dda | 101 | ("rust-lazy-static" ,rust-lazy-static-1) |
4c4ae8b5 | 102 | ("rust-libc" ,rust-libc-0.2) |
6f9edf40 | 103 | ("rust-memsec" ,rust-memsec-0.6) |
4c4ae8b5 | 104 | ("rust-native-tls" ,rust-native-tls-0.2) |
df4d2dda | 105 | ("rust-nettle" ,rust-nettle-7) |
6f9edf40 | 106 | ("rust-num-bigint-dig" ,rust-num-bigint-dig-0.6) |
4c4ae8b5 | 107 | ("rust-parity-tokio-ipc" ,rust-parity-tokio-ipc-0.4) |
2cc9d2a7 | 108 | ("rust-percent-encoding" ,rust-percent-encoding-2) |
6f9edf40 | 109 | ("rust-prettytable-rs" ,rust-prettytable-rs-0.8) ;; for sq |
0a568bbc | 110 | ("rust-proc-macro2" ,rust-proc-macro2-1) |
df4d2dda EF |
111 | ("rust-quickcheck" ,rust-quickcheck-0.9) |
112 | ("rust-rand" ,rust-rand-0.7) | |
6cd7b355 | 113 | ("rust-regex" ,rust-regex-1) |
6f9edf40 HG |
114 | ("rust-rusqlite" ,rust-rusqlite-0.24) |
115 | ("rust-structopt" ,rust-structopt-0.3) ;; for sop | |
116 | ("rust-tempfile" ,rust-tempfile-3) ;; for sq | |
262e40d0 | 117 | ("rust-thiserror" ,rust-thiserror-1) |
4c4ae8b5 HG |
118 | ("rust-tokio" ,rust-tokio-0.1) |
119 | ("rust-tokio-core" ,rust-tokio-core-0.1) | |
df4d2dda | 120 | ("rust-unicode-normalization" ,rust-unicode-normalization-0.1) |
ff4d0937 | 121 | ("rust-url" ,rust-url-2) |
6f9edf40 HG |
122 | ("rust-win-crypto-ng" ,rust-win-crypto-ng-0.2) |
123 | ("rust-winapi" ,rust-winapi-0.3) | |
4c4ae8b5 HG |
124 | ("rust-zbase32" ,rust-zbase32-0.1)) |
125 | #:cargo-development-inputs | |
6f9edf40 HG |
126 | (("rust-assert-cli" ,rust-assert-cli-0.6) ;; dev-dep for for sq, sqv |
127 | ("rust-bindgen" ,rust-bindgen-0.51) ;; FIXME for nettle-sys and rusqlite | |
128 | ;;("rust-lalrpop" ,rust-lalrpop-0.19) | |
129 | ("rust-quickcheck" ,rust-quickcheck-0.9) | |
130 | ("rust-rand" ,rust-rand-0.7) | |
131 | ("rust-rpassword" ,rust-rpassword-5)) | |
4c4ae8b5 HG |
132 | #:phases |
133 | (modify-phases %standard-phases | |
134 | ;; Run make instead of using the rust build system, as | |
135 | ;; suggested by the installation instructions | |
136 | (replace 'build (lambda _ (invoke "make" "build-release") #t)) | |
137 | (replace 'check | |
138 | (lambda* (#:key tests? #:allow-other-keys) | |
139 | (if tests? | |
140 | (invoke "make" "check") | |
141 | #t))) | |
142 | (replace 'install (lambda _ (invoke "make" "install") #t)) | |
6f9edf40 | 143 | (add-after 'unpack 'fix-environment |
4c4ae8b5 | 144 | (lambda* (#:key outputs #:allow-other-keys) |
6f9edf40 | 145 | ;; adjust prefix |
4c4ae8b5 | 146 | (setenv "PREFIX" (assoc-ref outputs "out")) |
6f9edf40 HG |
147 | ;; fix install script detection |
148 | (setenv "INSTALL" "install") | |
4c4ae8b5 HG |
149 | #t)) |
150 | (add-after 'unpack 'fix-fo-python-output | |
151 | (lambda* (#:key outputs #:allow-other-keys) | |
152 | (let ((out (assoc-ref outputs "out")) | |
153 | (pyout (assoc-ref outputs "python"))) | |
154 | (substitute* "ffi/lang/python/Makefile" | |
155 | ;; adjust prefix for python package | |
156 | (("PREFIX\\s*\\??=.*") | |
157 | (string-append "PREFIX = " pyout "\n")) | |
158 | ;; fix rpath to include the main package | |
159 | (("\\WLDFLAGS=" text) | |
160 | (string-append text "'-Wl,-rpath=" out "/lib '")) | |
161 | ;; make setuptools install into the prefix, see | |
162 | ;; guix/build/python-build-system.scm for explanation | |
163 | (("\\ssetup.py\\s+install\\s") | |
164 | " setup.py install --root=/ --single-version-externally-managed ")) | |
165 | #t))) | |
fbe17e24 HG |
166 | (add-after 'unpack 'fix-pkgconfig-file-substitutes |
167 | ;; preempt Makefiles replacing PREFIX by pwd | |
168 | (lambda* (#:key outputs #:allow-other-keys) | |
169 | (let ((out (assoc-ref outputs "out"))) | |
170 | (substitute* "ffi/sequoia.pc.in" | |
171 | (("PREFIX") out)) | |
172 | (substitute* "openpgp-ffi/sequoia-openpgp.pc.in" | |
173 | (("PREFIX") out)) | |
174 | #t))) | |
6f9edf40 HG |
175 | (add-after 'unpack 'keep-SOURCE_DATE_EPOCH |
176 | (lambda _ | |
177 | ;; preempt Makefiles replacing SOURCE_DATE_EPOCH | |
178 | (substitute* "Makefile" | |
179 | (("SOURCE_DATE_EPOCH\\s=" line) | |
180 | (string-append "#" line))) | |
181 | #t)) | |
4c4ae8b5 HG |
182 | (add-after 'unpack 'set-missing-env-vars |
183 | (lambda* (#:key inputs #:allow-other-keys) | |
184 | ;; FIXME: why do we need to set this here? | |
185 | (setenv "LIBCLANG_PATH" | |
186 | (string-append (assoc-ref inputs "clang") "/lib")) | |
2dab855b JK |
187 | #t)) |
188 | (add-after 'unpack 'unpin-deps | |
189 | (lambda _ | |
190 | ;; As the comment in that file explains, upstream encourages | |
191 | ;; unpinning, as the pinned version is only to make sure the crate | |
192 | ;; compiles on older versions of rustc | |
6f9edf40 | 193 | (substitute* '("openpgp/Cargo.toml" "sq/Cargo.toml") |
2dab855b | 194 | (("= \"=") "= \"")) |
4c4ae8b5 HG |
195 | #t))))) |
196 | (home-page "https://sequoia-pgp.org") | |
197 | (synopsis "New OpenPGP implementation") | |
198 | (description "Sequoia is a new OpenPGP implementation. It consists of | |
199 | several crates, providing both a low-level and a high-level API for dealing | |
200 | with OpenPGP data.") | |
201 | (license license:gpl2+))) |