debian: build and package client-qt

Also remove unused DEBIAN_PACKAGING_OVERRIDE.

Change-Id: Ida109a811bebd1fb46fd1a8b90fb5463518382c0
diff --git a/packaging/rules/debian/rules b/packaging/rules/debian/rules
index 847c39c..27a990d 100755
--- a/packaging/rules/debian/rules
+++ b/packaging/rules/debian/rules
@@ -15,6 +15,8 @@
 # Binary package names
 JAMI_ALL_IN_ONE_PKG_NAME="jami-all"
 JAMI_CLIENT_PKG_NAME="jami"
+JAMI_CLIENT_GNOME_PKG_NAME="jami-gnome"
+JAMI_LIB_CLIENT_PKG_NAME="jami-libclient"
 JAMI_DAEMON_PKG_NAME="jami-daemon"
 
 # Bundled packages from contrib
@@ -34,6 +36,14 @@
 endif
 endif
 
+# Qt-related variables
+QT_JAMI_PREFIX := ${QT_JAMI_PREFIX}
+export PATH := $(QT_JAMI_PREFIX)/bin:${PATH}
+export LD_LIBRARY_PATH := $(QT_JAMI_PREFIX)/lib:${LD_LIBRARY_PATH}
+export PKG_CONFIG_PATH := $(QT_JAMI_PREFIX)/lib/pkgconfig:${PKG_CONFIG_PATH}
+export CMAKE_PREFIX_PATH := $(QT_JAMI_PREFIX)/lib/cmake:${CMAKE_PREFIX_PATH}
+
+
 %:
 	dh $@
 
@@ -103,6 +113,11 @@
 			$(CMAKE_OPTIONS) \
 			..
 
+	#########################
+	## qt client configure ##
+	#########################
+	# needs to be done after lrc is built; see below
+
 	dh_auto_configure
 
 override_dh_auto_build:
@@ -122,6 +137,19 @@
 	########################
 	make -C client-gnome/build LDFLAGS="-lpthread" -j$(NO_CPUS) V=1
 
+	###################################
+	## qt client configure and build ##
+	###################################
+	cd client-qt && \
+		mkdir build && \
+		cd build && \
+		cmake \
+			-DCMAKE_INSTALL_PREFIX=/usr \
+			-DLRC=$(CURDIR)/lrc \
+			$(CMAKE_OPTIONS) \
+			..
+	make -C client-qt/build -j$(NO_CPUS) V=1
+
 override_dh_auto_clean:
 	################################
 	## Generated contrib tarballs ##
@@ -149,6 +177,13 @@
 	if [ -f client-gnome/build/Makefile ]; then make -C client-gnome/build clean; fi
 	rm -rfv client-gnome/build
 
+	#####################
+	## qt client clean ##
+	#####################
+	# CMake build system has no distclean target, so use clean.
+	if [ -f client-qt/build/Makefile ]; then make -C client-qt/build clean; fi
+	rm -rfv client-qt/build
+
 override_dh_clean:
 	# GNUTLS contains:
 	# ring-project/daemon/contrib/tarballs-unpacked/gnutls-3.5.10.tar.xz/gnutls-3.5.10/src/certtool-args.c.bak
@@ -170,17 +205,24 @@
 	#########################
 
         ## LibRingClient
-	cd lrc/build && make DESTDIR=$(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME) install
-	rm -rfv $(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME)/usr/include
+	cd lrc/build && make DESTDIR=$(CURDIR)/debian/$(JAMI_LIB_CLIENT_PKG_NAME) install
+	rm -rfv $(CURDIR)/debian/$(JAMI_LIB_CLIENT_PKG_NAME)/usr/include
 
 	# This is a symlink, should be in -dev package
-	rm -v $(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME)/usr/lib/libringclient.so
+	rm -v $(CURDIR)/debian/$(JAMI_LIB_CLIENT_PKG_NAME)/usr/lib/libringclient.so
 
 	# cmake files
 	rm -rfv $(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME)/usr/lib/cmake
 
         ## GNOME client
-	cd client-gnome/build && make DESTDIR=$(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME) install
+	cd client-gnome/build && \
+		make DESTDIR=$(CURDIR)/debian/$(JAMI_CLIENT_GNOME_PKG_NAME) install
+	rm -rfv $(CURDIR)/debian/$(JAMI_CLIENT_GNOME_PKG_NAME)/usr/bin/jami
+
+	## Qt client
+	cd client-qt/build && \
+		make DESTDIR=$(CURDIR)/debian/$(JAMI_CLIENT_PKG_NAME) install
+
 	ln -sf /usr/bin/jami $(CURDIR)/debian/jami/usr/bin/ring.cx
 
 	######################
@@ -205,7 +247,16 @@
 
         ## GNOME client
 	cd client-gnome/build && make DESTDIR=$(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME) install
-	ln -sf /usr/bin/jami $(CURDIR)/debian/jami-all/usr/bin/ring.cx
+	rm -rfv $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/bin/jami
+
+	## Qt client
+	cd client-qt/build && \
+		make DESTDIR=$(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME) install
+
+	ln -sf /usr/bin/jami $(CURDIR)/debian/$(JAMI_ALL_IN_ONE_PKG_NAME)/usr/bin/ring.cx
+
+override_dh_shlibdeps:
+	dh_shlibdeps -- -x$(JAMI_ALL_IN_ONE_PKG_NAME)
 
 tmpdir:= $(shell mktemp -d)
 workdir:= $(shell pwd)