Subject: [PATCH gnome-team v5 6/6] gnu: Add calls.

From: Vivien Kraus <[email-masked]>
Date: Tue, 31 Oct 2023 20:35:04 +0100

* gnu/packages/gnome.scm (libcallaudio): New variable.
* gnu/packages/patches/calls-disable-application-test.patch: New file.
* gnu/packages/patches/calls-disable-sip-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register them here.

Change-Id: I6f0485e4c73536c576713005cf7cd74610923a21
---
 gnu/local.mk                                  |  2 +
 gnu/packages/gnome.scm                        | 65 ++++++++++++++++-
 .../calls-disable-application-test.patch      | 72 +++++++++++++++++++
 .../patches/calls-disable-sip-test.patch      | 44 ++++++++++++
 4 files changed, 182 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/calls-disable-application-test.patch
 create mode 100644 gnu/packages/patches/calls-disable-sip-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 050cb71ef9..27ff79f0f6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -989,6 +989,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/calibre-no-updates-dialog.patch		\
   %D%/packages/patches/calibre-remove-test-sqlite.patch		\
   %D%/packages/patches/calibre-remove-test-unrar.patch		\
+  %D%/packages/patches/calls-disable-application-test.patch	\
+  %D%/packages/patches/calls-disable-sip-test.patch		\
   %D%/packages/patches/camlboot-dynamically-allocate-stack-signal.patch	\
   %D%/packages/patches/catdoc-CVE-2017-11110.patch		\
   %D%/packages/patches/ccextractor-add-missing-header.patch	\
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 8b9c64126d..86d62c16b5 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -212,6 +212,7 @@ (define-module (gnu packages gnome)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages swig)
+  #:use-module (gnu packages telephony)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
@@ -13509,7 +13510,7 @@ (define-public libcall-ui
     (propagated-inputs ; All these in call-ui.pc.
      (list glib
            gtk+
-           (@ (gnu packages telephony) libcallaudio)
+           libcallaudio
            libhandy))
     (native-inputs
      (list `(,glib "bin") ; glib-mkenums
@@ -13520,3 +13521,65 @@ (define-public libcall-ui
 receive calls.")
     (home-page "https://gitlab.gnome.org/World/Phosh/libcall-ui")
     (license license:lgpl2.1+)))
+
+(define-public calls
+  (package
+    (name "calls")
+    (version "45.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnome/sources/" name "/"
+                                  (version-major version) "/"
+                                  name "-" version ".tar.xz"))
+              (sha256
+               (base32
+                "1mvnrm5wbl69xbcjg8nxd6l6nj2fd3whbyh70axlm75c7l7d5j5r"))
+              (patches
+               (search-patches "calls-disable-application-test.patch"
+                               "calls-disable-sip-test.patch"))))
+    (build-system meson-build-system)
+    (arguments
+     (list
+      #:glib-or-gtk? #t
+      #:configure-flags #~'("-Dgtk_doc=true")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'check 'pre-check
+            (lambda _
+              (setenv "HOME" (getcwd))
+              ;; Tests require a running X server.
+              (system "Xvfb :1 &")
+              (setenv "DISPLAY" ":1"))))))
+    (inputs
+     (list evolution-data-server
+           feedbackd
+           folks
+           glib
+           gom
+           gstreamer
+           gst-plugins-base
+           gst-plugins-good
+           gst-plugins-bad
+           gtk+
+           libcall-ui
+           libgee
+           libpeas
+           libhandy
+           modem-manager
+           sofia-sip))
+    (native-inputs
+     (list desktop-file-utils           ;update-desktop-database
+           gettext-minimal
+           `(,glib "bin")               ;glib-mkenums
+           gtk-doc                      ;gtkdoc-scan
+           `(,gtk+ "bin")               ;gtk-update-icon-cache
+           pkg-config
+           python-docutils              ;rst2man
+           vala
+           xorg-server-for-tests))
+    (home-page "https://gitlab.gnome.org/GNOME/calls")
+    (synopsis "Phone dialer and call handler")
+    (description "Calls can make and answer phone calls using different
+backends, such as ModemManager for phones and @acronym{SIP, Session Initiation
+Protocol} for @acronym{VoIP, Voice over @acronym{IP, Internet Protocol}}.")
+    (license license:gpl3+)))
diff --git a/gnu/packages/patches/calls-disable-application-test.patch b/gnu/packages/patches/calls-disable-application-test.patch
new file mode 100644
index 0000000000..f06f747487
--- /dev/null
+++ b/gnu/packages/patches/calls-disable-application-test.patch
@@ -0,0 +1,72 @@
+From e0fdae20840ffe3aeca7190eb8b1bcae70f0c93b Mon Sep 17 00:00:00 2001
+From: Vivien Kraus <[email-masked]>
+Date: Sun, 29 Oct 2023 21:03:27 +0100
+Subject: [PATCH] Disable the application test.
+
+The application test does not work in a Guix container, because an actual
+sound card is required to run this integration test.
+
+* tests/meson.build: Disable test-application.
+---
+ tests/meson.build | 38 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/tests/meson.build b/tests/meson.build
+index c9bdc3d..65f9b93 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -165,24 +165,24 @@ test('dbus', t, env: test_env)
+ 
+ dbus_run_session = find_program('dbus-run-session')
+ 
+-if dbus_run_session.found ()
+-  test_sources = [ 'test-application.c' ]
+-  t = executable('application', test_sources, calls_resources,
+-                 c_args : test_cflags,
+-                 link_args: test_link_args,
+-                 pie: true,
+-                 link_with : [calls_vala, libcalls],
+-                 dependencies: calls_deps,
+-                 include_directories : [
+-                     calls_includes,
+-                   ]
+-                 )
+-  test('application',
+-      dbus_run_session,
+-      args: t.full_path(),
+-      env: test_env,
+-      timeout : 300
+-      )
+-endif
++# if dbus_run_session.found ()
++#   test_sources = [ 'test-application.c' ]
++#   t = executable('application', test_sources, calls_resources,
++#                  c_args : test_cflags,
++#                  link_args: test_link_args,
++#                  pie: true,
++#                  link_with : [calls_vala, libcalls],
++#                  dependencies: calls_deps,
++#                  include_directories : [
++#                      calls_includes,
++#                    ]
++#                  )
++#   test('application',
++#       dbus_run_session,
++#       args: t.full_path(),
++#       env: test_env,
++#       timeout : 300
++#       )
++# endif
+ 
+ endif
+
+base-commit: 936d36287324163b958c6ea0c4297c7a607ee18c
+prerequisite-patch-id: 20f8a81da35ce1797635eb310e1f85ac5ff814f6
+prerequisite-patch-id: 96768617d0a8ee8c66faa00220a1612e0f527292
+prerequisite-patch-id: 444c1ee57c24ba4b8165497b0a5885844110c59b
+prerequisite-patch-id: 9415b848ca9ee277bccbad7c3fff23230d5016f1
+prerequisite-patch-id: 3ca2a45be430041875b21f6c8dfac0bc17916abf
+prerequisite-patch-id: e8302846f4650dba9e0072c18be3459ce903fe2e
+-- 
+2.41.0
+
diff --git a/gnu/packages/patches/calls-disable-sip-test.patch b/gnu/packages/patches/calls-disable-sip-test.patch
new file mode 100644
index 0000000000..75e9294fc0
--- /dev/null
+++ b/gnu/packages/patches/calls-disable-sip-test.patch
@@ -0,0 +1,44 @@
+From 33b75bfcda3437b12b6155addeeddcea697a4270 Mon Sep 17 00:00:00 2001
+Message-ID: <[email-masked]>
+From: Vivien Kraus <[email-masked]>
+Date: Sun, 29 Oct 2023 20:45:24 +0100
+Subject: [PATCH] Disable the direct call SIP test.
+
+* plugins/provider/tests/test-sip.c (main): Disable it.
+---
+
+This test passes in a guix shell --container --network but not in
+guix shell --container.  The most likely cause is it requires access to the
+network.
+
+ plugins/provider/tests/test-sip.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/provider/tests/test-sip.c b/plugins/provider/tests/test-sip.c
+index 185d372..4e83d40 100644
+--- a/plugins/provider/tests/test-sip.c
++++ b/plugins/provider/tests/test-sip.c
+@@ -442,8 +442,11 @@ main (int   argc,
+   g_test_add ("/Calls/SIP/origin_call_lists", SipFixture, NULL,
+               setup_sip_origins, test_sip_origin_call_lists, tear_down_sip_origins);
+ 
+-  g_test_add ("/Calls/SIP/calls_direct_call", SipFixture, NULL,
+-              setup_sip_origins, test_sip_call_direct_calls, tear_down_sip_origins);
++  /* The direct call fails in the Guix build environment, possibly
++   * because the network is more restricted. */
++
++  /* g_test_add ("/Calls/SIP/calls_direct_call", SipFixture, NULL,
++    setup_sip_origins, test_sip_call_direct_calls, tear_down_sip_origins); */
+ 
+   ret = g_test_run ();
+ 
+
+base-commit: 936d36287324163b958c6ea0c4297c7a607ee18c
+prerequisite-patch-id: 20f8a81da35ce1797635eb310e1f85ac5ff814f6
+prerequisite-patch-id: 96768617d0a8ee8c66faa00220a1612e0f527292
+prerequisite-patch-id: 444c1ee57c24ba4b8165497b0a5885844110c59b
+prerequisite-patch-id: 9415b848ca9ee277bccbad7c3fff23230d5016f1
+prerequisite-patch-id: 3ca2a45be430041875b21f6c8dfac0bc17916abf
+-- 
+2.41.0
+
-- 
2.41.0