summary refs log tree commit diff
path: root/gnu/packages/jami.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/jami.scm')
-rw-r--r--gnu/packages/jami.scm114
1 files changed, 35 insertions, 79 deletions
diff --git a/gnu/packages/jami.scm b/gnu/packages/jami.scm
index 85a06026ed..c47293b5c1 100644
--- a/gnu/packages/jami.scm
+++ b/gnu/packages/jami.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2019, 2020 Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,7 +35,6 @@
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
-  #:use-module (gnu packages hurd)
   #:use-module (gnu packages libcanberra)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages multiprecision)
@@ -65,7 +65,11 @@
 
 (define %jami-version "20200710.1.6bd18d2")
 
-(define* (jami-source #:key without-daemon)
+(define* (jami-source #:key keep-contrib-patches?)
+  "Return an origin object of the tarball release sources archive of Jami.
+When KEEP-CONTRIB-PATCHES? is #t, do not completely remove the contrib
+subdirectory, which contains patches to be applied to some of the dependencies
+of Jami."
   (origin
     (method url-fetch)
     (uri (string-append "https://dl.jami.net/release/tarballs/jami_"
@@ -73,15 +77,28 @@
                         ".tar.gz"))
     (modules '((guix build utils)))
     (snippet
-     (if without-daemon
-         '(begin
+     `(begin
+        ;; Delete over 200 MiB of bundled tarballs.  The contrib directory
+        ;; contains the custom patches for pjproject and other libraries used
+        ;; by Savoir-faire Linux.
+        (if ,keep-contrib-patches?
+            (delete-file-recursively "daemon/contrib/tarballs")
             (delete-file-recursively "daemon/contrib"))
-         #f))
+        ;; Remove code from unused Jami clients.
+        (for-each delete-file-recursively '("client-android"
+                                            "client-macosx"
+                                            "client-uwp"
+                                            "client-windows"))
+        #t))
     (sha256
      (base32
       "0lg61jv39x7kc9lq30by246xb6gcgp1rzj49ak7ff8nqpfzyfvva"))))
 
-;; Savoir-Faire Linux modifies many libraries to add features
+(define %sfl-patches (jami-source #:keep-contrib-patches? #t))
+
+(define %jami-sources (jami-source))
+
+;; Savoir-faire Linux modifies many libraries to add features
 ;; to Jami. This procedure makes applying patches to a given
 ;; package easy.
 (define jami-apply-dependency-patches
@@ -105,60 +122,15 @@
     (inherit pjproject)
     (name "pjproject-jami")
     (native-inputs
-     `(("sfl-patches" ,(jami-source))
+     `(("sfl-patches" ,%sfl-patches)
        ,@(package-native-inputs pjproject)))
     (arguments
-     `(#:tests? #f
-       ;; See ring-project/daemon/contrib/src/pjproject/rules.mak.
-       #:configure-flags
-       (list "--disable-oss"
-             "--disable-sound"
-             "--disable-video"
-             ;; The following flag is Linux specific.
-             ,@(if (hurd-triplet? (or (%current-system)
-                                      (%current-target-system)))
-                   '()
-                   '("--enable-epoll"))
-             "--enable-ext-sound"
-             "--disable-speex-aec"
-             "--disable-g711-codec"
-             "--disable-l16-codec"
-             "--disable-gsm-codec"
-             "--disable-g722-codec"
-             "--disable-g7221-codec"
-             "--disable-speex-codec"
-             "--disable-ilbc-codec"
-             "--disable-opencore-amr"
-             "--disable-silk"
-             "--disable-sdl"
-             "--disable-ffmpeg"
-             "--disable-v4l2"
-             "--disable-openh264"
-             "--disable-resample"
-             "--disable-libwebrtc"
-             "--with-gnutls"
-             "--with-external-srtp"
-             ;; We need -fPIC or else we get the following error when linking
-             ;; against pjproject-jami:
-             ;;   relocation R_X86_64_32S against `.rodata' can not be used when
-             ;;   making a shared object;
-             ;; -DNDEBUG is needed to prevent assertion from happening and
-             ;; stopping the daemon.
-             "CFLAGS=-fPIC -DNDEBUG"
-             "CXXFLAGS=-fPIC -DNDEBUG")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'make-git-checkout-writable
-           (lambda _
-             (for-each make-file-writable (find-files "."))
-             #t))
-         (add-after 'unpack 'apply-patches
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((jami-apply-dependency-patches ,jami-apply-dependency-patches))
-               ;; Comes from
-               ;; "ring-project/daemon/contrib/src/pjproject/rules.mak".
-               ;; WARNING: These amount for huge changes in pjproject.
-               (jami-apply-dependency-patches
+     (substitute-keyword-arguments (package-arguments pjproject)
+       ((#:phases phases '%standard-phases)
+        `(modify-phases ,phases
+           (add-after 'make-source-files-writable 'apply-patches
+             (lambda* (#:key inputs #:allow-other-keys)
+               (,jami-apply-dependency-patches
                 #:inputs inputs
                 #:dep-name "pjproject"
                 #:patches
@@ -171,27 +143,11 @@
                   "0007-pj_ice_sess"
                   "0008-fix_ioqueue_ipv6_sendto"
                   "0009-add-config-site"
-                  "0010-fix-pkgconfig"
+                  ;; Note: The base pjproject is already patched with
+                  ;; "0010-fix-pkgconfig".
                   "0011-fix-tcp-death-detection"
                   "0012-fix-turn-shutdown-crash"))
-               #t)))
-         ;; TODO: We could use substitute-keyword-arguments instead of
-         ;; repeating the phases from pjproject, but somehow it does
-         ;; not work.
-         (add-before 'build 'build-dep
-           (lambda _ (invoke "make" "dep")))
-         (add-before 'patch-source-shebangs 'autoconf
-           (lambda _
-             (invoke "autoconf" "-v" "-f" "-i" "-o"
-                     "aconfigure" "aconfigure.ac")))
-         (add-before 'autoconf 'disable-some-tests
-           ;; Three of the six test programs fail due to missing network
-           ;; access.
-           (lambda _
-             (substitute* "Makefile"
-               (("selftest: pjlib-test pjlib-util-test pjnath-test pjmedia-test pjsip-test pjsua-test")
-                "selftest: pjlib-test pjlib-util-test pjmedia-test"))
-             #t)))))))
+               #t))))))))
 
 ;; The following variables are configure flags used by ffmpeg-jami.  They're
 ;; from the ring-project/daemon/contrib/src/ffmpeg/rules.mak file. We try to
@@ -413,7 +369,7 @@
     (inherit ffmpeg)
     (name "ffmpeg-jami")
     (native-inputs
-     `(("sfl-patches" ,(jami-source))
+     `(("sfl-patches" ,%sfl-patches)
        ("libiconv" ,libiconv)
        ,@(package-native-inputs ffmpeg)))
     (supported-systems '("x86_64-linux" "i686-linux"
@@ -448,7 +404,7 @@
   (package
     (name "libring")
     (version %jami-version)
-    (source (jami-source #:without-daemon #t))
+    (source %jami-sources)
     (build-system gnu-build-system)
     (inputs
      `(("alsa-lib" ,alsa-lib)