pep.scm 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016, 2020, 2021 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. (define-module (gnu packages pep)
  19. #:use-module ((guix licenses) #:prefix license:)
  20. #:use-module (guix packages)
  21. #:use-module (guix git-download)
  22. #:use-module (guix build-system gnu)
  23. #:use-module (guix build-system python)
  24. #:use-module (gnu packages)
  25. #:use-module (gnu packages base)
  26. #:use-module (gnu packages boost)
  27. #:use-module (gnu packages check)
  28. #:use-module (gnu packages documentation)
  29. #:use-module (gnu packages graphviz)
  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 python-xyz)
  36. #:use-module (gnu packages sequoia)
  37. #:use-module (gnu packages sqlite)
  38. #:use-module (gnu packages tls)
  39. #:use-module (gnu packages xml))
  40. (define-public yml2
  41. (package
  42. (name "yml2")
  43. (version "2.7.0")
  44. (source
  45. (origin
  46. (method git-fetch)
  47. (uri (git-reference
  48. (url "https://gitea.pep.foundation/fdik/yml2")
  49. (commit version)))
  50. (file-name (git-file-name name version))
  51. (sha256
  52. (base32 "0fm1x1fv4lwcpbn59s55idzf7x173n59xpz8rlrxalmi6gvsjijr"))))
  53. (build-system python-build-system)
  54. (propagated-inputs
  55. `(("python-lxml" ,python-lxml)))
  56. (home-page "https://fdik.org/yml/")
  57. (synopsis "Use a Domain Specific Language for XML without defining
  58. a grammar")
  59. (description "The YML compiler is a small Python script. It
  60. provides the command line front end yml2c. As default, it compiles
  61. your script and outputs to stdout, that usually is the terminal. Your
  62. shell provides options to redirect the output into a pipe or a file.")
  63. (license license:gpl2)))
  64. (define fdik-libetpan
  65. ;; pEp Engine requires libetpan with a set of patches that have not been
  66. ;; upstreamed yet.
  67. (let ((commit "0b80c39dd1504462ba3a39dc53db7c960c3a63f3") ; 2020-11-27
  68. (checksum "0gv3ivaziadybjlf6rfpv1j5z5418243v5cvl4swlxd2njsh7gjk")
  69. (revision "6"))
  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://gitea.pep.foundation/pEp.foundation/libetpan")
  80. (commit commit)))
  81. (file-name (string-append name "-" version))
  82. (sha256 (base32 checksum)))))))
  83. (define-public pep-engine
  84. (package
  85. (name "pep-engine")
  86. (version "2.1.34")
  87. (source
  88. (origin
  89. (method git-fetch)
  90. (uri (git-reference
  91. (url "https://gitea.pep.foundation/pEp.foundation/pEpEngine")
  92. (commit (string-append "Release_" version))))
  93. (file-name (git-file-name name version))
  94. (sha256
  95. (base32 "00q96y9j985qfa382acsz02i0zf6ayq2gmg8z70jzl04isg1h3cn"))))
  96. (build-system gnu-build-system)
  97. (arguments
  98. '(#:parallel-build? #f
  99. #:make-flags '("NDEBUG=1") ; release build
  100. #:phases
  101. (modify-phases %standard-phases
  102. (replace 'configure
  103. ;; pEpEngine 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 "
  111. PREFIX=~a
  112. PER_MACHINE_DIRECTORY=${PREFIX}/share/pEp
  113. SYSTEM_DB=~a/share/pEp/system.db
  114. ASN1C=~a
  115. YML2_PATH=~a
  116. OPENPGP=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" ,sequoia)
  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
  139. messages")
  140. (description "The p≡p engine is the core part of p≡p (pretty Easy
  141. privacy).")
  142. (license ;; code: GPL 3, docs: CC-BY-SA
  143. (list license:gpl3 license:cc-by-sa3.0))))
  144. (define-public libpepadapter
  145. (package
  146. (name "libpepadapter")
  147. (version "2.1.21")
  148. (source
  149. (origin
  150. (method git-fetch)
  151. (uri (git-reference
  152. (url "https://gitea.pep.foundation/pEp.foundation/libpEpAdapter")
  153. (commit (string-append "Release_" version))))
  154. (file-name (git-file-name name version))
  155. (sha256
  156. (base32 "09ljj3x09y99wc47n063hpn62zi8cdvdha82rnaypvirrlga6a5w"))))
  157. (build-system gnu-build-system)
  158. (arguments
  159. '(#:test-target "test"
  160. #:tests? #f ;; building the tests fails
  161. #:make-flags '("NDEBUG=1") ; release build
  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 "
  173. PREFIX=~a
  174. ENGINE_LIB_PATH=~a/lib
  175. ENGINE_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)))
  185. (define-public python-pep-adapter
  186. (package
  187. (name "python-pep-adapter")
  188. (version "2.1.3")
  189. (source
  190. (origin
  191. (method git-fetch)
  192. (uri (git-reference
  193. (url "https://gitea.pep.foundation/pEp.foundation/pEpPythonAdapter")
  194. (commit version)))
  195. (file-name (git-file-name name version))
  196. (sha256
  197. (base32 "0ssz21p1k7xx3snmd4g3ggzq565rlzdmp90l2mph6yfp1y65p39s"))))
  198. (build-system python-build-system)
  199. (arguments
  200. `(;; Adding configure-flags does not work, running `build_ext`
  201. ;; with these flags, neither does adding the options to
  202. ;; `setup.cfg`: Either `build` or `install` fails (since
  203. ;; flags are given or missing), or "command 'BuildExtCommand'
  204. ;; has no such option 'pep_engine"
  205. ;; '(#:configure-flags
  206. ;; (list (string-append "--with-pEp-engine="
  207. ;; (assoc-ref inputs "pEpEngine"))
  208. ;; (string-append "--with-pEp-libadapter="
  209. ;; (assoc-ref inputs "libpEpAdapter"))
  210. ;; ;;(string-append "--boost="
  211. ;; (assoc-ref inputs "boost")) not supported
  212. ;; (string-append "--with-asn1c-share="
  213. ;; (assoc-ref inputs "asn1c") "/share"))
  214. #:phases
  215. (modify-phases %standard-phases
  216. (add-before 'build 'fix-setup.py
  217. (lambda _
  218. (substitute* "setup.py"
  219. (("^(\\s+SYS_INCLUDES = )\\['/usr.*" _ a)
  220. (string-append a "os.getenv('CPATH', '').split(os.pathsep)\n"))
  221. (("^(\\s+SYS_LIB_PREFIXES = )\\['/usr.*" _ a)
  222. (string-append a "os.getenv('LIBRARY_PATH', '').split(os.pathsep)\n"))
  223. (("^(\\s+SYS_SHARES = )\\['/usr.*" _ a)
  224. (string-append a "['" (assoc-ref %build-inputs "asn1c") "/share']\n")))
  225. #t))
  226. (add-before 'build 'remove-wheel-requirement
  227. ;; we dont't build a wheel
  228. (lambda _
  229. (substitute* "setup.cfg"
  230. ((" wheel *>= [0-9.]*") ""))
  231. (substitute* "pyproject.toml"
  232. (("\"wheel *>=.*\"") ""))
  233. #t)))))
  234. (native-inputs
  235. `(("python-pytest" ,python-pytest)
  236. ("python-pytest-forked" ,python-pytest-forked)))
  237. (inputs
  238. `(("boost-python" ,boost-with-python3)
  239. ("libpepadapter" ,libpepadapter)
  240. ("pep-engine" ,pep-engine)
  241. ("python-setuptools-scm" ,python-setuptools-scm)
  242. ("util-linux" ,util-linux "lib"))) ;; uuid.h
  243. (home-page "https://pep.foundation/")
  244. (synopsis "Python adapter for p≡p (pretty Easy Privacy)")
  245. (description "The p≡p Python adapter is an adaptor interface to the p≡p
  246. (pretty Easy privacy) engine.")
  247. (license license:gpl3)))
  248. (define-public java-pep-adapter
  249. (package
  250. (name "java-pep-adapter")
  251. (version "2.1.23")
  252. (source
  253. (origin
  254. (method git-fetch)
  255. (uri (git-reference
  256. (url "https://gitea.pep.foundation/pEp.foundation/pEpJNIAdapter")
  257. (commit (string-append "Release_" version))))
  258. (file-name (git-file-name name version))
  259. (sha256
  260. (base32 "1sw3a5ggxcrkghvpp0a6h2lz461x55ldgfw5y4pw7c3gk5wynvjk"))))
  261. (build-system gnu-build-system)
  262. (outputs '("out" "doc"))
  263. (arguments
  264. `(#:test-target "test"
  265. #:make-flags '("NDEBUG=1" "all" "doc") ; release build
  266. #:phases
  267. (modify-phases %standard-phases
  268. (add-before 'configure 'pin-shared-lib-path
  269. (lambda* (#:key outputs #:allow-other-keys)
  270. (substitute* "src/java/foundation/pEp/jniadapter/AbstractEngine.java"
  271. (("System.loadLibrary\\(\"pEpJNI\"\\);")
  272. (string-append "System.load(\""
  273. (assoc-ref outputs "out")
  274. "/lib/libpEpJNI.so" "\");")))
  275. #t))
  276. (replace 'configure
  277. ;; pEpJNIAdapter does not use autotools and configure,
  278. ;; but a local.conf. We need to tweak the values there.
  279. (lambda* (#:key inputs outputs #:allow-other-keys)
  280. (let ((out (assoc-ref outputs "out"))
  281. (engine (assoc-ref inputs "pep-engine"))
  282. (libadapter (assoc-ref inputs "libpepadapter"))
  283. (openjdk (assoc-ref inputs "openjdk")))
  284. (with-output-to-file "local.conf"
  285. (lambda _
  286. (format #t "
  287. PREFIX=~a
  288. ENGINE_LIB_PATH=~a/lib
  289. ENGINE_INC_PATH=~a/include
  290. AD_LIB_PATH=~a/lib
  291. AD_INC_PATH=~a/include
  292. YML2_PROC=~a
  293. JAVA_HOME=~a
  294. "
  295. out engine engine libadapter libadapter
  296. (which "yml2proc") openjdk)))
  297. (substitute* "src/Makefile" ;; suppress some warnings
  298. (("^\\s+OLD_JAVA=") " xxx_OLD_JAVA="))
  299. #t)))
  300. (add-before 'build 'build-codegen
  301. ;; run codegen first to allow parallel build of other parts
  302. (lambda _
  303. (invoke "make" "-C" "src" "create-dirs" "codegen")))
  304. (replace 'install
  305. (lambda* (#:key outputs #:allow-other-keys)
  306. (let* ((out (assoc-ref outputs "out"))
  307. (libout (string-append out "/lib/"))
  308. (javaout (string-append out "/share/java/")))
  309. (install-file "dist/libpEpJNI.a" libout)
  310. (install-file "dist/libpEpJNI.so" libout)
  311. (install-file "dist/pEp.jar" javaout)
  312. #t)))
  313. (add-after 'install 'install-docs
  314. (lambda* (#:key outputs #:allow-other-keys)
  315. (let* ((out (assoc-ref outputs "doc"))
  316. (docout (string-append out "/share/doc/pEp-JNI-adapter"))
  317. (cxxout (string-append docout "/cxx"))
  318. (javaout (string-append docout "/java")))
  319. (mkdir-p cxxout)
  320. (mkdir-p javaout)
  321. (copy-recursively "doc/doxygen/cxx/html" cxxout)
  322. (copy-recursively "doc/doxygen/java/html" javaout)
  323. #t))))))
  324. (native-inputs
  325. `(("doxygen" ,doxygen)
  326. ("graphviz" ,graphviz)
  327. ("openjdk" ,openjdk9 "jdk")
  328. ("which" ,which)
  329. ("yml2" ,yml2)))
  330. (inputs
  331. `(("libpepadapter" ,libpepadapter)
  332. ("pep-engine" ,pep-engine)
  333. ("util-linux" ,util-linux "lib"))) ;; uuid.h
  334. (home-page "https://pep.foundation/")
  335. (synopsis "Java adapter for p≡p (pretty Easy Privacy)")
  336. (description "The p≡p JNI adapter is a Java adapter interface to the p≡p
  337. (pretty Easy privacy) engine.")
  338. (license license:gpl3)))