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