gnu: ortp: Update to 4.4.34.
[jackhill/guix/guix.git] / gnu / packages / linphone.scm
index fb9a6fd..3707482 100644 (file)
@@ -1,7 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;;
-;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
-;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020, 2021 Raghav Gururajan <raghavgururajan@disroot.org>
+;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@
   #:use-module (gnu packages audio)
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crypto)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
@@ -34,6 +36,8 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system qt)
+  #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu))
 
 (define-public bcunit
-  (package
-    (name "bcunit")
-    (version "3.0.2")
-    (source
-     (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
-       (sha256
-        (base32 "0ylchj8w98ic2fkqpxc6yk4s6s0h0ql2zsz5n49jd7126m4h8dqk"))))
-    (build-system cmake-build-system)
-    (arguments
-     '(#:tests? #f                      ; No test target
-       #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO")))         ; Not required
-    (synopsis "Belledonne Communications Unit Testing Framework")
-    (description "BCUnit is a fork of the defunct project CUnit,
-with several fixes and patches applied.  It is an unit testing
-framework for writing, administering, and running unit tests in C.")
-    (home-page "https://gitlab.linphone.org/BC/public/bcunit")
-    (license license:lgpl2.0+)))
+  (let ((commit "74021cc7cb20a4e177748dd2948173e1f9c270ae")
+        (revision "0"))
+    (package
+      (name "bcunit")
+      (version (git-version "3.0.2" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "git://git.linphone.org/bcunit")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0npdwvanjkfg9vrqs5yi8vh6wliv50ycdli8pzavir84nb31nq1b"))))
+      (build-system cmake-build-system)
+      (outputs '("out" "doc"))
+      (arguments
+       `(#:configure-flags (list "-DENABLE_STATIC=NO"
+                                 "-DENABLE_CURSES=ON"
+                                 "-DENABLE_DOC=ON"
+                                 "-DENABLE_EXAMPLES=ON"
+                                 "-DENABLE_TEST=ON"
+                                 "-DENABLE_MEMTRACE=ON")
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-source
+             (lambda _
+               ;; Include BCunit headers for examples.
+               (substitute* "Examples/CMakeLists.txt"
+                 (("\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}")
+                  (string-append "${CMAKE_CURRENT_SOURCE_DIR} "
+                                 "${PROJECT_SOURCE_DIR}/BCUnit/Headers "
+                                 "${CMAKE_BINARY_DIR}/BCUnit/Headers")))
+               ;; Link bcunit and bcunit_tests libraries.
+               (substitute* "BCUnit/Sources/CMakeLists.txt"
+                 (("target_include_directories\\(bcunit_test PUBLIC Test\\)")
+                  (string-append
+                   "target_include_directories(bcunit_test PUBLIC Test)\n"
+                   "target_link_libraries(bcunit_test bcunit)")))))
+           (replace 'check
+             (lambda _
+               (with-directory-excursion "BCUnit/Sources/Test"
+                 (invoke "./test_bcunit"))))
+           (add-after 'install 'move-doc
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out"))
+                     (doc (assoc-ref outputs "doc")))
+                 (for-each mkdir-p
+                           `(,(string-append doc "/share/doc")
+                             ,(string-append doc "/share/BCUnit")))
+                 (rename-file
+                  (string-append out "/share/doc/BCUnit")
+                  (string-append doc "/share/doc/BCUnit"))
+                 (rename-file
+                  (string-append out "/share/BCUnit/Examples")
+                  (string-append doc "/share/BCUnit/Examples"))))))))
+      (inputs
+       `(("ncurses" ,ncurses)))
+      (synopsis "Belledonne Communications Unit Testing Framework")
+      (description "BCUnit is a fork of the defunct project CUnit, with
+several fixes and patches applied.  It is a unit testing framework for
+writing, administering, and running unit tests in C.")
+      (home-page "https://gitlab.linphone.org/BC/public/bcunit")
+      (license license:lgpl2.0+))))
 
 (define-public bctoolbox
   (package
     (name "bctoolbox")
-    (version "0.6.0")
+    (version "4.4.34")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.linphone.org/BC/public/bctoolbox.git")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "1a1i70pb4hhnykkwyhhc7fv67q556l8kprny8xzgfqpj1nby2ms6"))))
+        (base32 "0bfswwvvdshaahg4jd2j10f0sci8809s4khajd0m6b059zwc7y25"))))
     (build-system cmake-build-system)
+    (outputs '("out" "debug"))
     (arguments
-     '(#:tests? #f                      ; No test target
-       #:configure-flags
-       (list
-        "-DENABLE_STATIC=OFF")))        ; Not required
+     `(#:configure-flags '("-DENABLE_STATIC=OFF")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-cmake
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Fix decaf dependency (see:
+             ;; https://gitlab.linphone.org/BC/public/bctoolbox/-/issues/3).
+             (let* ((decaf (assoc-ref inputs "decaf")))
+               (substitute* (find-files "." "CMakeLists.txt")
+                 (("find_package\\(Decaf CONFIG\\)")
+                  "set(DECAF_FOUND 1)")
+                 (("\\$\\{DECAF_INCLUDE_DIRS\\}")
+                  (string-append decaf "/include/decaf"))
+                 (("\\$\\{DECAF_TARGETNAME\\}")
+                  "decaf")))))
+         (add-after 'unpack 'skip-problematic-tests
+           (lambda _
+             ;; The following test relies on networking; disable it.
+             (substitute* "tester/port.c"
+               (("[ \t]*TEST_NO_TAG.*bctbx_addrinfo_sort_test\\)")
+                ""))))
+         (add-after 'unpack 'fix-installed-resource-directory-detection
+           (lambda _
+             ;; There's some broken logic in tester.c that checks if CWD, or
+             ;; if its parent exist, and if so, sets the prefix where the test
+             ;; resources are looked up to; disable it (see:
+             ;; https://gitlab.linphone.org/BC/public/bctoolbox/-/issues/4).
+             (substitute* "src/tester.c"
+               (("if \\(file_exists\\(\".\"\\)\\)")
+                "if (NULL)")
+               (("if \\(file_exists\\(\"..\"\\)\\)")
+                "if (NULL)"))))
+         (replace 'check
+           (lambda _
+             (with-directory-excursion "tester"
+               (invoke "./bctoolbox_tester")))))))
     (inputs
      `(("bcunit" ,bcunit)
+       ("decaf" ,libdecaf)
        ("mbedtls" ,mbedtls-apache)))
     (synopsis "Belledonne Communications Tool Box")
     (description "BcToolBox is an utilities library used by Belledonne
-Communications softwares like belle-sip, mediastreamer2 and linphone.")
+Communications software like belle-sip, mediastreamer2 and linphone.")
     (home-page "https://gitlab.linphone.org/BC/public/bctoolbox")
-    (license license:gpl2+)))
+    (license license:gpl3+)))
 
 (define-public belr
   (package
     (name "belr")
-    (version "0.1.3")
+    (version "4.4.34")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.linphone.org/BC/public/belr.git")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "1fwv2cg3qy9vdc7dimcda7nqcqc1h2cdd7ikhk7ng7q4ys8m96c1"))))
+        (base32 "0w2canwwm0qb99whnangvaybvjzq8xg6vksqxykgr8fbx7clw03h"))))
     (build-system cmake-build-system)
+    (outputs '("out" "debug" "tester"))
     (arguments
-     `(#:tests? #f                      ; No test target
-       #:configure-flags
-       (list
-        "-DENABLE_STATIC=OFF")))        ; Not required
+     `(#:configure-flags '("-DENABLE_STATIC=OFF")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'check)                ;moved after the install phase
+         (add-after 'install 'check
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((tester (assoc-ref outputs "tester"))
+                    (belr_tester (string-append tester "/bin/belr_tester"))
+                    (tester-share (string-append tester "/share/belr_tester")))
+               (invoke belr_tester))))
+         (add-after 'install 'move-tester
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (tester (assoc-ref outputs "tester")))
+               (for-each mkdir-p
+                         (list (string-append tester "/bin")
+                               (string-append tester "/share")))
+               (rename-file
+                (string-append out "/bin/belr_tester")
+                (string-append tester "/bin/belr_tester"))
+               (rename-file
+                (string-append out "/share/belr-tester")
+                ;; The detect_res_prefix procedure in bctoolbox's tester.c
+                ;; resolves the resource path based on the executable path and
+                ;; name, so have it match.
+                (string-append tester "/share/belr_tester"))))))))
     (inputs
      `(("bctoolbox" ,bctoolbox)))
     (synopsis "Belledonne Communications Language Recognition Library")
-    (description "Belr is Belledonne Communications' language recognition library,
-written in C++11.  It parses text inputs formatted according to a language
-defined by an ABNF grammar, such as the protocols standardized at IETF.")
+    (description "Belr is Belledonne Communications' language recognition
+library, written in C++11.  It parses text inputs formatted according to a
+language defined by an ABNF grammar, such as the protocols standardized at
+IETF.")
     (home-page "https://gitlab.linphone.org/BC/public/belr")
     (license license:gpl3+)))
 
 (define-public belcard
   (package
     (name "belcard")
-    (version "1.0.2")
+    (version "4.4.34")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.linphone.org/BC/public/belcard.git")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "0iiyrll1shnbb0561pkvdqcmx9b2cdr76xpsbaqdirc3s4xzcl0k"))))
+        (base32 "16x2xp8d0a115132zhy1kpxkyj86ia7vrsnpjdg78fnbvmvysc8m"))))
     (build-system cmake-build-system)
+    (outputs '("out" "debug" "tester"))
     (arguments
-     `(#:tests? #f                      ; No test target
-       #:configure-flags
-       (list
-        "-DENABLE_STATIC=OFF")))        ; Not required
+     `(#:tests? #t
+       #:configure-flags '("-DENABLE_STATIC=OFF")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-vcard-grammar-location
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (vcard-grammar
+                     (string-append out "/share/belr/grammars/vcard_grammar")))
+               (substitute* "include/belcard/vcard_grammar.hpp"
+                 (("define VCARD_GRAMMAR \"vcard_grammar\"")
+                  (format #f "define VCARD_GRAMMAR ~s" vcard-grammar))))))
+         (add-after 'install 'install-tester
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (tester (assoc-ref outputs "tester"))
+                   (test-name (string-append ,name "_tester")))
+               (for-each mkdir-p
+                         (list (string-append tester "/bin")
+                               (string-append tester "/share")))
+               (rename-file (string-append out "/bin/" test-name)
+                            (string-append tester "/bin/" test-name))
+               (rename-file (string-append out "/share/" test-name)
+                            (string-append tester "/share/" test-name)))))
+         (delete 'check)
+         (add-after 'install-tester 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (let* ((tester (assoc-ref outputs "tester"))
+                      (belcard_tester (string-append tester
+                                                     "/bin/belcard_tester")))
+                 (invoke belcard_tester))))))))
     (inputs
      `(("bctoolbox" ,bctoolbox)
        ("belr" ,belr)))
     (synopsis "Belledonne Communications VCard Library")
-    (description "Belcard is a C++ library to manipulate VCard standard format.")
+    (description "Belcard is a C++ library to manipulate VCard standard
+format.")
     (home-page "https://gitlab.linphone.org/BC/public/belcard")
     (license license:gpl3+)))
 
@@ -164,77 +302,139 @@ defined by an ABNF grammar, such as the protocols standardized at IETF.")
     (version "0.23")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.linphone.org/BC/public/bcmatroska2.git")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "1a0vlk4fhh189pfzrwbc3xbc5vyx6cnxy642d1h40045jz9y4h15"))))
+        (base32 "1avl9w18kh4dxm3g8j0bkw39bksd7bz3nfxvyibqqnz63ds8vfi2"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:tests? #f                      ; No test target
-       #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO")))         ; Not required
+     `(#:tests? #f                                     ; No test target
+       #:configure-flags (list "-DENABLE_STATIC=NO"))) ; Not required
     (synopsis "Belledonne Communications Media Container")
-    (description "BcMatroska is a free and open standard multi-media
-container format.  It can hold an unlimited number of video, audio,
-picture, or subtitle tracks in one file. ")
+    (description "BcMatroska is a free and open standard multi-media container
+format.  It can hold an unlimited number of video, audio, picture, or subtitle
+tracks in one file.  This project provides a convenient distribution of the
+Matroska multimedia container format.")
     (home-page "https://gitlab.linphone.org/BC/public/bcmatroska2")
-    (license
-     (list
-      ;; That license applies for Core C and LibEBML2.
-      ;; https://www.matroska.org/node/47
-      license:bsd-4
-      ;; That license applies for LibMatroska2.
-      ;; https://www.matroska.org/node/47
-      license:lgpl2.1+))))
+    (license (list license:gpl2+        ;for this package (build system files)
+                   license:bsd-4        ;for Core C and LibEBML2
+                   license:lgpl2.1+)))) ;for LibMatroska2
 
 (define-public bcg729
   (package
     (name "bcg729")
-    (version "1.0.4")
+    (version "1.1.1")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "git://git.linphone.org/bcg729")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "01y34ky7ykjgfnf8a9f59hg61fqfjiprfrzshdz06w0lz4gvy3qs"))))
+        (base32 "1hal6b3w6f8y5r1wa0xzj8sj2jjndypaxyw62q50p63garp2h739"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:tests? #f                      ; No test target
-       #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO")))         ; Not required
+     `(#:configure-flags (list "-DENABLE_STATIC=NO"
+                               "-DENABLE_TESTS=YES")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'copy-inputs
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((test-patterns (assoc-ref inputs "test-patterns"))
+                   (dest (string-append "test/bcg729-patterns.zip")))
+               (copy-recursively test-patterns dest))))
+         (replace 'check
+           (lambda _
+             (with-directory-excursion "test"
+               (invoke "unzip" "bcg729-patterns.zip")
+               (for-each
+                (lambda (test-name)
+                  (invoke "./testCampaign" "-s" test-name))
+                (list "fixedCodebookSearch"
+                      "postProcessing"
+                      "adaptativeCodebookSearch"
+                      "computeLP"
+                      "computeAdaptativeCodebookGain"
+                      "postFilter"
+                      "decoder"
+                      "LPSynthesisFilter"
+                      "decodeLSP"
+                      ;; "encoder"
+                      ;; "LSPQuantization"
+                      "preProcessing"
+                      "decodeFixedCodeVector"
+                      "CNGdecoder"
+                      ;; "LP2LSPConversion"
+                      "gainQuantization"
+                      "findOpenLoopPitchDelay"
+                      "decodeGains"
+                      "computeWeightedSpeech"
+                      "interpolateqLSPAndConvert2LP"
+                      "decodeAdaptativeCodeVector"))))))))
+    (native-inputs
+     `(("perl" ,perl)
+       ("test-patterns"
+        ,(origin
+           (method url-fetch)
+           (uri (string-append "http://www.belledonne-communications.com/"
+                               "bc-downloads/bcg729-patterns.zip"))
+           (sha256
+            (base32 "1kivarhh3izrl9sg0szs6x6pbq2ap0y6xsraw0gbgspi4gnfihrh"))))
+       ("unzip" ,unzip)))
     (synopsis "Belledonne Communications G729 Codec")
     (description "BcG729 is an implementation of both encoder and decoder of
 the ITU G729 speech codec.  The library written in C 99 is fully portable and
 can be executed on many platforms including both ARM and x86 processors.  It
 supports concurrent channels encoding and decoding for multi call application
 such as conferencing.")
-    (home-page "https://gitlab.linphone.org/BC/public/belcard")
-    (license license:gpl2+)))
+    (home-page "https://linphone.org/technical-corner/bcg729")
+    (license license:gpl3+)))
 
 (define-public ortp
   (package
     (name "ortp")
-    (version "1.0.2")
+    (version "4.4.34")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.linphone.org/BC/public/ortp.git")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "016qg0lmdgmqh2kv19w9qhi4kkiyi5h1xp35g2s65b1j8ccm25d5"))))
+        (base32 "1r1kvjzyfvkf66in4p51wi87balzg3sw3aq6r4xr609mz86spi5m"))))
     (build-system cmake-build-system)
+    (outputs '("out""tester"
+               "doc"))                  ;1.5 MiB of HTML doc
     (arguments
-     `(#:tests? #f                      ; No test target
-       #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO")))         ; Not required
+     `(#:tests? #f                      ;requires networking
+       #:configure-flags (list "-DENABLE_STATIC=NO"
+                               "-DENABLE_TESTS=YES")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-version-strings
+           (lambda _
+             (substitute* "CMakeLists.txt"
+               (("VERSION 4.4.0")
+                (string-append "VERSION " ,version))
+               (("\\$\\{ORTP_DOC_VERSION\\}")
+                ,version))))
+         (add-after 'install 'separate-outputs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc"))
+                    (doc-src (string-append out "/share/doc/ortp-" ,version))
+                    (doc-dest (string-append doc "/share/doc/ortp-" ,version))
+                    (tester (assoc-ref outputs "tester")))
+               (for-each mkdir-p (list (string-append doc "/share/doc")
+                                       (string-append tester "/bin")))
+               (rename-file doc-src doc-dest)
+               (rename-file (string-append out "/bin")
+                            (string-append tester "/bin"))))))))
     (native-inputs
      `(("dot" ,graphviz)
        ("doxygen" ,doxygen)))
@@ -243,37 +443,38 @@ such as conferencing.")
     (synopsis "Belledonne Communications RTP Library")
     (description "oRTP is a C library implementing the RTP protocol.  It
 implements the RFC 3550 standard.")
-    (home-page "https://gitlab.linphone.org/BC/public/ortp")
-    (license license:gpl2+)))
+    (home-page "https://linphone.org/technical-corner/ortp")
+    (license license:gpl3+)))
 
 (define-public bzrtp
   (package
     (name "bzrtp")
-    (version "1.0.6")
+    (version "4.4.34")
     (source
      (origin
-       (method url-fetch)
-       (uri
-        (string-append "https://www.linphone.org/releases/sources/" name
-                       "/" name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.linphone.org/BC/public/bzrtp")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "12y0kkh90pixaaxfyx26ca2brhy6nw57fsypp6vh8jk1illv0j5z"))))
+        (base32 "1yjmsbqmymzl4r7sba6w4a2yld8m6hzafr6jf7sj0syhwpnc3zv6"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:tests? #f                      ; No test target
-       #:configure-flags
+     `(#:configure-flags
        (list
-        "-DENABLE_STATIC=NO")))
+        "-DENABLE_STATIC=NO"
+        "-DENABLE_TESTS=YES")))
     (inputs
      `(("bctoolbox" ,bctoolbox)
        ("sqlite3" ,sqlite)
        ("xml2" ,libxml2)))
     (synopsis "Belledonne Communications ZRTP Library")
-    (description "BZRTP is an implementation of ZRTP keys exchange
-protocol, written in C.  It is fully portable and can be executed on many
-platforms including both ARM and x86.")
+    (description "BZRTP is an implementation of ZRTP keys exchange protocol,
+written in C.  It is fully portable and can be executed on many platforms
+including both ARM and x86.")
     (home-page "https://gitlab.linphone.org/BC/public/bzrtp")
-    (license license:gpl2+)))
+    (license license:gpl3+)))
 
 (define-public belle-sip
   (package
@@ -291,16 +492,15 @@ platforms including both ARM and x86.")
     (arguments
      `(#:tests? #f                      ; Requires network access
        #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO")
+       (list "-DENABLE_STATIC=NO")      ; Not required
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch
            (lambda _
              (substitute* "src/CMakeLists.txt"
-              ;; ANTLR would use multithreaded DFA generation
-              ;; otherwise--which would not be reproducible.
-              (("-Xmultithreaded ") ""))
+               ;; ANTLR would use multithreaded DFA generation otherwise,
+               ;; which would not be reproducible.
+               (("-Xmultithreaded ") ""))
              #t)))))
     (inputs
      `(("antlr3" ,antlr3-3.3)
@@ -333,12 +533,11 @@ API.  It also comprises a simple HTTP/HTTPS client implementation.")
     (arguments
      `(#:tests? #f                      ; No test target
        #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO"            ; Not required
-        "-DENABLE_STRICT=NO"            ; Would otherwise treat warnings as err
-        "-DENABLE_BV16=NO"              ; Not available
-        "-DCMAKE_C_FLAGS=-DMS2_GIT_VERSION=\\\"unknown\\\""
-        "-DCMAKE_CXX_FLAGS=-DMS2_GIT_VERSION=\\\"unknown\\\"")
+       (list "-DENABLE_STATIC=NO"      ; Not required
+             "-DENABLE_STRICT=NO"      ; Would otherwise treat warnings as err
+             "-DENABLE_BV16=NO"        ; Not available
+             "-DCMAKE_C_FLAGS=-DMS2_GIT_VERSION=\\\"unknown\\\""
+             "-DCMAKE_CXX_FLAGS=-DMS2_GIT_VERSION=\\\"unknown\\\"")
        #:phases
        (modify-phases %standard-phases
          (add-after 'install 'separate-outputs
@@ -395,13 +594,12 @@ API.  It also comprises a simple HTTP/HTTPS client implementation.")
        ("vpx" ,libvpx)
        ("x11" ,libx11)
        ("xv" ,libxv)
-       ("zrtp"bzrtp)))
+       ("zrtp" ,bzrtp)))
     (synopsis "Belledonne Communications Streaming Engine")
-    (description "Mediastreamer2 is a powerful and lightweight
-streaming engine for telephony applications.  This media processing
-and streaming toolkit is responsible for receiving and sending all
-multimedia streams in Linphone, including media capture, encoding and
-decoding, and rendering.")
+    (description "Mediastreamer2 is a powerful and lightweight streaming engine
+for telephony applications.  This media processing and streaming toolkit is
+responsible for receiving and sending all multimedia streams in Linphone,
+including media capture, encoding and decoding, and rendering.")
     (home-page "https://gitlab.linphone.org/BC/public/mediastreamer2")
     (license license:gpl2+)))
 
@@ -417,20 +615,25 @@ decoding, and rendering.")
                        "/linphone-" version ".tar.gz"))
        (sha256
         (base32 "0phhkx55xdyg28d4wn8l8q4yvsmdgzmjiw584d4s190sq1azm91x"))))
+    (outputs '("out" "doc" "tester"))
     (build-system cmake-build-system)
     (arguments
      `(#:tests? #f                      ; No test target
        #:configure-flags
-       (list
-        (string-append "-DGTK2_GDKCONFIG_INCLUDE_DIR="
-                       (string-append (assoc-ref %build-inputs "gtk2")
-                                      "/lib/gtk-2.0/include"))
-        (string-append "-DGTK2_GLIBCONFIG_INCLUDE_DIR="
-                       (string-append (assoc-ref %build-inputs "glib")
-                                      "/lib/glib-2.0/include"))
-        "-DENABLE_STATIC=NO"            ; Not required
-        "-DENABLE_STRICT=NO"
-        "-DENABLE_GTK_UI=YES")          ; for legacy UI
+       (list (string-append "-DGTK2_GDKCONFIG_INCLUDE_DIR="
+                            (string-append (assoc-ref %build-inputs "gtk2")
+                                           "/lib/gtk-2.0/include"))
+             (string-append "-DGTK2_GLIBCONFIG_INCLUDE_DIR="
+                            (string-append (assoc-ref %build-inputs "glib")
+                                           "/lib/glib-2.0/include"))
+             "-DENABLE_STATIC=NO"       ; Not required
+             "-DENABLE_STRICT=NO"
+             "-DENABLE_GTK_UI=YES")     ; for legacy UI
+       #:imported-modules (,@%cmake-build-system-modules
+                           (guix build glib-or-gtk-build-system))
+       #:modules ((guix build cmake-build-system)
+                  ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
+                  (guix build utils))
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch
@@ -438,31 +641,63 @@ decoding, and rendering.")
              (substitute* "gtk/main.c"
                (("#include \"liblinphone_gitversion.h\"")
                 ""))
-             #t)))))
+             #t))
+         (add-after 'install 'separate-outputs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc"))
+                    (tester (assoc-ref outputs "tester"))
+                    (tester-name (string-append ,name "_tester")))
+               ;; Copy the tester executable.
+               (mkdir-p (string-append tester "/bin"))
+               (rename-file (string-append out "/bin/" tester-name)
+                            (string-append tester "/bin/" tester-name))
+               ;; Copy the tester data files.
+               (mkdir-p (string-append tester "/share/"))
+               (rename-file (string-append out "/share/" tester-name)
+                            (string-append tester "/share/" tester-name))
+               ;; Copy the HTML and XML documentation.
+               (copy-recursively
+                (string-append out "/share/doc/linphone-" ,version)
+                (string-append doc "/share/doc/" ,name "-" ,version))
+               (delete-file-recursively
+                (string-append out "/share/doc/linphone-" ,version))
+               #t)))
+         (add-after 'install 'install-man-pages
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man (string-append out "/share/man/man1")))
+               (for-each (lambda (file)
+                           (install-file file man))
+                         (find-files ".." ".*.1$"))
+               #t)))
+         (add-after 'separate-outputs 'glib-or-gtk-compile-schemas
+           (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
+         (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
+           (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
     (native-inputs
-     `(("dot" ,graphviz)
+     `(("gettext" ,gettext-minimal)
+       ("udev" ,eudev)                  ;for libudev.h
+       ;; For generating the C++ wrappers.
+       ("dot" ,graphviz)
        ("doxygen" ,doxygen)
-       ("gettext" ,gettext-minimal)
-       ("iconv" ,libiconv)
        ("python" ,python)
-       ("xml2" ,libxml2)
-       ("zlib" ,zlib)))
+       ("pystache" ,python-pystache)
+       ("six" ,python-six)))
     (inputs
      `(("bctoolbox" ,bctoolbox)
        ("belcard" ,belcard)
        ("bellesip" ,belle-sip)
-       ("bzrtp", bzrtp)
+       ("bzrtp" ,bzrtp)
+       ("iconv" ,libiconv)
        ("glib" ,glib)
        ("gtk2" ,gtk+-2)
        ("mediastreamer2" ,mediastreamer2)
        ("notify" ,libnotify)
        ("ortp" ,ortp)
-       ("pystache" ,python-pystache)
-       ("six" ,python-six)
        ("sqlite" ,sqlite)
-       ("udev" ,eudev)))
-    (propagated-inputs
-     `(("murrine" ,murrine)))           ; Required for GTK UI
+       ("xml2" ,libxml2)
+       ("zlib" ,zlib)))
     (synopsis "Belledonne Communications Softphone Library")
     (description "Liblinphone is a high-level SIP library integrating
 all calling and instant messaging features into an unified
@@ -483,19 +718,36 @@ and video calls or instant messaging capabilities to an application.")
         (string-append "https://www.linphone.org/releases/sources/" name
                        "/" name "-" version ".tar.gz"))
        (sha256
-        (base32 "1g2zrr9li0g1hgs6vys06vr98h5dx36z22hx7a6ry231536c002a"))))
+        (base32 "1g2zrr9li0g1hgs6vys06vr98h5dx36z22hx7a6ry231536c002a"))
+       (patches (search-patches "linphoneqt-tabbutton.patch"))))
     (build-system qt-build-system)
     (arguments
      `(#:tests? #f                      ; No test target
        #:phases
-       ;; For replacing undeclared variable.
        (modify-phases %standard-phases
-         (add-after 'unpack 'patch
+         (add-after 'unpack 'fix-cmake-error
+           (lambda _
+             ;; This is fixed in commit efed2fd8 of the master branch.
+             (substitute* "CMakeLists.txt"
+               (("js)\\$\"")
+                "js$\""))
+             #t))
+         (add-after 'unpack 'set-version-string
            (lambda _
              (substitute* "src/app/AppController.cpp"
                (("LINPHONE_QT_GIT_VERSION")
-                "\"4.1.1\""))
-             #t)))))
+                (format #f "~s" ,version)))
+             #t))
+         (add-after 'install 'extend-shared-resources
+           ;; Not using the FHS exposes an issue where the client refers to
+           ;; its own "share" directory, which lacks sound files installed by
+           ;; liblinphone.
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((liblinphone (assoc-ref inputs "linphone"))
+                    (out (assoc-ref outputs "out")))
+               (symlink (string-append liblinphone "/share/sounds")
+                        (string-append out "/share/sounds"))
+               #t))))))
     (native-inputs
      `(("qttools" ,qttools)))
     (inputs
@@ -507,12 +759,27 @@ and video calls or instant messaging capabilities to an application.")
        ("qtbase" ,qtbase)
        ("qtdeclarative" ,qtdeclarative)
        ("qtgraphicaleffects" ,qtgraphicaleffects)
+       ("qtquickcontrols" ,qtquickcontrols)
        ("qtquickcontrols2" ,qtquickcontrols2)
        ("qtsvg" ,qtsvg)))
-    (synopsis "Belledonne Communications Softphone Application")
-    (description "Linphone is a softphone for voice and video over IP calling
-and instant messaging.  It is fully SIP-based, for all calling, presence
-and IM features.")
+    (synopsis "Desktop client for the Linphone SIP softphone")
+    (description "Linphone is a SIP softphone for voice and video over IP calling
+(VoIP) and instant messaging.  Amongst its features are:
+@itemize
+@item High Definition (HD) audio and video calls
+@item Multiple call management (pause and resume)
+@item Call transfer
+@item Audio conferencing (merge calls into a conference call)
+@item Call recording and replay (audio only)
+@item Instant Messaging with message delivery status (IMDN)
+@item Picture and file sharing
+@item Echo cancellation
+@item Secure user authentication using TLS client certificates
+@item SRTP, zRTP and SRTP-DTLS voice and video encryption
+@item Telephone tone (DTMF) support using SIP INFO or RFC 4733
+@item Audio codecs: opus, speex, g711, g729, gsm, iLBC, g722, SILK, etc.
+@item Video codecs: VP8, H.264 and H.265 with resolutions up to 1080P, MPEG4
+@end itemize")
     (home-page "https://gitlab.linphone.org/BC/public/linphone-desktop")
     (license license:gpl2+)))
 
@@ -534,17 +801,18 @@ and IM features.")
          (origin
            (method url-fetch)
            (uri
-            (string-append "https://gitlab.linphone.org/BC/public/msopenh264/commit/"
-                           "493d147d28c9a0f788ba4e50b47a1ce7b18bf326.diff"))
+            (string-append "https://gitlab.linphone.org/BC/public/msopenh264/"
+                           "commit/493d147d28c9a0f788ba4e50b47a1ce7b18bf326"
+                           ".diff"))
            (file-name "msopenh264-openh264.patch")
            (sha256
-            (base32 "0mmd7nz5n9ian4rcwn200nldmy5j0dpdrna7r32rqnaw82bx3kdb")))))))
+            (base32
+             "0mmd7nz5n9ian4rcwn200nldmy5j0dpdrna7r32rqnaw82bx3kdb")))))))
     (build-system cmake-build-system)
     (arguments
      `(#:tests? #f                      ; No test target
        #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO")))         ; Not required
+       (list "-DENABLE_STATIC=NO")))    ; Not required
     (inputs
      `(("mediastreamer2" ,mediastreamer2)
        ("openh264" ,openh264)
@@ -571,14 +839,13 @@ mediastreamer2 based on the openh264 library.")
     (arguments
      `(#:tests? #f                      ; No test target
        #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO")))         ; Not required
+       (list "-DENABLE_STATIC=NO")))    ; Not required
     (inputs
      `(("mediastreamer2" ,mediastreamer2)
        ("ortp" ,ortp)))
     (synopsis "Media Streamer SILK Codec")
-    (description "MSSILK is a plugin of MediaStreamer, adding support for
-AMR codec.  It is based on the Skype's SILK implementation.")
+    (description "MSSILK is a plugin of MediaStreamer, adding support for AMR
+codec.  It is based on the Skype's SILK implementation.")
     (home-page "https://gitlab.linphone.org/BC/public/mssilk")
     (license license:gpl2+)))
 
@@ -599,7 +866,7 @@ AMR codec.  It is based on the Skype's SILK implementation.")
      `(#:tests? #f                      ; No test target
        #:configure-flags
        (list
-        "-DENABLE_STATIC=NO")))
+        "-DENABLE_STATIC=NO")))         ; Not required
     (inputs
      `(("bctoolbox" ,bctoolbox)
        ("mediastreamer2" ,mediastreamer2)
@@ -626,16 +893,15 @@ WebRTC codec.  It includes features from WebRTC, such as, iSAC and AECM.")
     (arguments
      `(#:tests? #f                      ; No test target
        #:configure-flags
-       (list
-        "-DENABLE_STATIC=NO"            ; Not required
-        "-DENABLE_WIDEBAND=YES")))
+       (list "-DENABLE_STATIC=NO"       ; Not required
+             "-DENABLE_WIDEBAND=YES")))
     (inputs
      `(("mediastreamer2" ,mediastreamer2)
        ("opencoreamr" ,opencore-amr)
        ("ortp" ,ortp)
        ("voamrwbenc" ,vo-amrwbenc)))
     (synopsis "Media Streamer AMR Codec")
-    (description "MSAMR is a plugin of MediaStreamer, adding support for
-AMR codec.  It is based on the opencore-amr implementation.")
+    (description "MSAMR is a plugin of MediaStreamer, adding support for AMR
+codec.  It is based on the opencore-amr implementation.")
     (home-page "https://gitlab.linphone.org/BC/public/msamr")
     (license license:gpl3+)))