summaryrefslogtreecommitdiff
path: root/gnu/packages/pep.scm
blob: 7ae77d177677af39b0361a55b2ce42dd1ef45c62 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2020, 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages pep)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system python)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages check)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages graphviz)
  #:use-module (gnu packages java)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages mail) ; for libetpan
  #:use-module (gnu packages nettle)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages sequoia)
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages xml))

(define-public yml2
  (package
    (name "yml2")
    (version "2.7.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitea.pep.foundation/fdik/yml2")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0fm1x1fv4lwcpbn59s55idzf7x173n59xpz8rlrxalmi6gvsjijr"))))
    (build-system python-build-system)
    (propagated-inputs
     `(("python-lxml" ,python-lxml)))
    (home-page "https://fdik.org/yml/")
    (synopsis "Use a Domain Specific Language for XML without defining
a grammar")
    (description "The YML compiler is a small Python script.  It
provides the command line front end yml2c.  As default, it compiles
your script and outputs to stdout, that usually is the terminal.  Your
shell provides options to redirect the output into a pipe or a file.")
    (license license:gpl2)))

(define fdik-libetpan
  ;; pEp Engine requires libetpan with a set of patches that have not been
  ;; upstreamed yet.
  (let ((commit "0b80c39dd1504462ba3a39dc53db7c960c3a63f3") ; 2020-11-27
        (checksum "0gv3ivaziadybjlf6rfpv1j5z5418243v5cvl4swlxd2njsh7gjk")
        (revision "6"))
   (package
    (inherit libetpan)
    (name "fdik-libetpan")
    (version (string-append "1.6-" revision "." (string-take commit 8)))
    (source
     (origin
       (inherit (package-source libetpan))
       (method git-fetch)
       (uri (git-reference
             (url "https://gitea.pep.foundation/pEp.foundation/libetpan")
             (commit commit)))
       (file-name (string-append name "-" version))
       (sha256 (base32 checksum)))))))

(define-public pep-engine
  (package
    (name "pep-engine")
    (version "2.1.34")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitea.pep.foundation/pEp.foundation/pEpEngine")
             (commit (string-append "Release_" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "00q96y9j985qfa382acsz02i0zf6ayq2gmg8z70jzl04isg1h3cn"))))
    (build-system gnu-build-system)
    (arguments
     '(#:parallel-build? #f
       #:make-flags '("NDEBUG=1") ; release build
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
           ;; pEpEngine does not use autotools and configure,
           ;; but a local.conf. We need to tweak the values there.
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (yml2 (assoc-ref inputs "yml2")))
               (with-output-to-file "local.conf"
                 (lambda ()
                   (format #t "
PREFIX=~a
PER_MACHINE_DIRECTORY=${PREFIX}/share/pEp
SYSTEM_DB=~a/share/pEp/system.db
ASN1C=~a
YML2_PATH=~a
OPENPGP=SEQUOIA
"
                           out out (which "asn1c")
                           (string-append yml2 "/bin"))))
               #t)))
         (delete 'check)
         (add-after 'install 'install-db
           (lambda _
             (invoke "make" "-C" "db" "install"))))))
    (native-inputs
     `(("asn1c" ,asn1c) ; >= 0.9.27
       ("pkg-config" ,pkg-config)
       ("yml2" ,yml2)))
    (inputs
     `(("libetpan" ,fdik-libetpan)
       ("libiconv" ,libiconv)
       ("nettle" ,nettle)
       ("openssl" ,openssl)
       ("sequoia" ,sequoia)
       ("sqlite3" ,sqlite)
       ("util-linux" ,util-linux "lib"))) ;; uuid.h
    (home-page "https://pep.foundation/")
    (synopsis "Library for automatic key management and encryption of
messages")
    (description "The p≡p engine is the core part of p≡p (pretty Easy
privacy).")
    (license ;; code: GPL 3, docs: CC-BY-SA
     (list license:gpl3 license:cc-by-sa3.0))))

(define-public libpepadapter
  (package
    (name "libpepadapter")
    (version "2.1.21")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitea.pep.foundation/pEp.foundation/libpEpAdapter")
             (commit (string-append "Release_" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "09ljj3x09y99wc47n063hpn62zi8cdvdha82rnaypvirrlga6a5w"))))
    (build-system gnu-build-system)
    (arguments
     '(#:test-target "test"
       #:tests? #f ;; building the tests fails
       #:make-flags '("NDEBUG=1") ; release build
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
           ;; libpEpAdapter does not use autotools and configure,
           ;; but a local.conf. We need to tweak the values there.
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (engine (assoc-ref inputs "pep-engine")))
               (with-output-to-file "local.conf"
                 (lambda _
                   (format #t "
PREFIX=~a
ENGINE_LIB_PATH=~a/lib
ENGINE_INC_PATH=~a/include
" out engine engine))))
             #t)))))
    (inputs
     `(("pep-engine" ,pep-engine)))
    (home-page "https://pep.foundation/")
    (synopsis "Library for building p≡p adapters")
    (description "This C++ library provides common structures used in p≡p
(pretty Easy privacy) adapters.")
    (license license:bsd-3)))

(define-public python-pep-adapter
  (package
    (name "python-pep-adapter")
    (version "2.1.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitea.pep.foundation/pEp.foundation/pEpPythonAdapter")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0ssz21p1k7xx3snmd4g3ggzq565rlzdmp90l2mph6yfp1y65p39s"))))
    (build-system python-build-system)
    (arguments
     `(;; Adding configure-flags does not work, running `build_ext`
       ;; with these flags, neither does adding the options to
       ;; `setup.cfg`: Either `build` or `install` fails (since
       ;; flags are given or missing), or "command 'BuildExtCommand'
       ;; has no such option 'pep_engine"
       ;; '(#:configure-flags
       ;;          (list (string-append "--with-pEp-engine="
       ;;                           (assoc-ref inputs "pEpEngine"))
       ;;                (string-append "--with-pEp-libadapter="
       ;;                           (assoc-ref inputs "libpEpAdapter"))
       ;;                ;;(string-append "--boost="
       ;;                           (assoc-ref inputs "boost")) not supported
       ;;                (string-append "--with-asn1c-share="
       ;;                           (assoc-ref inputs "asn1c") "/share"))
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'fix-setup.py
           (lambda _
             (substitute* "setup.py"
               (("^(\\s+SYS_INCLUDES = )\\['/usr.*" _ a)
                (string-append a "os.getenv('CPATH', '').split(os.pathsep)\n"))
               (("^(\\s+SYS_LIB_PREFIXES = )\\['/usr.*" _ a)
                (string-append a "os.getenv('LIBRARY_PATH', '').split(os.pathsep)\n"))
               (("^(\\s+SYS_SHARES = )\\['/usr.*" _ a)
                (string-append a "['" (assoc-ref %build-inputs "asn1c") "/share']\n")))
             #t))
         (add-before 'build 'remove-wheel-requirement
           ;; we dont't build a wheel
           (lambda _
             (substitute* "setup.cfg"
               ((" wheel *>= [0-9.]*") ""))
             (substitute* "pyproject.toml"
               (("\"wheel *>=.*\"") ""))
             #t)))))
    (native-inputs
     `(("python-pytest" ,python-pytest)
       ("python-pytest-forked" ,python-pytest-forked)))
    (inputs
     `(("boost" ,boost)
       ("libpepadapter" ,libpepadapter)
       ("pep-engine" ,pep-engine)
       ("python-setuptools-scm" ,python-setuptools-scm)
       ("util-linux" ,util-linux "lib"))) ;; uuid.h
    (home-page "https://pep.foundation/")
    (synopsis "Python adapter for p≡p (pretty Easy Privacy)")
    (description "The p≡p Python adapter is an adaptor interface to the p≡p
(pretty Easy privacy) engine.")
    (license license:gpl3)))

(define-public java-pep-adapter
  (package
    (name "java-pep-adapter")
    (version "2.1.23")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitea.pep.foundation/pEp.foundation/pEpJNIAdapter")
             (commit (string-append "Release_" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1sw3a5ggxcrkghvpp0a6h2lz461x55ldgfw5y4pw7c3gk5wynvjk"))))
    (build-system gnu-build-system)
    (outputs '("out" "doc"))
    (arguments
     `(#:test-target "test"
       #:make-flags '("NDEBUG=1" "all" "doc") ; release build
       #:phases
       (modify-phases %standard-phases
         (add-before 'configure 'pin-shared-lib-path
           (lambda* (#:key outputs #:allow-other-keys)
             (substitute* "src/java/foundation/pEp/jniadapter/AbstractEngine.java"
               (("System.loadLibrary\\(\"pEpJNI\"\\);")
                (string-append "System.load(\""
                               (assoc-ref outputs "out")
                               "/lib/libpEpJNI.so" "\");")))
             #t))
         (replace 'configure
           ;; pEpJNIAdapter does not use autotools and configure,
           ;; but a local.conf. We need to tweak the values there.
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (engine (assoc-ref inputs "pep-engine"))
                   (libadapter (assoc-ref inputs "libpepadapter"))
                   (openjdk  (assoc-ref inputs "openjdk")))
               (with-output-to-file "local.conf"
                 (lambda _
                   (format #t "
PREFIX=~a
ENGINE_LIB_PATH=~a/lib
ENGINE_INC_PATH=~a/include
AD_LIB_PATH=~a/lib
AD_INC_PATH=~a/include
YML2_PROC=~a
JAVA_HOME=~a
"
                           out engine engine libadapter libadapter
                           (which "yml2proc") openjdk)))
               (substitute* "src/Makefile"  ;; suppress some warnings
                 (("^\\s+OLD_JAVA=") "    xxx_OLD_JAVA="))
               #t)))
         (add-before 'build 'build-codegen
           ;; run codegen first to allow parallel build of other parts
           (lambda _
             (invoke "make" "-C" "src" "create-dirs" "codegen")))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (libout (string-append out "/lib/"))
                    (javaout (string-append out "/share/java/")))
               (install-file "dist/libpEpJNI.a" libout)
               (install-file "dist/libpEpJNI.so" libout)
               (install-file "dist/pEp.jar" javaout)
               #t)))
         (add-after 'install 'install-docs
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "doc"))
                    (docout (string-append out "/share/doc/pEp-JNI-adapter"))
                    (cxxout (string-append docout "/cxx"))
                    (javaout (string-append docout "/java")))
               (mkdir-p cxxout)
               (mkdir-p javaout)
               (copy-recursively "doc/doxygen/cxx/html" cxxout)
               (copy-recursively "doc/doxygen/java/html" javaout)
               #t))))))
    (native-inputs
     `(("doxygen" ,doxygen)
       ("graphviz" ,graphviz)
       ("openjdk" ,openjdk9 "jdk")
       ("which" ,which)
       ("yml2" ,yml2)))
    (inputs
     `(("libpepadapter" ,libpepadapter)
       ("pep-engine" ,pep-engine)
       ("util-linux" ,util-linux "lib"))) ;; uuid.h
    (home-page "https://pep.foundation/")
    (synopsis "Java adapter for p≡p (pretty Easy Privacy)")
    (description "The p≡p JNI adapter is a Java adapter interface to the p≡p
(pretty Easy privacy) engine.")
    (license license:gpl3)))