From 030db788e721ca6df3549f9d27630e3dbbaf6dd9 Mon Sep 17 00:00:00 2001
From: Amin Bandali <amin.bandali@savoirfairelinux.com>
Date: Tue, 22 Mar 2022 10:51:40 -0400
Subject: [PATCH] packaging: fix libclient dependency issues of deb packages

Since for our deb packages all the binary packages share the same
source package, and are built in the same environment, depending on
the distro and dpkg tools versions, dpkg-shlibdeps might incorrectly
add the wrong libclient package for either clients.  For example,
have the jami-gnome package depend on both jami-libclient-gnome and
jami-libclient; which is wrong, since jami-libclient-gnome and
jami-libclient conflict with each other and cannot be installed
simultaneously.  So, we instruct dpkg-shlibdeps to exclude the two
libclient packages from ${shlibs:Depends}, which is fine because
we already manually add the correct one to each client's Depends.

Also, use the system libarchive-dev package for Ubuntu 18.04 as well;
since like with Debian 10, building libarchive from daemon's contribs
fails there too.

GitLab: #1415
Change-Id: I1c065a7fd3fc58324c7893d5d23039f2a5109931
---
 docker/Dockerfile_ubuntu_18.04 | 1 +
 packaging/rules/debian/control | 3 ++-
 packaging/rules/debian/rules   | 9 ++++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/docker/Dockerfile_ubuntu_18.04 b/docker/Dockerfile_ubuntu_18.04
index 379e0744..cbc9b81a 100644
--- a/docker/Dockerfile_ubuntu_18.04
+++ b/docker/Dockerfile_ubuntu_18.04
@@ -12,6 +12,7 @@ RUN apt-get update && \
         g++-8 \
         clang \
         clang-tools \
+        libarchive-dev \
         software-properties-common \
         wget
 
diff --git a/packaging/rules/debian/control b/packaging/rules/debian/control
index f8219c37..5f49c3ac 100644
--- a/packaging/rules/debian/control
+++ b/packaging/rules/debian/control
@@ -109,7 +109,8 @@ Package: jami-gnome
 Architecture: any
 Depends: ${shlibs:Depends},
          ${misc:Depends},
-         jami-libclient-gnome (=${binary:Version})
+         jami-libclient-gnome (=${binary:Version}),
+         libqt-jami (>= 6.2.3)
 Description: Secure and distributed voice, video and chat platform - desktop client
  Jami (jami.net) is a secure and distributed voice, video and chat communication
  platform that requires no centralized server and leaves the power of privacy
diff --git a/packaging/rules/debian/rules b/packaging/rules/debian/rules
index 0d5893c1..7781a0c9 100755
--- a/packaging/rules/debian/rules
+++ b/packaging/rules/debian/rules
@@ -35,6 +35,10 @@ ifeq (debian_10,$(findstring debian_10, $(DISTRIBUTION)))
 # Daemon's bundled libarchive does not build on Debian 10
 BUNDLED_PKGS="--disable-libarchive"
 endif
+ifeq (ubuntu_18.04,$(findstring ubuntu_18.04, $(DISTRIBUTION)))
+# Daemon's bundled libarchive does not build on Ubuntu 18.04
+BUNDLED_PKGS="--disable-libarchive"
+endif
 ifeq (raspbian_10_armhf,$(findstring raspbian_10_armhf, $(DISTRIBUTION)))
 # Raspbian's yaml-cpp lib does not work properly
 BUNDLED_PKGS="--enable-ffmpeg --enable-yaml-cpp"
@@ -247,7 +251,10 @@ override_dh_auto_install:
 	make DESTDIR=$(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME) install
 
 override_dh_shlibdeps:
-	dh_shlibdeps -- -x$(JAMI_ALL_IN_ONE_PKG_NAME)
+	dh_shlibdeps -- \
+	  -x$(JAMI_ALL_IN_ONE_PKG_NAME) \
+	  -x$(JAMI_LIB_CLIENT_PKG_NAME) \
+	  -x$(JAMI_LIB_CLIENT_GNOME_PKG_NAME)
 
 tmpdir:= $(shell mktemp -d)
 workdir:= $(shell pwd)
-- 
GitLab