1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 boost)
29 #:use-module (gnu packages documentation)
30 #:use-module (gnu packages java)
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)
38 #:use-module (gnu packages xml))
47 (url "https://pep.foundation/dev/repos/yml2")
49 (file-name (string-append name "-" version "-checkout"))
51 (base32 "10jjjyq1mz18zkzvxd62aba00h69gd9cglisqcvb81j67ml2v1bx"))))
52 (build-system python-build-system)
54 `(("python-lxml" ,python-lxml)))
55 (home-page "https://fdik.org/yml/")
56 (synopsis "Use a Domain Specific Language for XML without defining
58 (description "The YML compiler is a small Python script. It
59 provides the command line front end yml2c. As default, it compiles
60 your script and outputs to stdout, that usually is the terminal. Your
61 shell provides options to redirect the output into a pipe or a file.")
62 (license license:gpl2)))
65 ;; pEp Engine requires libetpan with a set of patches that have not been
67 (let ((commit "210ba2b3b310b8b7a6ee4a4e35e50f7fa379643f") ; 2020-06-03
68 (checksum "00000nij3ray7nssvq0lzb352wmnab8ffzk7dgff2c68mvjbh1l6")
72 (name "fdik-libetpan")
73 (version (string-append "1.6-" revision "." (string-take commit 8)))
76 (inherit (package-source libetpan))
79 (url "https://github.com/fdik/libetpan")
81 (file-name (string-append name "-" version))
82 (sha256 (base32 checksum)))))))
85 ;; Currently pEp Engine requires sequoia in not-so-current version
86 (package/inherit sequoia
88 (version "0.15.0-pEp")
93 (url "https://gitlab.com/sequoia-pgp/sequoia.git")
94 (commit "0eb1b6cd846ea8c36b3dfdf01ec88383fc64f2fe")))
96 (base32 "06dqs9whwp9lfibwp8dqm0aw4nm3s3v4jp2n4fz51zcvsld40nfh"))
97 (file-name (git-file-name name version))))))
99 (define-public pep-engine
107 (url "https://pep.foundation/dev/repos/pEpEngine")
108 (changeset "ebb62ba262dd"))) ;; r4721
109 (file-name (string-append name "-" version "-checkout"))
111 (base32 "0ljf79j4ng7l8w6pbdcrfzb4yk51zslypvq0n72ib1d7grqvnagi"))))
112 (build-system gnu-build-system)
114 '(#:parallel-build? #f
116 (modify-phases %standard-phases
118 ;; pEpEngie does not use autotools and configure,
119 ;; but a local.conf. We need to tweak the values there.
120 (lambda* (#:key inputs outputs #:allow-other-keys)
121 (let ((out (assoc-ref outputs "out"))
122 (yml2 (assoc-ref inputs "yml2")))
123 (with-output-to-file "local.conf"
127 PER_MACHINE_DIRECTORY=${PREFIX}/share/pEp
128 SYSTEM_DB=~a/share/pEp/system.db
133 out out (which "asn1c")
134 (string-append yml2 "/bin"))))
137 (add-after 'install 'install-db
139 (invoke "make" "-C" "db" "install"))))))
141 `(("asn1c" ,asn1c) ; >= 0.9.27
142 ("pkg-config" ,pkg-config)
145 `(("libetpan" ,fdik-libetpan)
146 ("libiconv" ,libiconv)
149 ("sequoia" ,sequoia4pEp)
151 ("util-linux" ,util-linux "lib"))) ;; uuid.h
152 (home-page "https://pep.foundation/")
153 (synopsis "Library for automatic key management and encryption of
155 (description "The p≡p engine is the core part of p≡p (pretty Easy
157 (license ;; code: GPL 3, docs: CC-BY-SA
158 (list license:gpl3 license:cc-by-sa3.0))))
160 (define-public libpepadapter
162 (name "libpepadapter")
168 (url "https://pep.foundation/dev/repos/libpEpAdapter")
169 (changeset "e8fe371c870a"))) ;; r168
170 (file-name (string-append name "-" version "-checkout"))
172 (base32 "1mlpavjbnmslvmr5jxcvpjgb2x40nhmxjb10hza3kn4qzj0k1pjz"))))
173 (build-system gnu-build-system)
175 '(#:test-target "test"
176 #:tests? #f ;; building the tests fails
178 (modify-phases %standard-phases
180 ;; libpEpAdapter does not use autotools and configure,
181 ;; but a local.conf. We need to tweak the values there.
182 (lambda* (#:key inputs outputs #:allow-other-keys)
183 (let ((out (assoc-ref outputs "out"))
184 (engine (assoc-ref inputs "pep-engine")))
185 (with-output-to-file "local.conf"
189 ENGINE_LIB_PATH=~a/lib
190 ENGINE_INC_PATH=~a/include
191 " out engine engine))))
194 `(("pep-engine" ,pep-engine)))
195 (home-page "https://pep.foundation/")
196 (synopsis "Library for building p≡p adapters")
197 (description "This C++ library provides common structures used in p≡p
198 (pretty Easy privacy) adapters.")
199 (license license:bsd-3)))
201 (define-public python-pep-adapter
203 (name "python-pep-adapter")
209 (url "https://pep.foundation/dev/repos/pEpPythonAdapter")
210 (changeset "66df0e5b9405"))) ;; r374
211 (file-name (string-append name "-" version "-checkout"))
213 (base32 "107i1s8jf8gyhpmqcs64q9csxa3fwc8g7s57iyccqb4czw8gph6d"))))
214 (build-system python-build-system)
216 `(;; Adding configure-flags does not work, running `build_ext`
217 ;; with these flags, neither does adding the options to
218 ;; `setup.cfg`: Either `build` or `install` fails (since
219 ;; flags are given or missing), or "command 'BuildExtCommand'
220 ;; has no such option 'pep_engine"
221 ;; '(#:configure-flags
222 ;; (list (string-append "--with-pEp-engine="
223 ;; (assoc-ref inputs "pEpEngine"))
224 ;; (string-append "--with-pEp-libadapter="
225 ;; (assoc-ref inputs "libpEpAdapter"))
226 ;; ;;(string-append "--boost="
227 ;; (assoc-ref inputs "boost")) not supported
228 ;; (string-append "--with-asn1c-share="
229 ;; (assoc-ref inputs "asn1c") "/share"))
231 (modify-phases %standard-phases
232 (add-before 'build 'fix-setup.py
234 (substitute* "setup.py"
235 (("^(\\s+SYS_INCLUDES = )\\['/usr.*" _ a)
236 (string-append a "os.getenv('CPATH', '').split(os.pathsep)\n"))
237 (("^(\\s+SYS_LIB_PREFIXES = )\\['/usr.*" _ a)
238 (string-append a "os.getenv('LIBRARY_PATH', '').split(os.pathsep)\n"))
239 (("^(\\s+SYS_SHARES = )\\['/usr.*" _ a)
240 (string-append a "['" (assoc-ref %build-inputs "asn1c") "/share']\n")))
244 ("boost-python" ,boost-with-python3)
245 ("libpepadapter" ,libpepadapter)
246 ("pep-engine" ,pep-engine)))
247 (home-page "https://pep.foundation/")
248 (synopsis "Python adapter for p≡p (pretty Easy Privacy)")
249 (description "The p≡p Python adapter is an adaptor interface to the p≡p
250 (pretty Easy privacy) engine.")
251 (license license:gpl3)))
253 (define-public java-pep-adapter
255 (name "java-pep-adapter")
261 (url "https://pep.foundation/dev/repos/pEpJNIAdapter")
262 (changeset "534537c9cd50"))) ;; r763
263 (file-name (string-append name "-" version "-checkout"))
265 (base32 "107ldpssc80bq8kndn2n000000gphj4lqagaiv3fddlfph4vji48"))))
266 (build-system gnu-build-system)
267 (outputs '("out" "doc"))
269 `(#:test-target "test"
270 #:make-flags (list "doxy-all")
272 (modify-phases %standard-phases
273 (add-before 'configure 'fix-includes
275 (substitute* "src/jniutils.hh"
276 (("#pragma once\n" line)
279 "#include <cassert>\n"
280 "#include <cstring>\n")))
282 (add-before 'configure 'pin-shared-lib-path
283 (lambda* (#:key outputs #:allow-other-keys)
284 (substitute* "src/foundation/pEp/jniadapter/AbstractEngine.java"
285 (("System.loadLibrary\\(\"pEpJNI\"\\);")
286 (string-append "System.load(\""
287 (assoc-ref outputs "out")
288 "/lib/libpEpJNI.so" "\");")))
291 ;; pEpJNIAdapter does not use autotools and configure,
292 ;; but a local.conf. We need to tweak the values there.
293 (lambda* (#:key inputs outputs #:allow-other-keys)
294 (let ((out (assoc-ref outputs "out"))
295 (engine (assoc-ref inputs "pep-engine"))
296 (libadapter (assoc-ref inputs "libpepadapter"))
297 (openjdk (assoc-ref inputs "openjdk")))
298 (with-output-to-file "local.conf"
302 ENGINE_LIB_PATH=~a/lib
303 ENGINE_INC_PATH=~a/include
305 AD_INC_PATH=~a/include
309 out engine engine libadapter libadapter
310 (which "yml2proc") openjdk)))
311 (substitute* "src/Makefile" ;; suppress some warnings
312 (("^\\s+OLD_JAVA=") " xxx_OLD_JAVA="))
315 (lambda* (#:key outputs #:allow-other-keys)
316 (let* ((out (assoc-ref outputs "out"))
317 (libout (string-append out "/lib/"))
318 (javaout (string-append out "/share/java/")))
321 (copy-file "src/libpEpJNI.so"
322 (string-append libout "/libpEpJNI.so"))
323 (copy-file "src/pEp.jar" (string-append javaout "/pEp.jar"))
325 (add-after 'install 'install-docs
326 (lambda* (#:key outputs #:allow-other-keys)
327 (let* ((out (assoc-ref outputs "doc"))
328 (docout (string-append out "/share/doc/pEp-JNI-adapter"))
329 (cxxout (string-append docout "/cxx"))
330 (javaout (string-append docout "/java")))
333 (copy-recursively "doc/doxygen/cxx/html" cxxout)
334 (copy-recursively "doc/doxygen/java/html" javaout)
337 `(("doxygen" ,doxygen)
338 ("openjdk" ,openjdk9 "jdk")
342 `(("libpepadapter" ,libpepadapter)
343 ("pep-engine" ,pep-engine)
344 ("util-linux" ,util-linux))) ;; uuid.h
345 (home-page "https://pep.foundation/")
346 (synopsis "Java adapter for p≡p (pretty Easy Privacy)")
347 (description "The p≡p JNI adapter is a Java adapter interface to the p≡p
348 (pretty Easy privacy) engine.")
349 (license license:gpl3)))