From c79ae4d426b61f422ac759dcba9567a9365664c1 Mon Sep 17 00:00:00 2001
From: Hugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
Date: Tue, 7 Aug 2018 14:48:28 -0400
Subject: [PATCH] packaging: build again ring client binary package

Recent packaging changes removed the ring binary package from ring.cx
and replaced it by ring-all. This is because it doesn't make sense to
most end users to install daemon and client separately. However this
change has broken compatibility with the previous packaging policy, at
the very least because we didn't provide a transition package.

There are two solutions:
1. Provide a transition package
2. Build ring binary package again

Both should work well but 2. has better compatibility with official
Debian/Ubuntu packaging so we opt for this one.

Change-Id: I556ae580126038de7077f91b137adbf1046d59e4
---
 packaging/rules/debian/README.Debian          | 13 ++++++-----
 packaging/rules/debian/control                | 22 +++++++++++++++----
 packaging/rules/debian/ring.lintian-overrides |  3 +++
 packaging/rules/debian/ring.manpages          |  1 +
 packaging/rules/debian/ring.triggers          |  1 +
 packaging/rules/debian/rules                  | 18 +++++++++++++++
 6 files changed, 48 insertions(+), 10 deletions(-)
 create mode 100644 packaging/rules/debian/ring.lintian-overrides
 create mode 100644 packaging/rules/debian/ring.manpages
 create mode 100644 packaging/rules/debian/ring.triggers

diff --git a/packaging/rules/debian/README.Debian b/packaging/rules/debian/README.Debian
index 33f73b69..2fe2a5ad 100644
--- a/packaging/rules/debian/README.Debian
+++ b/packaging/rules/debian/README.Debian
@@ -1,11 +1,11 @@
 # Differences and compatibility with official debian.org package
 
-This source package provides two binary packages ring-all and ring-daemon.
+This source package provides binary packages ring, ring-all and ring-daemon.
 It differs slightly from the official Debian package (the one from debian.org).
 
-ring-daemon: structurally identical to the Debian package, the only difference
- potentially being the shipped version of Ring (the debian.org package is
- usually older).
+ring & ring-daemon: structurally identical to the Debian package, the only
+ difference potentially being the shipped version of Ring (the debian.org
+ package from stable is usually older).
 
 ring-all: all-in-one package, ships both the Ring Daemon and the GNOME client.
  This package is not available in the debian.org repositories (not needed in the
@@ -16,11 +16,12 @@ ring-all: all-in-one package, ships both the Ring Daemon and the GNOME client.
  - installation of release keys and ring.cx package repository as trusted peers
    so Ring can be updated from ring.cx along with system updates
 
- Why not two packages ring and ring-daemon instead of a single all package ?
+ two packages ring and ring-daemon vs. single all package ?
  -> One cannot register a repository in source.list.d and directly use it to
     fetch the dependencies. That would require something like an apt update in
     the maintscripts and we don't want that. So, it is not possible to have a
-    one-click-install with two packages.
+    one-click-install with two packages. That's why we build ring-all for
+    one-click install.
 
  ring-all conflicts with ring and ring-daemon since they are distributing the
  same files.
diff --git a/packaging/rules/debian/control b/packaging/rules/debian/control
index 9bf46611..471d298e 100644
--- a/packaging/rules/debian/control
+++ b/packaging/rules/debian/control
@@ -61,10 +61,10 @@ Vcs-Browser: https://git.ring.cx/savoirfairelinux/ring-project
 
 Package: ring-all
 Architecture: any
-Depends: ${shlibs:Depends},
-         libqt5sql5-sqlite,
-         ${misc:Depends},
-         gnupg
+Depends: libqt5sql5-sqlite,
+         gnupg,
+         ${shlibs:Depends},
+         ${misc:Depends}
 Replaces: ring,
           ring-gnome,
           ring-daemon
@@ -78,6 +78,20 @@ Description: Secure and distributed voice, video and chat platform - all in one
  .
  This package contains the GNOME desktop client and dring, the Ring daemon.
 
+Package: ring
+Architecture: any
+Depends: ${shlibs:Depends},
+         ${misc:Depends},
+         ring-daemon (=${binary:Version})
+Replaces: ring-gnome
+Conflicts: ring-gnome
+Description: Secure and distributed voice, video and chat platform - desktop client
+ Ring (ring.cx) is a secure and distributed voice, video and chat communication
+ platform that requires no centralized server and leaves the power of privacy
+ in the hands of the user.
+ .
+ This package contains the desktop client: gnome-ring.
+
 Package: ring-daemon
 Architecture: any
 Depends: ${shlibs:Depends},
diff --git a/packaging/rules/debian/ring.lintian-overrides b/packaging/rules/debian/ring.lintian-overrides
new file mode 100644
index 00000000..8ab14fe9
--- /dev/null
+++ b/packaging/rules/debian/ring.lintian-overrides
@@ -0,0 +1,3 @@
+# We are shipping a .so, but this isn't a library package
+package-name-doesnt-match-sonames
+no-symbols-control-file
diff --git a/packaging/rules/debian/ring.manpages b/packaging/rules/debian/ring.manpages
new file mode 100644
index 00000000..d920cbc0
--- /dev/null
+++ b/packaging/rules/debian/ring.manpages
@@ -0,0 +1 @@
+client-gnome/doc/gnome-ring.1
diff --git a/packaging/rules/debian/ring.triggers b/packaging/rules/debian/ring.triggers
new file mode 100644
index 00000000..dd866036
--- /dev/null
+++ b/packaging/rules/debian/ring.triggers
@@ -0,0 +1 @@
+activate-noawait ldconfig
diff --git a/packaging/rules/debian/rules b/packaging/rules/debian/rules
index 8bcdbf3b..7128192d 100755
--- a/packaging/rules/debian/rules
+++ b/packaging/rules/debian/rules
@@ -14,6 +14,7 @@ endif
 
 # Binary package names
 RING_ALL_IN_ONE_PKG_NAME="ring-all"
+RING_CLIENT_PKG_NAME="ring"
 RING_DAEMON_PKG_NAME="ring-daemon"
 
 %:
@@ -144,6 +145,23 @@ override_dh_auto_install:
 	rm -rfv $(CURDIR)/debian/$(RING_DAEMON_PKG_NAME)/usr/lib/*.a
 	rm -rfv $(CURDIR)/debian/$(RING_DAEMON_PKG_NAME)/usr/lib/*.la
 
+	#########################
+	## Ring client install ##
+	#########################
+
+        ## LibRingClient
+	cd lrc/build && make DESTDIR=$(CURDIR)/debian/$(RING_CLIENT_PKG_NAME) install
+	rm -rfv $(CURDIR)/debian/$(RING_CLIENT_PKG_NAME)/usr/include
+
+	# This is a symlink, should be in -dev package
+	rm -v $(CURDIR)/debian/$(RING_CLIENT_PKG_NAME)/usr/lib/libringclient.so
+
+	# cmake files
+	rm -rfv $(CURDIR)/debian/$(RING_CLIENT_PKG_NAME)/usr/lib/cmake
+
+        ## GNOME client
+	cd client-gnome/build && make DESTDIR=$(CURDIR)/debian/$(RING_CLIENT_PKG_NAME) install
+
 	######################
 	## Ring AiO install ##
 	######################
-- 
GitLab