gnu: jami: Add epoll support.
[jackhill/guix/guix.git] / gnu / packages / jami.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
3 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
4 ;;; Copyright © 2019, 2020 Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages jami)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (gnu packages aidc)
24 #:use-module (gnu packages audio)
25 #:use-module (gnu packages autotools)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages boost)
28 #:use-module (gnu packages check)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages crypto)
31 #:use-module (gnu packages documentation)
32 #:use-module (gnu packages gettext)
33 #:use-module (gnu packages glib)
34 #:use-module (gnu packages gnome)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages hurd)
37 #:use-module (gnu packages libcanberra)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages multiprecision)
40 #:use-module (gnu packages networking)
41 #:use-module (gnu packages pcre)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages pulseaudio)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages qt)
47 #:use-module (gnu packages serialization)
48 #:use-module (gnu packages sqlite)
49 #:use-module (gnu packages telephony)
50 #:use-module (gnu packages tls)
51 #:use-module (gnu packages upnp)
52 #:use-module (gnu packages video)
53 #:use-module (gnu packages webkit)
54 #:use-module (gnu packages xiph)
55 #:use-module (gnu packages xorg)
56 #:use-module (gnu packages)
57 #:use-module (guix build-system cmake)
58 #:use-module (guix build-system gnu)
59 #:use-module (guix download)
60 #:use-module (guix git-download)
61 #:use-module (guix packages)
62 #:use-module (guix utils))
63
64 (define %jami-version "20200401.1.6f090de")
65
66 (define* (jami-source #:key without-daemon)
67 (origin
68 (method url-fetch)
69 (uri (string-append "https://dl.jami.net/release/tarballs/jami_"
70 %jami-version
71 ".tar.gz"))
72 (modules '((guix build utils)))
73 (snippet
74 (if without-daemon
75 '(begin
76 (delete-file-recursively "daemon/contrib"))
77 #f))
78 (sha256
79 (base32
80 "0lryx9n1jn0jsw7s10pbwivqv0d5m3jdzhdhdyg5n02v72mjvkmh"))))
81
82 ;; Savoir-Faire Linux modifies many libraries to add features
83 ;; to Jami. This procedure makes applying patches to a given
84 ;; package easy.
85 (define jami-apply-dependency-patches
86 '(lambda* (#:key inputs dep-name patches)
87 (let ((patches-directory "sfl-patches"))
88 (mkdir-p patches-directory)
89 (invoke "tar" "-xvf" (assoc-ref inputs "sfl-patches")
90 "-C" patches-directory
91 "--strip-components=5"
92 (string-append "ring-project/daemon/contrib/src/"
93 dep-name))
94 (for-each
95 (lambda (file)
96 (invoke "patch" "--force" "-p1" "-i"
97 (string-append patches-directory "/"
98 file ".patch")))
99 patches))))
100
101 (define-public pjproject-jami
102 (package
103 (inherit pjproject)
104 (name "pjproject-jami")
105 (native-inputs
106 `(("sfl-patches" ,(jami-source))
107 ,@(package-native-inputs pjproject)))
108 (arguments
109 `(#:tests? #f
110 ;; See ring-project/daemon/contrib/src/pjproject/rules.mak.
111 #:configure-flags
112 (list "--disable-oss"
113 "--disable-sound"
114 "--disable-video"
115 ;; The following flag is Linux specific.
116 ,@(if (hurd-triplet? (or (%current-system)
117 (%current-target-system)))
118 '()
119 '("--enable-epoll"))
120 "--enable-ext-sound"
121 "--disable-speex-aec"
122 "--disable-g711-codec"
123 "--disable-l16-codec"
124 "--disable-gsm-codec"
125 "--disable-g722-codec"
126 "--disable-g7221-codec"
127 "--disable-speex-codec"
128 "--disable-ilbc-codec"
129 "--disable-opencore-amr"
130 "--disable-silk"
131 "--disable-sdl"
132 "--disable-ffmpeg"
133 "--disable-v4l2"
134 "--disable-openh264"
135 "--disable-resample"
136 "--disable-libwebrtc"
137 "--with-gnutls"
138 "--with-external-srtp"
139 ;; We need -fPIC or else we get the following error when linking
140 ;; against pjproject-jami:
141 ;; relocation R_X86_64_32S against `.rodata' can not be used when
142 ;; making a shared object;
143 "CFLAGS=-fPIC"
144 "CXXFLAGS=-fPIC")
145 #:phases
146 (modify-phases %standard-phases
147 (add-after 'unpack 'make-git-checkout-writable
148 (lambda _
149 (for-each make-file-writable (find-files "."))
150 #t))
151 (add-after 'unpack 'apply-patches
152 (lambda* (#:key inputs #:allow-other-keys)
153 (let ((jami-apply-dependency-patches ,jami-apply-dependency-patches))
154 ;; Comes from
155 ;; "ring-project/daemon/contrib/src/pjproject/rules.mak".
156 ;; WARNING: These amount for huge changes in pjproject.
157 (jami-apply-dependency-patches
158 #:inputs inputs
159 #:dep-name "pjproject"
160 #:patches
161 '("0001-rfc6544"
162 "0002-rfc2466"
163 "0003-add-tcp-keep-alive"
164 "0004-multiple_listeners"
165 "0005-fix_ebusy_turn"
166 "0006-ignore_ipv6_on_transport_check"
167 "0007-pj_ice_sess"
168 "0008-fix_ioqueue_ipv6_sendto"
169 "0009-add-config-site"))
170 #t)))
171 ;; TODO: We could use substitute-keyword-arguments instead of
172 ;; repeating the phases from pjproject, but somehow it does
173 ;; not work.
174 (add-before 'build 'build-dep
175 (lambda _ (invoke "make" "dep")))
176 (add-before 'patch-source-shebangs 'autoconf
177 (lambda _
178 (invoke "autoconf" "-v" "-f" "-i" "-o"
179 "aconfigure" "aconfigure.ac")))
180 (add-before 'autoconf 'disable-some-tests
181 ;; Three of the six test programs fail due to missing network
182 ;; access.
183 (lambda _
184 (substitute* "Makefile"
185 (("selftest: pjlib-test pjlib-util-test pjnath-test pjmedia-test pjsip-test pjsua-test")
186 "selftest: pjlib-test pjlib-util-test pjmedia-test"))
187 #t)))))))
188
189 (define-public libring
190 (package
191 (name "libring")
192 (version %jami-version)
193 (source (jami-source #:without-daemon #t))
194 (build-system gnu-build-system)
195 (inputs
196 `(("alsa-lib" ,alsa-lib)
197 ("boost" ,boost)
198 ("dbus-c++" ,dbus-c++)
199 ("eudev" ,eudev)
200 ("ffmpeg" ,ffmpeg)
201 ("flac" ,flac)
202 ("gmp" ,gmp)
203 ("gsm" ,gsm)
204 ("jack" ,jack-1)
205 ("jsoncpp" ,jsoncpp)
206 ("libnatpmp" ,libnatpmp)
207 ("libogg" ,libogg)
208 ("libva" ,libva)
209 ("opendht" ,opendht)
210 ("opus" ,opus)
211 ("pcre" ,pcre)
212 ("pulseaudio" ,pulseaudio)
213 ("libsamplerate" ,libsamplerate)
214 ("libsndfile" ,libsndfile)
215 ("speex" ,speex)
216 ("speexdsp" ,speexdsp)
217 ("libupnp" ,libupnp)
218 ("libvorbis" ,libvorbis)
219 ("libx264" ,libx264)
220 ("libvdpau" ,libvdpau)
221 ("yaml-cpp" ,yaml-cpp)
222 ("zlib" ,zlib)
223 ("openssl" ,openssl)
224 ("libsecp256k1" ,libsecp256k1)
225 ("python" ,python)
226 ("python-wrapper" ,python-wrapper)
227 ("restinio" ,restinio)
228 ("libx11" ,libx11)
229 ("asio" ,asio)
230 ;; TODO: Upstream seems to rely on a custom pjproject (a.k.a. pjsip) version.
231 ;; See https://git.jami.net/savoirfairelinux/ring-daemon/issues/24.
232 ("pjproject" ,pjproject-jami)))
233 (native-inputs
234 `(("autoconf" ,autoconf)
235 ("automake" ,automake)
236 ("libtool" ,libtool)
237 ("pkg-config" ,pkg-config)
238 ("which" ,which)
239 ("cppunit" ,cppunit)
240 ("perl" ,perl))) ; Needed for documentation.
241 (arguments
242 `(#:tests? #f ; The tests fail to compile due to missing headers.
243 #:phases
244 (modify-phases %standard-phases
245 (add-after 'unpack 'change-directory
246 (lambda _
247 (chdir "daemon")
248 #t))
249 (add-before 'build 'add-lib-dir
250 (lambda _
251 (mkdir-p "src/lib")
252 #t)))))
253 (synopsis "Distributed multimedia communications platform")
254 (description "Jami (formerly GNU Ring) is a secure and distributed voice,
255 video and chat communication platform that requires no centralized server and
256 leaves the power of privacy in the hands of the user. It supports the SIP and
257 IAX protocols, as well as decentralized calling using P2P-DHT.
258
259 This package provides a library and daemon implementing the Jami core
260 functionality.")
261 (home-page "https://jami.net/")
262 (license license:gpl3+)))
263
264 (define-public libringclient
265 (package
266 (inherit libring)
267 (name "libringclient")
268 (build-system cmake-build-system)
269 (propagated-inputs
270 `(("libring" ,libring) ; For 'dring'.
271 ("qtbase" ,qtbase) ; Qt is included in several installed headers.
272 ("qttools" ,qttools)))
273 (arguments
274 `(#:tests? #f ; There is no testsuite.
275 #:configure-flags
276 (list (string-append "-DRING_BUILD_DIR="
277 (assoc-ref %build-inputs "libring") "/include"))
278 #:phases
279 (modify-phases %standard-phases
280 (add-after 'unpack 'change-directory
281 (lambda _
282 (chdir "lrc")
283 #t))
284 (add-before 'configure 'fix-dbus-interfaces-path
285 (lambda* (#:key inputs #:allow-other-keys)
286 (substitute* "CMakeLists.txt"
287 (("\\$\\{CMAKE_INSTALL_PREFIX\\}(/share/dbus-1/interfaces)" _ dbus-interfaces-path-suffix)
288 (string-append (assoc-ref inputs "libring")
289 dbus-interfaces-path-suffix))))))))
290 (synopsis "Distributed multimedia communications platform")
291 (description "Jami (formerly GNU Ring) is a secure and distributed voice,
292 video and chat communication platform that requires no centralized server and
293 leaves the power of privacy in the hands of the user. It supports the SIP and
294 IAX protocols, as well as decentralized calling using P2P-DHT.
295
296 This package provides a library common to all Jami clients.")
297 (home-page "https://jami.net")
298 (license license:gpl3+)))
299
300 (define-public jami
301 (package
302 (inherit libring)
303 (name "jami")
304 (build-system cmake-build-system)
305 (inputs
306 `(("libringclient" ,libringclient)
307 ("gtk+" ,gtk+)
308 ("qrencode" ,qrencode)
309 ("libnotify" ,libnotify)
310 ("clutter" ,clutter)
311 ("clutter-gtk" ,clutter-gtk)
312 ("libcanberra" ,libcanberra)
313 ("webkitgtk" ,webkitgtk)
314 ;; TODO: We must wrap ring-client-gnome to force using the
315 ;; `sqlite-with-column-metadata' package instead of `sqlite' or else it
316 ;; fails with:
317 ;;
318 ;; /gnu/store/...-qtbase-5.11.2/lib/qt5/plugins/sqldrivers/libqsqlite.so:
319 ;; undefined symbol: sqlite3_column_table_name16
320 ;;
321 ;; qtbase is built against sqlite-with-column-metadata but somehow
322 ;; jami-client-gnome ends up with both `sqlite' and
323 ;; `sqlite-with-column-metadata' as inputs and it seems that
324 ;; libqsqlite.so gets confused.
325 ("sqlite" ,sqlite-with-column-metadata)))
326 (native-inputs
327 `(("pkg-config" ,pkg-config)
328 ("gettext" ,gettext-minimal)
329 ("glib:bin" ,glib "bin")
330 ("doxygen" ,doxygen)))
331 (propagated-inputs
332 `(("libring" ,libring) ; Contains `dring', the daemon, which is automatically by d-bus.
333 ("adwaita-icon-theme" ,adwaita-icon-theme)
334 ("evolution-data-server" ,evolution-data-server)))
335 (arguments
336 `(#:tests? #f ; There is no testsuite.
337 #:phases
338 (modify-phases %standard-phases
339 (add-after 'unpack 'change-directory
340 (lambda _
341 (chdir "client-gnome")
342 #t))
343 (add-after 'install 'wrap
344 (lambda* (#:key inputs outputs #:allow-other-keys)
345 (let* ((out (assoc-ref outputs "out"))
346 (path (string-append (assoc-ref inputs "sqlite") "/lib")))
347 (wrap-program (string-append out "/bin/jami-gnome")
348 `("LD_LIBRARY_PATH" ":" prefix (,path))))
349 #t)))))
350 (synopsis "Distributed, privacy-respecting communication program")
351 (description "Jami (formerly GNU Ring) is a secure and distributed voice,
352 video and chat communication platform that requires no centralized server and
353 leaves the power of privacy in the hands of the user. It supports the SIP and
354 IAX protocols, as well as decentralized calling using P2P-DHT.
355
356 This package provides the Jami client for the GNOME desktop.")
357 (home-page "https://jami.net")
358 (license license:gpl3+)))
359
360 (define-public jami-client-gnome
361 (deprecated-package "jami-client-gnome" jami))