Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / i2p.scm
CommitLineData
2fba90a8
JK
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>
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 i2p)
20 #:use-module (gnu packages boost)
21 #:use-module (gnu packages compression)
22 #:use-module (gnu packages tls)
23 #:use-module (gnu packages upnp)
24 #:use-module (gnu packages web)
25 #:use-module (guix packages)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
28 #:use-module ((guix licenses) #:prefix license:))
29
30(define-public i2pd
31 (package
32 (name "i2pd")
9a05da36 33 (version "2.29.0")
2fba90a8
JK
34 (source
35 (origin
36 (method git-fetch)
37 (uri (git-reference
38 (url "https://github.com/PurpleI2P/i2pd.git")
39 (commit version)))
40 (file-name (git-file-name name version))
41 (sha256
9a05da36 42 (base32 "1issg3aidwikk4g12sa8q81zzp0hd0g8wdy2dx4899z8yrscl300"))))
2fba90a8
JK
43 (build-system cmake-build-system)
44 (inputs `(("boost" ,boost)
45 ("miniupnpc" ,miniupnpc)
46 ("openssl" ,openssl)
47 ("websocketpp" ,websocketpp)
48 ("zlib" ,zlib)))
49 (arguments '(#:configure-flags
50 (let ((source (assoc-ref %build-inputs "source")))
51 (list (string-append "-S" source "/build")
52 "-DWITH_PCH=OFF"
53 "-DWITH_STATIC=OFF"
54 "-DWITH_UPNP=ON"
55 "-DWITH_WEBSOCKETS=ON"
56 "-DWITH_LIBRARY=ON"
57 "-DBUILD_SHARED_LIBS=ON"
58 "-DWITH_BINARY=ON"))
59 #:phases
60 (modify-phases %standard-phases
61 (replace 'check
62 (lambda* (#:key
63 (make-flags '())
64 (parallel-tests? #t)
65 #:allow-other-keys)
262f904e 66 (let ((source (assoc-ref %build-inputs "source")))
2fba90a8
JK
67 (copy-recursively (string-append source "/tests")
68 "./tests")
262f904e
EF
69 (with-directory-excursion "tests"
70 (substitute* "Makefile"
9a05da36
GLV
71 (("../libi2pd/") (string-append source "/libi2pd/"))
72 ;; Disable the x25519 test, which only compiles if
73 ;; openssl doesn't have X25519 support, but the
74 ;; version we use has it.
75 (("test-base-64 test-x25519 test-aeadchacha20poly1305")
76 "test-base-64 test-aeadchacha20poly1305"))
262f904e
EF
77 (apply invoke "make" "all"
78 `(,@(if parallel-tests?
79 `("-j" ,(number->string
80 (parallel-job-count)))
81 '())
82 ,@make-flags))))))
2fba90a8
JK
83 (add-after 'install 'install-headers
84 (lambda* (#:key outputs #:allow-other-keys)
85 (let* ((install-dir (assoc-ref outputs "out"))
86 (src-dir (string-append install-dir "/src"))
87 (include-dir
88 (string-append install-dir "/include")))
89 (mkdir-p include-dir)
90 ;; This is the only header file that's relevant to the
91 ;; public interface.
92 ;; <https://github.com/PurpleI2P/i2pd/issues/1378>
93 (install-file (string-append src-dir "/api.h")
94 include-dir)
95 #t)))
96 (add-after 'install-headers 'remove-source
97 (lambda* (#:key outputs #:allow-other-keys)
98 (let* ((install-dir (assoc-ref outputs "out"))
99 (src-dir (string-append install-dir "/src")))
100 (delete-file-recursively src-dir)
101 (delete-file (string-append install-dir
102 "/LICENSE"))
103 #t))))))
104 (home-page "https://i2pd.website/")
105 (synopsis "Router for an end-to-end encrypted and anonymous internet")
106 (description "i2pd is a client for the anonymous I2P network, upon which
107applications for file sharing, web browsing, instant messaging, and more are
108built. i2pd allows people from all around the world to communicate and share
109information securely without restrictions.")
110 (license license:bsd-3)))