gnu: Add libpepadapter.
[jackhill/guix/guix.git] / gnu / packages / pep.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 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 pep)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
22 #:use-module (guix git-download)
23 #:use-module (guix hg-download)
24 #:use-module (guix build-system gnu)
25 #:use-module (guix build-system python)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages linux)
29 #:use-module (gnu packages mail) ; for libetpan
30 #:use-module (gnu packages nettle)
31 #:use-module (gnu packages pkg-config)
32 #:use-module (gnu packages sequoia)
33 #:use-module (gnu packages sqlite)
34 #:use-module (gnu packages tls)
35 #:use-module (gnu packages xml))
36
37 (define-public yml2
38 (package
39 (name "yml2")
40 (version "2.6.3")
41 (source (origin
42 (method hg-fetch)
43 (uri (hg-reference
44 (url "https://pep.foundation/dev/repos/yml2")
45 (changeset version)))
46 (file-name (string-append name "-" version "-checkout"))
47 (sha256
48 (base32 "10jjjyq1mz18zkzvxd62aba00h69gd9cglisqcvb81j67ml2v1bx"))))
49 (build-system python-build-system)
50 (propagated-inputs
51 `(("python-lxml" ,python-lxml)))
52 (home-page "https://fdik.org/yml/")
53 (synopsis "Use a Domain Specific Language for XML without defining
54 a grammar")
55 (description "The YML compiler is a small Python script. It
56 provides the command line front end yml2c. As default, it compiles
57 your script and outputs to stdout, that usually is the terminal. Your
58 shell provides options to redirect the output into a pipe or a file.")
59 (license license:gpl2)))
60
61 (define fdik-libetpan
62 ;; pEp Engine requires libetpan with a set of patches that have not been
63 ;; upstreamed yet.
64 (let ((commit "210ba2b3b310b8b7a6ee4a4e35e50f7fa379643f") ; 2020-06-03
65 (checksum "00000nij3ray7nssvq0lzb352wmnab8ffzk7dgff2c68mvjbh1l6")
66 (revision "5"))
67 (package
68 (inherit libetpan)
69 (name "fdik-libetpan")
70 (version (string-append "1.6-" revision "." (string-take commit 8)))
71 (source
72 (origin
73 (inherit (package-source libetpan))
74 (method git-fetch)
75 (uri (git-reference
76 (url "https://github.com/fdik/libetpan")
77 (commit commit)))
78 (file-name (string-append name "-" version))
79 (sha256 (base32 checksum)))))))
80
81 (define sequoia4pEp
82 ;; Currently pEp Engine requires sequoia in not-so-current version
83 (package/inherit sequoia
84 (name "sequoia")
85 (version "0.15.0-pEp")
86 (source
87 (origin
88 (method git-fetch)
89 (uri (git-reference
90 (url "https://gitlab.com/sequoia-pgp/sequoia.git")
91 (commit "0eb1b6cd846ea8c36b3dfdf01ec88383fc64f2fe")))
92 (sha256
93 (base32 "06dqs9whwp9lfibwp8dqm0aw4nm3s3v4jp2n4fz51zcvsld40nfh"))
94 (file-name (git-file-name name version))))))
95
96 (define-public pep-engine
97 (package
98 (name "pep-engine")
99 (version "2.0.6")
100 (source
101 (origin
102 (method hg-fetch)
103 (uri (hg-reference
104 (url "https://pep.foundation/dev/repos/pEpEngine")
105 (changeset "ebb62ba262dd"))) ;; r4721
106 (file-name (string-append name "-" version "-checkout"))
107 (sha256
108 (base32 "0ljf79j4ng7l8w6pbdcrfzb4yk51zslypvq0n72ib1d7grqvnagi"))))
109 (build-system gnu-build-system)
110 (arguments
111 '(#:parallel-build? #f
112 #:phases
113 (modify-phases %standard-phases
114 (replace 'configure
115 ;; pEpEngie does not use autotools and configure,
116 ;; but a local.conf. We need to tweak the values there.
117 (lambda* (#:key inputs outputs #:allow-other-keys)
118 (let ((out (assoc-ref outputs "out"))
119 (yml2 (assoc-ref inputs "yml2")))
120 (with-output-to-file "local.conf"
121 (lambda ()
122 (format #t "
123 PREFIX=~a
124 PER_MACHINE_DIRECTORY=${PREFIX}/share/pEp
125 SYSTEM_DB=~a/share/pEp/system.db
126 ASN1C=~a
127 YML2_PATH=~a
128 OPENPGP=SEQUOIA
129 "
130 out out (which "asn1c")
131 (string-append yml2 "/bin"))))
132 #t)))
133 (delete 'check)
134 (add-after 'install 'install-db
135 (lambda _
136 (invoke "make" "-C" "db" "install"))))))
137 (native-inputs
138 `(("asn1c" ,asn1c) ; >= 0.9.27
139 ("pkg-config" ,pkg-config)
140 ("yml2" ,yml2)))
141 (inputs
142 `(("libetpan" ,fdik-libetpan)
143 ("libiconv" ,libiconv)
144 ("nettle" ,nettle)
145 ("openssl" ,openssl)
146 ("sequoia" ,sequoia4pEp)
147 ("sqlite3" ,sqlite)
148 ("util-linux" ,util-linux "lib"))) ;; uuid.h
149 (home-page "https://pep.foundation/")
150 (synopsis "Library for automatic key management and encryption of
151 messages")
152 (description "The p≡p engine is the core part of p≡p (pretty Easy
153 privacy).")
154 (license ;; code: GPL 3, docs: CC-BY-SA
155 (list license:gpl3 license:cc-by-sa3.0))))
156
157 (define-public libpepadapter
158 (package
159 (name "libpepadapter")
160 (version "2.0.2")
161 (source
162 (origin
163 (method hg-fetch)
164 (uri (hg-reference
165 (url "https://pep.foundation/dev/repos/libpEpAdapter")
166 (changeset "e8fe371c870a"))) ;; r168
167 (file-name (string-append name "-" version "-checkout"))
168 (sha256
169 (base32 "1mlpavjbnmslvmr5jxcvpjgb2x40nhmxjb10hza3kn4qzj0k1pjz"))))
170 (build-system gnu-build-system)
171 (arguments
172 '(#:test-target "test"
173 #:tests? #f ;; building the tests fails
174 #:phases
175 (modify-phases %standard-phases
176 (replace 'configure
177 ;; libpEpAdapter does not use autotools and configure,
178 ;; but a local.conf. We need to tweak the values there.
179 (lambda* (#:key inputs outputs #:allow-other-keys)
180 (let ((out (assoc-ref outputs "out"))
181 (engine (assoc-ref inputs "pep-engine")))
182 (with-output-to-file "local.conf"
183 (lambda _ ;()
184 (format #t "
185 PREFIX=~a
186 ENGINE_LIB_PATH=~a/lib
187 ENGINE_INC_PATH=~a/include
188 " out engine engine))))
189 #t)))))
190 (inputs
191 `(("pep-engine" ,pep-engine)))
192 (home-page "https://pep.foundation/")
193 (synopsis "Library for building p≡p adapters")
194 (description "This C++ library provides common structures used in p≡p
195 (pretty Easy privacy) adapters.")
196 (license license:bsd-3)))