summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-11-07 21:32:19 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-11-12 00:39:35 -0500
commit008f3a28c6ca6f689f00f11af1f195f14625a51a (patch)
tree3b773b9c9f923b49563e72f6b6d28a91ba07c32c /gnu
parentd7d09a277376744a17500ad62f6ba5580a53c878 (diff)
downloadguix-008f3a28c6ca6f689f00f11af1f195f14625a51a.tar.gz
gnu: jami: Enable unit tests.
* gnu/packages/patches/jami-fix-qml-imports.patch: New file.
* gnu/packages/patches/jami-fix-unit-tests-build.patch: Likewise.
* gnu/packages/patches/jami-libjami-headers-search.patch: Likewise.
* gnu/packages/patches/jami-sip-unregister.patch: Likewise.
* gnu/packages/patches/jami-xcb-link.patch: Likewise.
* gnu/local.mk: Register them.
* gnu/packages/jami.scm (%jami-sources): Apply new patches.
(jami) [tests?]: Delete argument to run tests.
[configure-flags]: Remove TESTS? argument.
Enable tests with -DENABLE_TESTS=ON.  Remove -DLIBJAMI_INCLUDE_DIR.
[phases] {check}: New phase override.
[native-inputs]: Add settings-desktop-schemas.
[inputs]: Add glib and libxcb.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk5
-rw-r--r--gnu/packages/jami.scm46
-rw-r--r--gnu/packages/patches/jami-fix-qml-imports.patch78
-rw-r--r--gnu/packages/patches/jami-fix-unit-tests-build.patch139
-rw-r--r--gnu/packages/patches/jami-libjami-headers-search.patch109
-rw-r--r--gnu/packages/patches/jami-sip-unregister.patch48
-rw-r--r--gnu/packages/patches/jami-xcb-link.patch72
7 files changed, 488 insertions, 9 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index f747653a6f..e3e02314bb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1342,7 +1342,12 @@ dist_patch_DATA =						\
   %D%/packages/patches/isl-0.11.1-aarch64-support.patch	\
   %D%/packages/patches/itk-snap-alt-glibc-compat.patch		\
   %D%/packages/patches/jami-disable-integration-tests.patch	\
+  %D%/packages/patches/jami-fix-qml-imports.patch		\
+  %D%/packages/patches/jami-fix-unit-tests-build.patch          \
+  %D%/packages/patches/jami-libjami-headers-search.patch	\
   %D%/packages/patches/jami-no-webengine.patch			\
+  %D%/packages/patches/jami-sip-unregister.patch		\
+  %D%/packages/patches/jami-xcb-link.patch			\
   %D%/packages/patches/jamvm-1.5.1-aarch64-support.patch	\
   %D%/packages/patches/jamvm-1.5.1-armv7-support.patch	\
   %D%/packages/patches/jamvm-2.0.0-aarch64-support.patch	\
diff --git a/gnu/packages/jami.scm b/gnu/packages/jami.scm
index 7849a36e27..a9a988ca5a 100644
--- a/gnu/packages/jami.scm
+++ b/gnu/packages/jami.scm
@@ -95,7 +95,12 @@
      (base32
       "0hbsjjs61n7268lyjnjb9lzfpkkd65fmz76l1bg4awlz1f3cyywm"))
     (patches (search-patches "jami-disable-integration-tests.patch"
-                             "jami-no-webengine.patch"))))
+                             "jami-libjami-headers-search.patch"
+                             "jami-fix-unit-tests-build.patch"
+                             "jami-fix-qml-imports.patch"
+                             "jami-no-webengine.patch"
+                             "jami-sip-unregister.patch"
+                             "jami-xcb-link.patch"))))
 
 ;; Jami maintains a set of patches for some key dependencies (currently
 ;; pjproject and ffmpeg) of Jami that haven't yet been integrated upstream.
@@ -504,19 +509,14 @@ protocols, as well as decentralized calling using P2P-DHT.")
     (arguments
      (list
       #:qtbase qtbase
-      ;; The test suite fails to build (see:
-      ;; https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/882).
-      #:tests? #f
       #:configure-flags
-      #~(list "-DENABLE_TESTS=OFF"
+      #~(list "-DENABLE_TESTS=ON"
               ;; Disable the webengine since it grows the closure size by
               ;; about 450 MiB and requires more resources.
               "-DWITH_WEBENGINE=OFF"
               ;; Use libwrap to link directly to libjami instead of
               ;; communicating via D-Bus to jamid, the Jami daemon.
-              "-DENABLE_LIBWRAP=ON"
-              (string-append "-DLIBJAMI_INCLUDE_DIR="
-                             #$(this-package-input "libjami") "/include/jami"))
+              "-DENABLE_LIBWRAP=ON")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'change-directory/maybe
@@ -531,7 +531,32 @@ protocols, as well as decentralized calling using P2P-DHT.")
                 (("// clang-format on.*" anchor)
                  (string-append "const char VERSION_STRING[] = \""
                                 #$version "\";\n"
-                                anchor))))))))
+                                anchor)))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (setenv "QT_QPA_PLATFORM" "offscreen")
+                (setenv "QT_QUICK_BACKEND" "software")
+                ;; The tests require a writable HOME.
+                (setenv "HOME" "/tmp")
+
+                (display "Running unittests...\n")
+                (invoke "tests/unittests" "-mutejamid")
+
+                ;; XXX: There are currently multiple failures with the
+                ;; functional tests (see:
+                ;; https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/883),
+                ;; so the code below is disabled for now.
+                ;;
+                ;; (display "Running functional tests...\n")
+                ;; ;; This is to allow building from the source tarball or
+                ;; ;; directly from the git repository.
+                ;; (let  ((tests-qml (if (file-exists? "../client-qt/tests")
+                ;;                       "../client-qt/tests/qml"
+                ;;                       "../tests/qml")))
+                ;;   (invoke "tests/qml_tests" "-mutejamid"
+                ;;           "-input" tests-qml))
+                ))))))
     (native-inputs
      (list googletest
            pkg-config
@@ -539,11 +564,14 @@ protocols, as well as decentralized calling using P2P-DHT.")
            qttools
            doxygen
            graphviz
+           gsettings-desktop-schemas    ;for tests
            vulkan-headers))
     (inputs
      (list ffmpeg-jami
+           glib                         ;for integration with GNOME
            libjami
            libnotify
+           libxcb
            libxkbcommon
            network-manager
            qrencode
diff --git a/gnu/packages/patches/jami-fix-qml-imports.patch b/gnu/packages/patches/jami-fix-qml-imports.patch
new file mode 100644
index 0000000000..e24171785d
--- /dev/null
+++ b/gnu/packages/patches/jami-fix-qml-imports.patch
@@ -0,0 +1,78 @@
+From 9c4d065093d18b5495d3193028457b7393daea4b Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
+Date: Mon, 7 Nov 2022 16:26:50 -0500
+Subject: [PATCH] tests: Fix broken QML import directives.
+
+Fixes
+<https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/883>.
+
+Automated via:
+  $ find tests -name '*.qml'  | xargs sed -i 's,qrc:/src,../../../src,'
+
+Change-Id: Ic1a2f419e3e328e8bf861e7fdf370f15da66675f
+---
+Upstream status: https://review.jami.net/c/jami-client-qt/+/22990
+
+ tests/qml/src/tst_ChatViewFooter.qml       | 2 +-
+ tests/qml/src/tst_FilesToSendContainer.qml | 2 +-
+ tests/qml/src/tst_PresenceIndicator.qml    | 2 +-
+ tests/qml/src/tst_WizardView.qml           | 4 ++--
+ 4 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/client-qt/tests/qml/src/tst_ChatViewFooter.qml b/client-qt/tests/qml/src/tst_ChatViewFooter.qml
+index 84316d78..b0cffe1a 100644
+--- a/client-qt/tests/qml/src/tst_ChatViewFooter.qml
++++ b/client-qt/tests/qml/src/tst_ChatViewFooter.qml
+@@ -25,7 +25,7 @@ import QtTest
+ import net.jami.Models 1.1
+ import net.jami.Constants 1.1
+ 
+-import "qrc:/src/app/mainview/components"
++import "../../../src/app/mainview/components"
+ 
+ ColumnLayout {
+     id: root
+diff --git a/client-qt/tests/qml/src/tst_FilesToSendContainer.qml b/client-qt/tests/qml/src/tst_FilesToSendContainer.qml
+index b7f4810a..9432a44d 100644
+--- a/client-qt/tests/qml/src/tst_FilesToSendContainer.qml
++++ b/client-qt/tests/qml/src/tst_FilesToSendContainer.qml
+@@ -25,7 +25,7 @@ import QtTest
+ import net.jami.Models 1.1
+ import net.jami.Constants 1.1
+ 
+-import "qrc:/src/app/mainview/components"
++import "../../../src/app/mainview/components"
+ 
+ ColumnLayout {
+     id: root
+diff --git a/client-qt/tests/qml/src/tst_PresenceIndicator.qml b/client-qt/tests/qml/src/tst_PresenceIndicator.qml
+index 0eda9169..46c048e8 100644
+--- a/client-qt/tests/qml/src/tst_PresenceIndicator.qml
++++ b/client-qt/tests/qml/src/tst_PresenceIndicator.qml
+@@ -22,7 +22,7 @@ import QtTest
+ import net.jami.Models 1.1
+ import net.jami.Constants 1.1
+ 
+-import "qrc:/src/app/commoncomponents"
++import "../../../src/app/commoncomponents"
+ 
+ PresenceIndicator {
+     id: uut
+diff --git a/client-qt/tests/qml/src/tst_WizardView.qml b/client-qt/tests/qml/src/tst_WizardView.qml
+index 08698b7a..6a4f971d 100644
+--- a/client-qt/tests/qml/src/tst_WizardView.qml
++++ b/client-qt/tests/qml/src/tst_WizardView.qml
+@@ -24,8 +24,8 @@ import net.jami.Models 1.1
+ import net.jami.Constants 1.1
+ import net.jami.Enums 1.1
+ 
+-import "qrc:/src/app/wizardview"
+-import "qrc:/src/app/commoncomponents"
++import "../../../src/app/wizardview"
++import "../../../src/app/commoncomponents"
+ 
+ WizardView {
+     id: uut
+-- 
+2.37.3
+
diff --git a/gnu/packages/patches/jami-fix-unit-tests-build.patch b/gnu/packages/patches/jami-fix-unit-tests-build.patch
new file mode 100644
index 0000000000..0216a4bd67
--- /dev/null
+++ b/gnu/packages/patches/jami-fix-unit-tests-build.patch
@@ -0,0 +1,139 @@
+From 82ecd786a29344d57e6dd95ef0800bef9dd44542 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
+Date: Sun, 6 Nov 2022 00:16:34 -0400
+Subject: [PATCH 3/3] tests: Fix various compilation failures.
+
+Fixes <https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/882>.
+
+* tests/CMakeLists.txt: Add "Widgets" Qt module to find_package call.
+(QML_TEST_LIBS): Add Qt::Widgets.
+* tests/CMakeLists.txt: Rename QML_LIBS to QT_LIBS, a regression
+introduced in d82e3820706214d15d7cb7462978b7a43b798355.  Remove the
+dependency on on the Widgets module, now provided via QT_LIBS.
+* tests/qml/main.cpp [WITH_WEBENGINE]: Include QtWebEngine modules
+conditionally.
+(main) [WITH_WEBENGINE]: Initialize webengine conditionally.
+* tests/CMakeLists.txt: Link test objects with ${LIBCLIENT_NAME}.
+* src/app/qmlregister.h (registerTypes): Change parent type from
+MainApplication* to QObject*
+* src/app/qmlregister.cpp (registerTypes): Likewise.
+* tests/unittests/account_unittest.cpp (globalEnv): Remove variable.
+* tests/unittests/contact_unittest.cpp: Likewise.
+---
+Upstream status: https://review.jami.net/c/jami-client-qt/+/22984/1
+
+ src/app/qmlregister.cpp              | 2 +-
+ src/app/qmlregister.h                | 2 +-
+ tests/CMakeLists.txt                 | 6 +++---
+ tests/qml/main.cpp                   | 7 ++++---
+ tests/unittests/account_unittest.cpp | 2 --
+ tests/unittests/contact_unittest.cpp | 2 --
+ 6 files changed, 9 insertions(+), 12 deletions(-)
+
+diff --git a/client-qt/client-qt/src/app/qmlregister.cpp b/client-qt/src/app/qmlregister.cpp
+index 285f7814..67222eb5 100644
+--- a/client-qt/client-qt/src/app/qmlregister.cpp
++++ b/client-qt/src/app/qmlregister.cpp
+@@ -105,7 +105,7 @@ registerTypes(QQmlEngine* engine,
+               AppSettingsManager* settingsManager,
+               PreviewEngine* previewEngine,
+               ScreenInfo* screenInfo,
+-              MainApplication* parent)
++              QObject* parent)
+ {
+     // setup the adapters (their lifetimes are that of MainApplication)
+     auto callAdapter = new CallAdapter(systemTray, lrcInstance, parent);
+diff --git a/client-qt/client-qt/src/app/qmlregister.h b/client-qt/src/app/qmlregister.h
+index 38bfd091..aac0a887 100644
+--- a/client-qt/client-qt/src/app/qmlregister.h
++++ b/client-qt/src/app/qmlregister.h
+@@ -67,5 +67,5 @@ void registerTypes(QQmlEngine* engine,
+                    AppSettingsManager* appSettingsManager,
+                    PreviewEngine* previewEngine,
+                    ScreenInfo* screenInfo,
+-                   MainApplication* parent);
++                   QObject* parent);
+ }
+diff --git a/client-qt/client-qt/tests/CMakeLists.txt b/client-qt/tests/CMakeLists.txt
+index 8904d5ec..4e42b307 100644
+--- a/client-qt/client-qt/tests/CMakeLists.txt
++++ b/client-qt/tests/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-find_package(Qt${QT_VERSION_MAJOR} CONFIG REQUIRED QuickTest Test)
++find_package(Qt${QT_VERSION_MAJOR} CONFIG REQUIRED QuickTest Test Widgets)
+ 
+ if(MSVC)
+     # Download and unpack googletest for windows
+@@ -15,7 +15,7 @@ else()
+ endif()
+ 
+ enable_testing(true)
+-set(QML_TEST_LIBS ${QML_LIBS} Qt::QuickTest Qt::Test)
++set(QML_TEST_LIBS ${QT_LIBS} ${LIBCLIENT_NAME} Qt::QuickTest Qt::Test Qt::Widgets)
+ set(TESTS_INCLUDES
+     ${CMAKE_SOURCE_DIR}/src
+     ${CMAKE_SOURCE_DIR}/tests/qml
+@@ -192,4 +192,4 @@ else()
+                                ${LRC}/include)
+ 
+     add_test(NAME UnitTests COMMAND unittests)
+-endif()
+\ No newline at end of file
++endif()
+diff --git a/client-qt/client-qt/tests/qml/main.cpp b/client-qt/tests/qml/main.cpp
+index 09c02f3e..4c42027c 100644
+--- a/client-qt/client-qt/tests/qml/main.cpp
++++ b/client-qt/tests/qml/main.cpp
+@@ -31,9 +31,10 @@
+ #include <QQmlEngine>
+ #include <QQmlContext>
+ #include <QFontDatabase>
++#ifdef WITH_WEBENGINE
+ #include <QtWebEngineCore>
+ #include <QtWebEngineQuick>
+-
++#endif
+ #ifdef Q_OS_WIN
+ #include <windows.h>
+ #endif
+@@ -155,9 +156,9 @@ main(int argc, char** argv)
+         // Adjust the argument count.
+         argc = std::distance(argv, end);
+     }
+-
++#ifdef WITH_WEBENGINE
+     QtWebEngineQuick::initialize();
+-
++#endif
+     QTEST_SET_MAIN_SOURCE_PATH
+     Setup setup(muteDring);
+     return quick_test_main_with_setup(argc, argv, "qml_test", nullptr, &setup);
+diff --git a/client-qt/client-qt/tests/unittests/account_unittest.cpp b/client-qt/tests/unittests/account_unittest.cpp
+index aa98453e..5af2ad6e 100644
+--- a/client-qt/client-qt/tests/unittests/account_unittest.cpp
++++ b/client-qt/tests/unittests/account_unittest.cpp
+@@ -19,8 +19,6 @@
+ 
+ #include "globaltestenvironment.h"
+ 
+-TestEnvironment globalEnv;
+-
+ /*!
+  * Test fixture for AccountAdapter testing
+  */
+diff --git a/client-qt/client-qt/tests/unittests/contact_unittest.cpp b/client-qt/tests/unittests/contact_unittest.cpp
+index af8a9a22..b05cc856 100644
+--- a/client-qt/client-qt/tests/unittests/contact_unittest.cpp
++++ b/client-qt/tests/unittests/contact_unittest.cpp
+@@ -18,8 +18,6 @@
+ 
+ #include "globaltestenvironment.h"
+ 
+-TestEnvironment globalEnv;
+-
+ /*!
+  * Test fixture for AccountAdapter testing
+  */
+-- 
+2.37.3
+
diff --git a/gnu/packages/patches/jami-libjami-headers-search.patch b/gnu/packages/patches/jami-libjami-headers-search.patch
new file mode 100644
index 0000000000..44e099a610
--- /dev/null
+++ b/gnu/packages/patches/jami-libjami-headers-search.patch
@@ -0,0 +1,109 @@
+From 1168aba6181e30ee4c322e5f437bde22bece5698 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
+Date: Sat, 5 Nov 2022 23:18:13 -0400
+Subject: [PATCH 1/3] cmake: Simplify lookup logic for libjami headers.
+
+* extras/build/cmake/modules/FindLibJami.cmake: Rename
+LIBJAMI_INCLUDE_DIRS to LIBJAMI_INCLUDE_DIR.  Use find_path to search
+for jami.h directory.
+* CMakeLists.txt: Adjust accordingly.
+* src/libclient/CMakeLists.txt: Likewise.
+* src/libclient/qtwrapper/CMakeLists.txt: Likewise.
+
+Change-Id: I494358f9bfafb41f000daeec4196747b2c184401
+---
+Upstream status: https://review.jami.net/c/jami-client-qt/+/22973
+
+ CMakeLists.txt                               |  2 +-
+ extras/build/cmake/modules/FindLibJami.cmake | 21 ++++++--------------
+ src/libclient/CMakeLists.txt                 |  2 +-
+ src/libclient/qtwrapper/CMakeLists.txt       |  2 +-
+ 4 files changed, 9 insertions(+), 18 deletions(-)
+
+diff --git a/client-qt/CMakeLists.txt b/CMakeLists.txt
+index d0a8fd70..94ac6074 100644
+--- a/client-qt/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -118,7 +118,7 @@ set(CMAKE_MODULE_PATH
+   ${CMAKE_MODULE_PATH} "${EXTRAS_DIR}/build/cmake/modules")
+ find_package(LibJami REQUIRED)
+ if(LIBJAMI_FOUND)
+-  include_directories(${LIBJAMI_INCLUDE_DIRS})
++  include_directories(${LIBJAMI_INCLUDE_DIR})
+ endif()
+ 
+ include(FindPython3)
+diff --git a/client-qt/extras/build/cmake/modules/FindLibJami.cmake b/extras/build/cmake/modules/FindLibJami.cmake
+index ddb05319..9ad20d2b 100644
+--- a/client-qt/extras/build/cmake/modules/FindLibJami.cmake
++++ b/extras/build/cmake/modules/FindLibJami.cmake
+@@ -20,28 +20,19 @@
+ 
+ # Once done, this find module will set:
+ #
+-#   LIBJAMI_INCLUDE_DIRS - libjami include directories
++#   LIBJAMI_INCLUDE_DIR - libjami include directories
+ #   LIBJAMI_FOUND - whether it was able to find the include directories
+ #   LIBJAMI_LIB - path to libjami or libring library
+ 
+ set(LIBJAMI_FOUND true)
+ 
+ if(WITH_DAEMON_SUBMODULE)
+-  set(LIBJAMI_INCLUDE_DIRS ${DAEMON_DIR}/src/jami)
++  set(LIBJAMI_INCLUDE_DIR ${DAEMON_DIR}/src/jami)
+ else()
+-  if(EXISTS ${LIBJAMI_INCLUDE_DIR}/jami.h)
+-    set(LIBJAMI_INCLUDE_DIRS ${LIBJAMI_INCLUDE_DIR})
+-  elseif(EXISTS ${LIBJAMI_BUILD_DIR}/jami/jami.h)
+-    set(LIBJAMI_INCLUDE_DIRS ${LIBJAMI_BUILD_DIR}/jami)
+-  elseif(EXISTS ${RING_INCLUDE_DIR}/jami.h)
+-    set(LIBJAMI_INCLUDE_DIRS ${RING_INCLUDE_DIR})
+-  elseif(EXISTS ${RING_BUILD_DIR}/jami/jami.h)
+-    set(LIBJAMI_INCLUDE_DIRS ${RING_BUILD_DIR}/jami)
+-  elseif(EXISTS ${CMAKE_INSTALL_PREFIX}/include/jami/jami.h)
+-    set(LIBJAMI_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/jami)
+-  else()
++  find_path(LIBJAMI_INCLUDE_DIR jami.h PATH_SUFFIXES jami)
++  if(NOT LIBJAMI_INCLUDE_DIR)
+     message(STATUS "Jami daemon headers not found!
+-Set -DLIBJAMI_BUILD_DIR or -DCMAKE_INSTALL_PREFIX")
++Set -DCMAKE_INSTALL_PREFIX or use -DWITH_DAEMON_SUBMODULE")
+     set(LIBJAMI_FOUND false)
+   endif()
+ endif()
+@@ -102,5 +93,5 @@ endif()
+ # Restore the original value of CMAKE_FIND_LIBRARY_SUFFIXES.
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_orig})
+ 
+-message(STATUS "Jami daemon headers are in " ${LIBJAMI_INCLUDE_DIRS})
++message(STATUS "Jami daemon headers are in " ${LIBJAMI_INCLUDE_DIR})
+ message(STATUS "Jami daemon library is at " ${LIBJAMI_LIB})
+diff --git a/client-qt/src/libclient/CMakeLists.txt b/src/libclient/CMakeLists.txt
+index 2676c9c4..ac58ea2b 100644
+--- a/client-qt/src/libclient/CMakeLists.txt
++++ b/src/libclient/CMakeLists.txt
+@@ -62,7 +62,7 @@ set(CMAKE_MODULE_PATH
+   ${CMAKE_MODULE_PATH} "${EXTRAS_DIR}/build/cmake/modules")
+ find_package(LibJami REQUIRED)
+ if(LIBJAMI_FOUND)
+-  include_directories(${LIBJAMI_INCLUDE_DIRS})
++  include_directories(${LIBJAMI_INCLUDE_DIR})
+ endif()
+ 
+ string(SUBSTRING ${CMAKE_GENERATOR} 0 14 CMAKE_GENERATOR_SHORT)
+diff --git a/client-qt/src/libclient/qtwrapper/CMakeLists.txt b/src/libclient/qtwrapper/CMakeLists.txt
+index acee0d0c..ba68aac4 100644
+--- a/client-qt/src/libclient/qtwrapper/CMakeLists.txt
++++ b/client-qt/src/libclient/qtwrapper/CMakeLists.txt
+@@ -46,7 +46,7 @@ else()
+ endif()
+ 
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+-include_directories(${LIBJAMI_INCLUDE_DIRS})
++include_directories(${LIBJAMI_INCLUDE_DIR})
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../dbus)
+ 
+-- 
+2.37.3
+
diff --git a/gnu/packages/patches/jami-sip-unregister.patch b/gnu/packages/patches/jami-sip-unregister.patch
new file mode 100644
index 0000000000..1f0302bb12
--- /dev/null
+++ b/gnu/packages/patches/jami-sip-unregister.patch
@@ -0,0 +1,48 @@
+From c1e6d664601b35a466f4e02e86a2c8181fdcca12 Mon Sep 17 00:00:00 2001
+From: Antoine Noreau <antoine.noreau@savoirfairelinux.com>
+Date: Thu, 3 Nov 2022 15:35:40 -0400
+Subject: [PATCH] sip: ensure correct unregister upon closure
+
+Ensure SIP connections are gracefully terminated:
+Removed duplicated register calls to SIP server
+
+Change-Id: I330e67cf9534504f92517996eb7b693b43d359d3
+Gitlab: #786
+---
+ src/upnp/upnp_context.cpp | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/daemon/src/upnp/upnp_context.cpp b/daemon/src/upnp/upnp_context.cpp
+index a447e2d75..c68fe502c 100644
+--- a/daemon/src/upnp/upnp_context.cpp
++++ b/daemon/src/upnp/upnp_context.cpp
+@@ -143,7 +143,7 @@ void
+ UPnPContext::stopUpnp(bool forceRelease)
+ {
+     if (not isValidThread()) {
+-        runOnUpnpContextQueue([this] { stopUpnp(); });
++        runOnUpnpContextQueue([this, forceRelease] { stopUpnp(forceRelease); });
+         return;
+     }
+ 
+@@ -168,10 +168,15 @@ UPnPContext::stopUpnp(bool forceRelease)
+         preferredIgd_.reset();
+         validIgdList_.clear();
+     }
+-
+     for (auto const& map : toRemoveList) {
+         requestRemoveMapping(map);
+-        updateMappingState(map, MappingState::FAILED);
++
++        /* Notify is not needed in updateMappingState when
++        shutting down (hence set it to false). NotifyCallback
++        would trigger a new SIP registration and create a
++        false registered state upon program close.  */
++
++        updateMappingState(map, MappingState::FAILED, false);
+         // We dont remove mappings with auto-update enabled,
+         // unless forceRelease is true.
+         if (not map->getAutoUpdate() or forceRelease) {
+-- 
+2.37.3
+
diff --git a/gnu/packages/patches/jami-xcb-link.patch b/gnu/packages/patches/jami-xcb-link.patch
new file mode 100644
index 0000000000..6879493123
--- /dev/null
+++ b/gnu/packages/patches/jami-xcb-link.patch
@@ -0,0 +1,72 @@
+From 3db2a7802422e69f50030db854abfb72fbc9caa4 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
+Date: Fri, 11 Nov 2022 22:38:32 -0500
+Subject: [PATCH] Move xcb include/link directives from jami to libclient.
+
+Relates to <https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/882>.
+
+This problem was discovered when attempting to build the test suite:
+
+   ld: ../src/libclient/liblibjamiclient.a(avmodel.cpp.o): undefined
+   reference to symbol 'xcb_get_setup'
+
+* CMakeLists.txt: [!(APPLE or MSVC] Move xcb includes and link directives to...
+* src/libclient/CMakeLists.txt [!(APPLE or MSVC]: ... here.
+
+Change-Id: If9b6653e157081300caad8f13cafe4979a49630b
+---
+ CMakeLists.txt               | 6 +-----
+ src/libclient/CMakeLists.txt | 6 ++++++
+ 2 files changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/client-qt/CMakeLists.txt b/client-qt/CMakeLists.txt
+index d0a8fd70..2a09fd6c 100644
+--- a/client-qt/CMakeLists.txt
++++ b/client-qt/CMakeLists.txt
+@@ -384,8 +384,6 @@ elseif (NOT APPLE)
+     add_definitions(${LIBGDKPIXBUF_CFLAGS})
+   endif()
+ 
+-  pkg_check_modules(XCB xcb)
+-
+   list(PREPEND CMAKE_PREFIX_PATH
+     ${LIBJAMI_CONTRIB_DIR}/native/ffmpeg/libavutil)
+   pkg_check_modules(LIBAVUTIL libavutil>=55.75.100)
+@@ -398,7 +396,6 @@ elseif (NOT APPLE)
+     ${LIBNOTIFY_INCLUDE_DIRS}
+     ${LIBGDKPIXBUF_INCLUDE_DIRS}
+     ${GLIB_INCLUDE_DIRS}
+-    ${XCB_INCLUDE_DIRS}
+     ${LIBAVUTIL_INCLUDE_DIRS})
+ 
+   set(JAMI_DATA_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
+@@ -586,8 +583,7 @@ elseif (NOT APPLE)
+     ${LIBNOTIFY_LIBRARIES}
+     ${LIBGDKPIXBUF_LIBRARIES}
+     ${GLIB_LIBRARIES}
+-    ${GIO_LIBRARIES}
+-    ${XCB_LIBRARIES})
++    ${GIO_LIBRARIES})
+ 
+   # Installation rules
+   install(
+diff --git a/client-qt/src/libclient/CMakeLists.txt b/client-qt/src/libclient/CMakeLists.txt
+index 99780f5f..1dd32677 100644
+--- a/client-qt/src/libclient/CMakeLists.txt
++++ b/client-qt/src/libclient/CMakeLists.txt
+@@ -475,6 +475,12 @@ add_library(${LIBCLIENT_NAME} STATIC
+ foreach(QT_LIB ${QT_LIBS})
+   target_link_libraries(${LIBCLIENT_NAME} ${QT_LIB})
+ endforeach()
++
++if(NOT(APPLE OR MSVC))
++  pkg_check_modules(XCB xcb IMPORTED_TARGET)
++  target_link_libraries(${LIBCLIENT_NAME} PkgConfig::XCB)
++endif()
++
+ if(ENABLE_LIBWRAP)
+   target_link_libraries(${LIBCLIENT_NAME} qtwrapper ${LIBJAMI_LIB})
+   if (NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC"))
+-- 
+2.37.3
+