| 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 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)) |
| 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 |
| 57 | a grammar") |
| 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))) |
| 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 | |
| 84 | (define sequoia4pEp |
| 85 | ;; Currently pEp Engine requires sequoia in not-so-current version |
| 86 | (package/inherit sequoia |
| 87 | (name "sequoia") |
| 88 | (version "0.15.0-pEp") |
| 89 | (source |
| 90 | (origin |
| 91 | (method git-fetch) |
| 92 | (uri (git-reference |
| 93 | (url "https://gitlab.com/sequoia-pgp/sequoia.git") |
| 94 | (commit "0eb1b6cd846ea8c36b3dfdf01ec88383fc64f2fe"))) |
| 95 | (sha256 |
| 96 | (base32 "06dqs9whwp9lfibwp8dqm0aw4nm3s3v4jp2n4fz51zcvsld40nfh")) |
| 97 | (file-name (git-file-name name version)))))) |
| 98 | |
| 99 | (define-public pep-engine |
| 100 | (package |
| 101 | (name "pep-engine") |
| 102 | (version "2.0.6") |
| 103 | (source |
| 104 | (origin |
| 105 | (method hg-fetch) |
| 106 | (uri (hg-reference |
| 107 | (url "https://pep.foundation/dev/repos/pEpEngine") |
| 108 | (changeset "ebb62ba262dd"))) ;; r4721 |
| 109 | (file-name (string-append name "-" version "-checkout")) |
| 110 | (sha256 |
| 111 | (base32 "0ljf79j4ng7l8w6pbdcrfzb4yk51zslypvq0n72ib1d7grqvnagi")))) |
| 112 | (build-system gnu-build-system) |
| 113 | (arguments |
| 114 | '(#:parallel-build? #f |
| 115 | #:phases |
| 116 | (modify-phases %standard-phases |
| 117 | (replace 'configure |
| 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" |
| 124 | (lambda () |
| 125 | (format #t " |
| 126 | PREFIX=~a |
| 127 | PER_MACHINE_DIRECTORY=${PREFIX}/share/pEp |
| 128 | SYSTEM_DB=~a/share/pEp/system.db |
| 129 | ASN1C=~a |
| 130 | YML2_PATH=~a |
| 131 | OPENPGP=SEQUOIA |
| 132 | " |
| 133 | out out (which "asn1c") |
| 134 | (string-append yml2 "/bin")))) |
| 135 | #t))) |
| 136 | (delete 'check) |
| 137 | (add-after 'install 'install-db |
| 138 | (lambda _ |
| 139 | (invoke "make" "-C" "db" "install")))))) |
| 140 | (native-inputs |
| 141 | `(("asn1c" ,asn1c) ; >= 0.9.27 |
| 142 | ("pkg-config" ,pkg-config) |
| 143 | ("yml2" ,yml2))) |
| 144 | (inputs |
| 145 | `(("libetpan" ,fdik-libetpan) |
| 146 | ("libiconv" ,libiconv) |
| 147 | ("nettle" ,nettle) |
| 148 | ("openssl" ,openssl) |
| 149 | ("sequoia" ,sequoia4pEp) |
| 150 | ("sqlite3" ,sqlite) |
| 151 | ("util-linux" ,util-linux "lib"))) ;; uuid.h |
| 152 | (home-page "https://pep.foundation/") |
| 153 | (synopsis "Library for automatic key management and encryption of |
| 154 | messages") |
| 155 | (description "The p≡p engine is the core part of p≡p (pretty Easy |
| 156 | privacy).") |
| 157 | (license ;; code: GPL 3, docs: CC-BY-SA |
| 158 | (list license:gpl3 license:cc-by-sa3.0)))) |
| 159 | |
| 160 | (define-public libpepadapter |
| 161 | (package |
| 162 | (name "libpepadapter") |
| 163 | (version "2.0.2") |
| 164 | (source |
| 165 | (origin |
| 166 | (method hg-fetch) |
| 167 | (uri (hg-reference |
| 168 | (url "https://pep.foundation/dev/repos/libpEpAdapter") |
| 169 | (changeset "e8fe371c870a"))) ;; r168 |
| 170 | (file-name (string-append name "-" version "-checkout")) |
| 171 | (sha256 |
| 172 | (base32 "1mlpavjbnmslvmr5jxcvpjgb2x40nhmxjb10hza3kn4qzj0k1pjz")))) |
| 173 | (build-system gnu-build-system) |
| 174 | (arguments |
| 175 | '(#:test-target "test" |
| 176 | #:tests? #f ;; building the tests fails |
| 177 | #:phases |
| 178 | (modify-phases %standard-phases |
| 179 | (replace 'configure |
| 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" |
| 186 | (lambda _ ;() |
| 187 | (format #t " |
| 188 | PREFIX=~a |
| 189 | ENGINE_LIB_PATH=~a/lib |
| 190 | ENGINE_INC_PATH=~a/include |
| 191 | " out engine engine)))) |
| 192 | #t))))) |
| 193 | (inputs |
| 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))) |
| 200 | |
| 201 | (define-public python-pep-adapter |
| 202 | (package |
| 203 | (name "python-pep-adapter") |
| 204 | (version "2.0.5") |
| 205 | (source |
| 206 | (origin |
| 207 | (method hg-fetch) |
| 208 | (uri (hg-reference |
| 209 | (url "https://pep.foundation/dev/repos/pEpPythonAdapter") |
| 210 | (changeset "66df0e5b9405"))) ;; r374 |
| 211 | (file-name (string-append name "-" version "-checkout")) |
| 212 | (sha256 |
| 213 | (base32 "107i1s8jf8gyhpmqcs64q9csxa3fwc8g7s57iyccqb4czw8gph6d")))) |
| 214 | (build-system python-build-system) |
| 215 | (arguments |
| 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")) |
| 230 | #:phases |
| 231 | (modify-phases %standard-phases |
| 232 | (add-before 'build 'fix-setup.py |
| 233 | (lambda _ |
| 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"))) |
| 241 | #t))))) |
| 242 | (inputs |
| 243 | `(("asn1c" ,asn1c) |
| 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))) |
| 252 | |
| 253 | (define-public java-pep-adapter |
| 254 | (package |
| 255 | (name "java-pep-adapter") |
| 256 | (version "2.0.5") |
| 257 | (source |
| 258 | (origin |
| 259 | (method hg-fetch) |
| 260 | (uri (hg-reference |
| 261 | (url "https://pep.foundation/dev/repos/pEpJNIAdapter") |
| 262 | (changeset "534537c9cd50"))) ;; r763 |
| 263 | (file-name (string-append name "-" version "-checkout")) |
| 264 | (sha256 |
| 265 | (base32 "107ldpssc80bq8kndn2n000000gphj4lqagaiv3fddlfph4vji48")))) |
| 266 | (build-system gnu-build-system) |
| 267 | (outputs '("out" "doc")) |
| 268 | (arguments |
| 269 | `(#:test-target "test" |
| 270 | #:make-flags (list "doxy-all") |
| 271 | #:phases |
| 272 | (modify-phases %standard-phases |
| 273 | (add-before 'configure 'fix-includes |
| 274 | (lambda _ |
| 275 | (substitute* "src/jniutils.hh" |
| 276 | (("#pragma once\n" line) |
| 277 | (string-append line |
| 278 | "#include <mutex>\n" |
| 279 | "#include <cassert>\n" |
| 280 | "#include <cstring>\n"))) |
| 281 | #t)) |
| 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" "\");"))) |
| 289 | #t)) |
| 290 | (replace 'configure |
| 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" |
| 299 | (lambda _ ;() |
| 300 | (format #t " |
| 301 | PREFIX=~a |
| 302 | ENGINE_LIB_PATH=~a/lib |
| 303 | ENGINE_INC_PATH=~a/include |
| 304 | AD_LIB_PATH=~a/lib |
| 305 | AD_INC_PATH=~a/include |
| 306 | YML2_PROC=~a |
| 307 | JAVA_HOME=~a |
| 308 | " |
| 309 | out engine engine libadapter libadapter |
| 310 | (which "yml2proc") openjdk))) |
| 311 | (substitute* "src/Makefile" ;; suppress some warnings |
| 312 | (("^\\s+OLD_JAVA=") " xxx_OLD_JAVA=")) |
| 313 | #t))) |
| 314 | (replace 'install |
| 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/"))) |
| 319 | (mkdir-p libout) |
| 320 | (mkdir-p javaout) |
| 321 | (copy-file "src/libpEpJNI.so" |
| 322 | (string-append libout "/libpEpJNI.so")) |
| 323 | (copy-file "src/pEp.jar" (string-append javaout "/pEp.jar")) |
| 324 | #t))) |
| 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"))) |
| 331 | (mkdir-p cxxout) |
| 332 | (mkdir-p javaout) |
| 333 | (copy-recursively "doc/doxygen/cxx/html" cxxout) |
| 334 | (copy-recursively "doc/doxygen/java/html" javaout) |
| 335 | #t)))))) |
| 336 | (native-inputs |
| 337 | `(("doxygen" ,doxygen) |
| 338 | ("openjdk" ,openjdk9 "jdk") |
| 339 | ("which" ,which) |
| 340 | ("yml2" ,yml2))) |
| 341 | (inputs |
| 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))) |