WIP: bees service
[jackhill/guix/guix.git] / gnu / packages / pep.scm
CommitLineData
d7a341f8
HG
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)
221c5144 22 #:use-module (guix git-download)
d7a341f8 23 #:use-module (guix hg-download)
221c5144 24 #:use-module (guix build-system gnu)
d7a341f8
HG
25 #:use-module (guix build-system python)
26 #:use-module (gnu packages)
221c5144 27 #:use-module (gnu packages base)
9b722166 28 #:use-module (gnu packages boost)
3cf7088f
HG
29 #:use-module (gnu packages documentation)
30 #:use-module (gnu packages java)
221c5144
HG
31 #:use-module (gnu packages linux)
32 #:use-module (gnu packages mail) ; for libetpan
33 #:use-module (gnu packages nettle)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages sequoia)
36 #:use-module (gnu packages sqlite)
37 #:use-module (gnu packages tls)
d7a341f8
HG
38 #:use-module (gnu packages xml))
39
40(define-public yml2
41 (package
42 (name "yml2")
43 (version "2.6.3")
44 (source (origin
45 (method hg-fetch)
46 (uri (hg-reference
47 (url "https://pep.foundation/dev/repos/yml2")
48 (changeset version)))
49 (file-name (string-append name "-" version "-checkout"))
50 (sha256
51 (base32 "10jjjyq1mz18zkzvxd62aba00h69gd9cglisqcvb81j67ml2v1bx"))))
52 (build-system python-build-system)
53 (propagated-inputs
54 `(("python-lxml" ,python-lxml)))
55 (home-page "https://fdik.org/yml/")
56 (synopsis "Use a Domain Specific Language for XML without defining
57a grammar")
58 (description "The YML compiler is a small Python script. It
59provides the command line front end yml2c. As default, it compiles
60your script and outputs to stdout, that usually is the terminal. Your
61shell provides options to redirect the output into a pipe or a file.")
62 (license license:gpl2)))
221c5144
HG
63
64(define fdik-libetpan
65 ;; pEp Engine requires libetpan with a set of patches that have not been
66 ;; upstreamed yet.
67 (let ((commit "210ba2b3b310b8b7a6ee4a4e35e50f7fa379643f") ; 2020-06-03
68 (checksum "00000nij3ray7nssvq0lzb352wmnab8ffzk7dgff2c68mvjbh1l6")
69 (revision "5"))
70 (package
71 (inherit libetpan)
72 (name "fdik-libetpan")
73 (version (string-append "1.6-" revision "." (string-take commit 8)))
74 (source
75 (origin
76 (inherit (package-source libetpan))
77 (method git-fetch)
78 (uri (git-reference
79 (url "https://github.com/fdik/libetpan")
80 (commit commit)))
81 (file-name (string-append name "-" version))
82 (sha256 (base32 checksum)))))))
83
221c5144
HG
84(define-public pep-engine
85 (package
86 (name "pep-engine")
87 (version "2.0.6")
88 (source
89 (origin
90 (method hg-fetch)
91 (uri (hg-reference
92 (url "https://pep.foundation/dev/repos/pEpEngine")
93 (changeset "ebb62ba262dd"))) ;; r4721
94 (file-name (string-append name "-" version "-checkout"))
95 (sha256
96 (base32 "0ljf79j4ng7l8w6pbdcrfzb4yk51zslypvq0n72ib1d7grqvnagi"))))
97 (build-system gnu-build-system)
98 (arguments
99 '(#:parallel-build? #f
100 #:phases
101 (modify-phases %standard-phases
102 (replace 'configure
103 ;; pEpEngie does not use autotools and configure,
104 ;; but a local.conf. We need to tweak the values there.
105 (lambda* (#:key inputs outputs #:allow-other-keys)
106 (let ((out (assoc-ref outputs "out"))
107 (yml2 (assoc-ref inputs "yml2")))
108 (with-output-to-file "local.conf"
109 (lambda ()
110 (format #t "
111PREFIX=~a
112PER_MACHINE_DIRECTORY=${PREFIX}/share/pEp
113SYSTEM_DB=~a/share/pEp/system.db
114ASN1C=~a
115YML2_PATH=~a
116OPENPGP=SEQUOIA
117"
118 out out (which "asn1c")
119 (string-append yml2 "/bin"))))
120 #t)))
121 (delete 'check)
122 (add-after 'install 'install-db
123 (lambda _
124 (invoke "make" "-C" "db" "install"))))))
125 (native-inputs
126 `(("asn1c" ,asn1c) ; >= 0.9.27
127 ("pkg-config" ,pkg-config)
128 ("yml2" ,yml2)))
129 (inputs
130 `(("libetpan" ,fdik-libetpan)
131 ("libiconv" ,libiconv)
132 ("nettle" ,nettle)
133 ("openssl" ,openssl)
134 ("sequoia" ,sequoia4pEp)
135 ("sqlite3" ,sqlite)
136 ("util-linux" ,util-linux "lib"))) ;; uuid.h
137 (home-page "https://pep.foundation/")
138 (synopsis "Library for automatic key management and encryption of
139messages")
140 (description "The p≡p engine is the core part of p≡p (pretty Easy
141privacy).")
142 (license ;; code: GPL 3, docs: CC-BY-SA
143 (list license:gpl3 license:cc-by-sa3.0))))
cfd15d96
HG
144
145(define-public libpepadapter
146 (package
147 (name "libpepadapter")
148 (version "2.0.2")
149 (source
150 (origin
151 (method hg-fetch)
152 (uri (hg-reference
153 (url "https://pep.foundation/dev/repos/libpEpAdapter")
154 (changeset "e8fe371c870a"))) ;; r168
155 (file-name (string-append name "-" version "-checkout"))
156 (sha256
157 (base32 "1mlpavjbnmslvmr5jxcvpjgb2x40nhmxjb10hza3kn4qzj0k1pjz"))))
158 (build-system gnu-build-system)
159 (arguments
160 '(#:test-target "test"
161 #:tests? #f ;; building the tests fails
162 #:phases
163 (modify-phases %standard-phases
164 (replace 'configure
165 ;; libpEpAdapter does not use autotools and configure,
166 ;; but a local.conf. We need to tweak the values there.
167 (lambda* (#:key inputs outputs #:allow-other-keys)
168 (let ((out (assoc-ref outputs "out"))
169 (engine (assoc-ref inputs "pep-engine")))
170 (with-output-to-file "local.conf"
171 (lambda _ ;()
172 (format #t "
173PREFIX=~a
174ENGINE_LIB_PATH=~a/lib
175ENGINE_INC_PATH=~a/include
176" out engine engine))))
177 #t)))))
178 (inputs
179 `(("pep-engine" ,pep-engine)))
180 (home-page "https://pep.foundation/")
181 (synopsis "Library for building p≡p adapters")
182 (description "This C++ library provides common structures used in p≡p
183(pretty Easy privacy) adapters.")
184 (license license:bsd-3)))
9b722166
HG
185
186(define-public python-pep-adapter
187 (package
188 (name "python-pep-adapter")
189 (version "2.0.5")
190 (source
191 (origin
192 (method hg-fetch)
193 (uri (hg-reference
194 (url "https://pep.foundation/dev/repos/pEpPythonAdapter")
195 (changeset "66df0e5b9405"))) ;; r374
196 (file-name (string-append name "-" version "-checkout"))
197 (sha256
198 (base32 "107i1s8jf8gyhpmqcs64q9csxa3fwc8g7s57iyccqb4czw8gph6d"))))
199 (build-system python-build-system)
200 (arguments
201 `(;; Adding configure-flags does not work, running `build_ext`
202 ;; with these flags, neither does adding the options to
203 ;; `setup.cfg`: Either `build` or `install` fails (since
204 ;; flags are given or missing), or "command 'BuildExtCommand'
205 ;; has no such option 'pep_engine"
206 ;; '(#:configure-flags
207 ;; (list (string-append "--with-pEp-engine="
208 ;; (assoc-ref inputs "pEpEngine"))
209 ;; (string-append "--with-pEp-libadapter="
210 ;; (assoc-ref inputs "libpEpAdapter"))
211 ;; ;;(string-append "--boost="
212 ;; (assoc-ref inputs "boost")) not supported
213 ;; (string-append "--with-asn1c-share="
214 ;; (assoc-ref inputs "asn1c") "/share"))
215 #:phases
216 (modify-phases %standard-phases
217 (add-before 'build 'fix-setup.py
218 (lambda _
219 (substitute* "setup.py"
220 (("^(\\s+SYS_INCLUDES = )\\['/usr.*" _ a)
221 (string-append a "os.getenv('CPATH', '').split(os.pathsep)\n"))
222 (("^(\\s+SYS_LIB_PREFIXES = )\\['/usr.*" _ a)
223 (string-append a "os.getenv('LIBRARY_PATH', '').split(os.pathsep)\n"))
224 (("^(\\s+SYS_SHARES = )\\['/usr.*" _ a)
225 (string-append a "['" (assoc-ref %build-inputs "asn1c") "/share']\n")))
226 #t)))))
227 (inputs
228 `(("asn1c" ,asn1c)
229 ("boost-python" ,boost-with-python3)
230 ("libpepadapter" ,libpepadapter)
231 ("pep-engine" ,pep-engine)))
232 (home-page "https://pep.foundation/")
233 (synopsis "Python adapter for p≡p (pretty Easy Privacy)")
234 (description "The p≡p Python adapter is an adaptor interface to the p≡p
235(pretty Easy privacy) engine.")
236 (license license:gpl3)))
3cf7088f
HG
237
238(define-public java-pep-adapter
239 (package
240 (name "java-pep-adapter")
241 (version "2.0.5")
242 (source
243 (origin
244 (method hg-fetch)
245 (uri (hg-reference
246 (url "https://pep.foundation/dev/repos/pEpJNIAdapter")
247 (changeset "534537c9cd50"))) ;; r763
248 (file-name (string-append name "-" version "-checkout"))
249 (sha256
250 (base32 "107ldpssc80bq8kndn2n000000gphj4lqagaiv3fddlfph4vji48"))))
251 (build-system gnu-build-system)
252 (outputs '("out" "doc"))
253 (arguments
254 `(#:test-target "test"
255 #:make-flags (list "doxy-all")
256 #:phases
257 (modify-phases %standard-phases
258 (add-before 'configure 'fix-includes
259 (lambda _
260 (substitute* "src/jniutils.hh"
261 (("#pragma once\n" line)
262 (string-append line
263 "#include <mutex>\n"
264 "#include <cassert>\n"
265 "#include <cstring>\n")))
266 #t))
267 (add-before 'configure 'pin-shared-lib-path
268 (lambda* (#:key outputs #:allow-other-keys)
269 (substitute* "src/foundation/pEp/jniadapter/AbstractEngine.java"
270 (("System.loadLibrary\\(\"pEpJNI\"\\);")
271 (string-append "System.load(\""
272 (assoc-ref outputs "out")
273 "/lib/libpEpJNI.so" "\");")))
274 #t))
275 (replace 'configure
276 ;; pEpJNIAdapter does not use autotools and configure,
277 ;; but a local.conf. We need to tweak the values there.
278 (lambda* (#:key inputs outputs #:allow-other-keys)
279 (let ((out (assoc-ref outputs "out"))
280 (engine (assoc-ref inputs "pep-engine"))
281 (libadapter (assoc-ref inputs "libpepadapter"))
282 (openjdk (assoc-ref inputs "openjdk")))
283 (with-output-to-file "local.conf"
284 (lambda _ ;()
285 (format #t "
286PREFIX=~a
287ENGINE_LIB_PATH=~a/lib
288ENGINE_INC_PATH=~a/include
289AD_LIB_PATH=~a/lib
290AD_INC_PATH=~a/include
291YML2_PROC=~a
292JAVA_HOME=~a
293"
294 out engine engine libadapter libadapter
295 (which "yml2proc") openjdk)))
296 (substitute* "src/Makefile" ;; suppress some warnings
297 (("^\\s+OLD_JAVA=") " xxx_OLD_JAVA="))
298 #t)))
299 (replace 'install
300 (lambda* (#:key outputs #:allow-other-keys)
301 (let* ((out (assoc-ref outputs "out"))
302 (libout (string-append out "/lib/"))
303 (javaout (string-append out "/share/java/")))
304 (mkdir-p libout)
305 (mkdir-p javaout)
306 (copy-file "src/libpEpJNI.so"
307 (string-append libout "/libpEpJNI.so"))
308 (copy-file "src/pEp.jar" (string-append javaout "/pEp.jar"))
309 #t)))
310 (add-after 'install 'install-docs
311 (lambda* (#:key outputs #:allow-other-keys)
312 (let* ((out (assoc-ref outputs "doc"))
313 (docout (string-append out "/share/doc/pEp-JNI-adapter"))
314 (cxxout (string-append docout "/cxx"))
315 (javaout (string-append docout "/java")))
316 (mkdir-p cxxout)
317 (mkdir-p javaout)
318 (copy-recursively "doc/doxygen/cxx/html" cxxout)
319 (copy-recursively "doc/doxygen/java/html" javaout)
320 #t))))))
321 (native-inputs
322 `(("doxygen" ,doxygen)
323 ("openjdk" ,openjdk9 "jdk")
324 ("which" ,which)
325 ("yml2" ,yml2)))
326 (inputs
327 `(("libpepadapter" ,libpepadapter)
328 ("pep-engine" ,pep-engine)
329 ("util-linux" ,util-linux))) ;; uuid.h
330 (home-page "https://pep.foundation/")
331 (synopsis "Java adapter for p≡p (pretty Easy Privacy)")
332 (description "The p≡p JNI adapter is a Java adapter interface to the p≡p
333(pretty Easy privacy) engine.")
334 (license license:gpl3)))