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 | |
35 | #:use-module (gnu packages serialization) | |
36 | #:use-module (gnu packages sqlite) | |
37 | #:use-module (gnu packages tls)) | |
38 | ||
39 | (define-public sequoia | |
40 | (package | |
41 | (name "sequoia") | |
2dab855b | 42 | (version "0.17.0") |
4c4ae8b5 HG |
43 | (source |
44 | (origin | |
45 | (method git-fetch) | |
46 | (uri (git-reference | |
47 | (url "https://gitlab.com/sequoia-pgp/sequoia.git") | |
48 | (commit (string-append "v" version)))) | |
49 | (sha256 | |
2dab855b | 50 | (base32 "1rf9q67qmjfkgy6r3mz1h9ibfmc04r4j8nzacqv2l75x4mwvf6xb")) |
4c4ae8b5 HG |
51 | (file-name (git-file-name name version)))) |
52 | (build-system cargo-build-system) | |
53 | (outputs '("out" "python")) | |
54 | (native-inputs | |
55 | `(("clang" ,clang) | |
56 | ("pkg-config" ,pkg-config) | |
57 | ("python-pytest" ,python-pytest) | |
58 | ("python-pytest-runner" ,python-pytest-runner))) | |
59 | (inputs | |
60 | `(("capnproto" ,capnproto) | |
61 | ("gmp" ,gmp) | |
62 | ("nettle" ,nettle) | |
63 | ("openssl" ,openssl) | |
64 | ("python" ,python) | |
65 | ("python-cffi" ,python-cffi) | |
66 | ("sqlite" ,sqlite))) | |
67 | (arguments | |
68 | `(#:tests? #f ;; building the tests requires 9.7GB total | |
69 | #:cargo-inputs | |
70 | (("rust-assert-cli" ,rust-assert-cli-0.6) | |
71 | ("rust-anyhow" ,rust-anyhow-1.0) | |
df4d2dda | 72 | ("rust-base64" ,rust-base64-0.11) |
4c4ae8b5 | 73 | ;;("rust-buffered-reader" included |
df4d2dda | 74 | ("rust-bzip2" ,rust-bzip2-0.3) |
4c4ae8b5 HG |
75 | ("rust-capnp" ,rust-capnp-0.10) |
76 | ("rust-capnp-rpc" ,rust-capnp-rpc-0.10) | |
77 | ("rust-capnpc" ,rust-capnpc-0.10) | |
78 | ("rust-chrono" ,rust-chrono-0.4) | |
79 | ("rust-clap" ,rust-clap-2) | |
4c4ae8b5 HG |
80 | ("rust-colored" ,rust-colored-1.9.1) |
81 | ("rust-crossterm" ,rust-crossterm-0.13) | |
df4d2dda | 82 | ("rust-ctor" ,rust-ctor-0.1) |
4c4ae8b5 HG |
83 | ("rust-dirs" ,rust-dirs-2.0) |
84 | ;;("rust-failure" included | |
85 | ("rust-filetime" ,rust-filetime-0.2) | |
df4d2dda | 86 | ("rust-flate2" ,rust-flate2-1.0) |
4c4ae8b5 HG |
87 | ("rust-fs2" ,rust-fs2-0.4) |
88 | ("rust-futures" ,rust-futures-0.1) | |
89 | ("rust-http" ,rust-http-0.1) | |
90 | ("rust-hyper" ,rust-hyper-0.12) | |
91 | ("rust-hyper-tls" ,rust-hyper-tls-0.3) | |
df4d2dda | 92 | ("rust-idna" ,rust-idna-0.2) |
4c4ae8b5 | 93 | ("rust-itertools" ,rust-itertools-0.8) |
df4d2dda EF |
94 | ("rust-lalrpop-util" ,rust-lalrpop-util-0.17) |
95 | ("rust-lazy-static" ,rust-lazy-static-1) | |
4c4ae8b5 | 96 | ("rust-libc" ,rust-libc-0.2) |
df4d2dda | 97 | ("rust-memsec" ,rust-memsec-0.5) |
4c4ae8b5 | 98 | ("rust-native-tls" ,rust-native-tls-0.2) |
df4d2dda | 99 | ("rust-nettle" ,rust-nettle-7) |
4c4ae8b5 HG |
100 | ("rust-parity-tokio-ipc" ,rust-parity-tokio-ipc-0.4) |
101 | ("rust-percent-encoding" ,rust-percent-encoding-2.1) | |
102 | ("rust-prettytable-rs" ,rust-prettytable-rs-0.8) | |
0a568bbc | 103 | ("rust-proc-macro2" ,rust-proc-macro2-1) |
df4d2dda EF |
104 | ("rust-quickcheck" ,rust-quickcheck-0.9) |
105 | ("rust-rand" ,rust-rand-0.7) | |
6cd7b355 | 106 | ("rust-regex" ,rust-regex-1) |
4c4ae8b5 | 107 | ("rust-rusqlite" ,rust-rusqlite-0.19) |
2dab855b | 108 | ("rust-structopt" ,rust-structopt-0.3) |
7c6948c7 | 109 | ("rust-tempfile" ,rust-tempfile-3) |
4c4ae8b5 HG |
110 | ("rust-thiserror" ,rust-thiserror-1.0) |
111 | ("rust-tokio" ,rust-tokio-0.1) | |
112 | ("rust-tokio-core" ,rust-tokio-core-0.1) | |
df4d2dda | 113 | ("rust-unicode-normalization" ,rust-unicode-normalization-0.1) |
4c4ae8b5 HG |
114 | ("rust-url" ,rust-url-2.1) |
115 | ("rust-zbase32" ,rust-zbase32-0.1)) | |
116 | #:cargo-development-inputs | |
117 | (("rust-bindgen" ,rust-bindgen-0.51) ;; FIXME for nettle-sys and rusqlite | |
118 | ("rust-lalrpop" ,rust-lalrpop-0.17) | |
119 | ("rust-rpassword" ,rust-rpassword-4)) | |
120 | #:phases | |
121 | (modify-phases %standard-phases | |
122 | ;; Run make instead of using the rust build system, as | |
123 | ;; suggested by the installation instructions | |
124 | (replace 'build (lambda _ (invoke "make" "build-release") #t)) | |
125 | (replace 'check | |
126 | (lambda* (#:key tests? #:allow-other-keys) | |
127 | (if tests? | |
128 | (invoke "make" "check") | |
129 | #t))) | |
130 | (replace 'install (lambda _ (invoke "make" "install") #t)) | |
131 | (add-after 'unpack 'adjust-prefix | |
132 | (lambda* (#:key outputs #:allow-other-keys) | |
133 | (setenv "PREFIX" (assoc-ref outputs "out")) | |
134 | #t)) | |
135 | (add-after 'unpack 'fix-fo-python-output | |
136 | (lambda* (#:key outputs #:allow-other-keys) | |
137 | (let ((out (assoc-ref outputs "out")) | |
138 | (pyout (assoc-ref outputs "python"))) | |
139 | (substitute* "ffi/lang/python/Makefile" | |
140 | ;; adjust prefix for python package | |
141 | (("PREFIX\\s*\\??=.*") | |
142 | (string-append "PREFIX = " pyout "\n")) | |
143 | ;; fix rpath to include the main package | |
144 | (("\\WLDFLAGS=" text) | |
145 | (string-append text "'-Wl,-rpath=" out "/lib '")) | |
146 | ;; make setuptools install into the prefix, see | |
147 | ;; guix/build/python-build-system.scm for explanation | |
148 | (("\\ssetup.py\\s+install\\s") | |
149 | " setup.py install --root=/ --single-version-externally-managed ")) | |
150 | #t))) | |
fbe17e24 HG |
151 | (add-after 'unpack 'fix-pkgconfig-file-substitutes |
152 | ;; preempt Makefiles replacing PREFIX by pwd | |
153 | (lambda* (#:key outputs #:allow-other-keys) | |
154 | (let ((out (assoc-ref outputs "out"))) | |
155 | (substitute* "ffi/sequoia.pc.in" | |
156 | (("PREFIX") out)) | |
157 | (substitute* "openpgp-ffi/sequoia-openpgp.pc.in" | |
158 | (("PREFIX") out)) | |
159 | #t))) | |
4c4ae8b5 HG |
160 | (add-after 'unpack 'set-missing-env-vars |
161 | (lambda* (#:key inputs #:allow-other-keys) | |
162 | ;; FIXME: why do we need to set this here? | |
163 | (setenv "LIBCLANG_PATH" | |
164 | (string-append (assoc-ref inputs "clang") "/lib")) | |
2dab855b JK |
165 | #t)) |
166 | (add-after 'unpack 'unpin-deps | |
167 | (lambda _ | |
168 | ;; As the comment in that file explains, upstream encourages | |
169 | ;; unpinning, as the pinned version is only to make sure the crate | |
170 | ;; compiles on older versions of rustc | |
171 | (substitute* '("openpgp/Cargo.toml" "tool/Cargo.toml") | |
172 | (("= \"=") "= \"")) | |
4c4ae8b5 HG |
173 | #t))))) |
174 | (home-page "https://sequoia-pgp.org") | |
175 | (synopsis "New OpenPGP implementation") | |
176 | (description "Sequoia is a new OpenPGP implementation. It consists of | |
177 | several crates, providing both a low-level and a high-level API for dealing | |
178 | with OpenPGP data.") | |
179 | (license license:gpl2+))) |