From 94cf1f8b5b341bb49960a22c48983ce63f4ab48b Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Date: Tue, 16 Mar 2021 22:05:13 -0400
Subject: [PATCH] packaging/fedora: Split into multiple packages.

Tackle the growing complexity of the packaging by splitting the
problem into smaller parts.  This change makes the daemon its own
package, along the client library and the GNOME client.

The build script is updated to reflect these changes, and
unused/obsolete spec files are removed from the project.

GitLab: #264
Change-Id: I5813e48e0c1248875a7a8f0ee1ec6fb2b87faef4
---
 packaging/rules/fedora/jami-daemon.spec    | 121 +++++++++
 packaging/rules/fedora/jami-gnome.spec     |  68 +++++
 packaging/rules/fedora/jami-libclient.spec |  69 +++++
 packaging/rules/fedora/jami-one-click.spec | 229 -----------------
 packaging/rules/fedora/jami.spec           | 280 ---------------------
 scripts/build-package-fedora.sh            |  57 ++---
 6 files changed, 280 insertions(+), 544 deletions(-)
 create mode 100644 packaging/rules/fedora/jami-daemon.spec
 create mode 100644 packaging/rules/fedora/jami-gnome.spec
 create mode 100644 packaging/rules/fedora/jami-libclient.spec
 delete mode 100644 packaging/rules/fedora/jami-one-click.spec
 delete mode 100644 packaging/rules/fedora/jami.spec

diff --git a/packaging/rules/fedora/jami-daemon.spec b/packaging/rules/fedora/jami-daemon.spec
new file mode 100644
index 00000000..5cb88e49
--- /dev/null
+++ b/packaging/rules/fedora/jami-daemon.spec
@@ -0,0 +1,121 @@
+%define name        jami-daemon
+%define version     RELEASE_VERSION
+%define release     0
+
+Name:          %{name}
+Version:       %{version}
+Release:       %{release}%{?dist}
+Summary:       Daemon component of Jami
+Group:         Applications/Internet
+License:       GPLv3+
+Vendor:        Savoir-faire Linux
+URL:           https://jami.net/
+Source:        jami_%{version}.tar.gz
+Requires:      jami-daemon = %{version}
+
+# Build dependencies
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: cmake
+BuildRequires: gcc-c++
+BuildRequires: gettext-devel
+BuildRequires: libtool
+BuildRequires: make
+BuildRequires: which
+BuildRequires: yasm
+
+# Build and runtime dependencies.  Requires directives are
+# automatically made to linked shared libraries via RPM, so there's no
+# need to explicitly relist them.
+BuildRequires: NetworkManager-libnm-devel
+BuildRequires: alsa-lib-devel
+BuildRequires: dbus-devel
+BuildRequires: expat-devel
+BuildRequires: gnutls-devel
+BuildRequires: jsoncpp-devel
+BuildRequires: libXext-devel
+BuildRequires: libXfixes-devel
+BuildRequires: libupnp-devel
+BuildRequires: libuuid-devel
+BuildRequires: libva-devel
+BuildRequires: libvdpau-devel
+BuildRequires: nettle-devel
+BuildRequires: opus-devel
+BuildRequires: pcre-devel
+BuildRequires: pulseaudio-libs-devel
+BuildRequires: uuid-c++-devel
+BuildRequires: uuid-devel
+BuildRequires: webkitgtk4-devel
+BuildRequires: yaml-cpp-devel
+
+%description
+This package contains the daemon of Jami, a free software for
+universal communication which respects the freedoms and privacy of its
+users.
+
+%prep
+%setup -n ring-project
+
+%build
+# Configure the Jami bundled libraries (ffmpeg & pjproject).
+mkdir -p daemon/contrib/native
+cd %{_builddir}/ring-project/daemon/contrib/native && \
+    ../bootstrap \
+        --no-checksums \
+        --disable-ogg \
+        --disable-flac \
+        --disable-vorbis \
+        --disable-vorbisenc \
+        --disable-speex \
+        --disable-sndfile \
+        --disable-gsm \
+        --disable-speexdsp \
+        --disable-natpmp && \
+    make list && \
+    make fetch && \
+    make %{_smp_mflags} V=1 && \
+    make %{_smp_mflags} V=1 .ffmpeg
+
+# Configure the daemon.
+cd %{_builddir}/ring-project/daemon && \
+    ./autogen.sh && \
+    ./configure \
+        --prefix=%{_prefix} \
+        --libdir=%{_libdir} \
+        --disable-shared
+
+# Build the daemon.
+make -C %{_builddir}/ring-project/daemon %{_smp_mflags} V=1
+pod2man %{_builddir}/ring-project/daemon/man/dring.pod \
+        > %{_builddir}/ring-project/daemon/dring.1
+
+%install
+DESTDIR=%{buildroot} make -C daemon install
+cp %{_builddir}/ring-project/daemon/dring.1 \
+   %{buildroot}/%{_mandir}/man1/dring.1
+rm -rfv %{buildroot}/%{_libdir}/*.a
+rm -rfv %{buildroot}/%{_libdir}/*.la
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/ring/dring
+%{_datadir}/ring/ringtones
+%{_datadir}/dbus-1/services/*
+%{_datadir}/dbus-1/interfaces/*
+%doc %{_mandir}/man1/dring*
+
+%package devel
+Summary: Development files of the Jami daemon
+
+%description devel
+This package contains the header files for using the Jami daemon as a library.
+
+%files devel
+%{_includedir}/dring
+%{_includedir}/jami_contact.h
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
diff --git a/packaging/rules/fedora/jami-gnome.spec b/packaging/rules/fedora/jami-gnome.spec
new file mode 100644
index 00000000..4cce6292
--- /dev/null
+++ b/packaging/rules/fedora/jami-gnome.spec
@@ -0,0 +1,68 @@
+%define name        jami-gnome
+%define version     RELEASE_VERSION
+%define release     0
+
+Name:          %{name}
+Version:       %{version}
+Release:       %{release}%{?dist}
+Summary:       GNOME desktop client for Jami
+Group:         Applications/Internet
+License:       GPLv3+
+Vendor:        Savoir-faire Linux
+URL:           https://jami.net/
+Source:        jami_%{version}.tar.gz
+Requires:      jami-libclient = %{version}
+
+# Build dependencies.
+BuildRequires: cmake
+BuildRequires: gcc
+BuildRequires: make
+BuildRequires: gettext-devel
+
+# Build and runtime dependencies.
+BuildRequires: glib2-devel
+BuildRequires: dbus-devel
+BuildRequires: libnotify-devel
+BuildRequires: clutter-devel
+BuildRequires: clutter-gtk-devel
+BuildRequires: gtk3-devel
+BuildRequires: libappindicator-gtk3-devel
+BuildRequires: libcanberra-devel
+BuildRequires: qrencode-devel
+BuildRequires: webkitgtk4-devel
+
+%description
+This package contains the GNOME desktop client of Jami. Jami is a free
+software for universal communication which respects freedoms and
+privacy of its users.
+
+%prep %setup -n ring-project
+
+%build
+cd %{_builddir}/ring-project/client-gnome && \
+    mkdir build && cd build && \
+    cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+          -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
+          -DCMAKE_BUILD_TYPE=Debug \
+          -DGSETTINGS_LOCALCOMPILE=OFF \
+          ..
+
+make -C %{_builddir}/ring-project/client-gnome/build \
+    LDFLAGS="-lpthread" %{_smp_mflags} V=1
+
+%install
+DESTDIR=%{buildroot} make -C %{_builddir}/ring-project/client-gnome/build install
+# Only keep /bin/jami-gnome for the GNOME client.
+rm -rfv %{buildroot}/%{_bindir}/jami
+rm -rfv %{buildroot}/%{_bindir}/ring.cx
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/jami-gnome
+%{_datadir}/applications/jami-gnome.desktop
+%{_datadir}/glib-2.0/schemas/net.jami.Jami.gschema.xml
+%{_datadir}/icons/hicolor/scalable/apps/jami.svg
+%{_datadir}/jami-gnome
+%{_datadir}/locale/*
+%{_datadir}/metainfo/jami-gnome.appdata.xml
+%{_datadir}/sounds/jami-gnome
diff --git a/packaging/rules/fedora/jami-libclient.spec b/packaging/rules/fedora/jami-libclient.spec
new file mode 100644
index 00000000..929a9b8c
--- /dev/null
+++ b/packaging/rules/fedora/jami-libclient.spec
@@ -0,0 +1,69 @@
+%define name        jami-libclient
+%define version     RELEASE_VERSION
+%define release     0
+
+Name:          %{name}
+Version:       %{version}
+Release:       %{release}%{?dist}
+Summary:       Client library for Jami
+Group:         Applications/Internet
+License:       GPLv3+
+Vendor:        Savoir-faire Linux
+URL:           https://jami.net/
+Source:        jami_%{version}.tar.gz
+Requires:      jami-daemon = %{version}
+
+# Build dependencies
+BuildRequires: NetworkManager-libnm-devel
+BuildRequires: cmake
+BuildRequires: gcc-c++
+BuildRequires: jami-daemon-devel = %{version}
+BuildRequires: make
+BuildRequires: qt5-qtbase-devel
+BuildRequires: qt5-qttools-devel
+
+%description
+This package contains the client library of Jami, a free software for
+universal communication which respects freedoms and privacy of its
+users.
+
+%prep
+%setup -n ring-project
+
+%build
+cd %{_builddir}/ring-project/lrc && \
+    mkdir build && cd build && \
+    cmake -DRING_BUILD_DIR=%{_builddir}/ring-project/daemon/src \
+          -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+          -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
+          -DCMAKE_BUILD_TYPE=Debug \
+          ..
+
+make -C %{_builddir}/ring-project/lrc/build %{_smp_mflags} V=1
+
+%install
+DESTDIR=%{buildroot} make -C lrc/build install
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/libringclient.so.1.0.0
+%{_datadir}/libringclient
+
+%package devel
+Summary: Development files of the Jami client library
+
+%description devel
+This package contains the header files and the unversioned shared
+library for developing with the Jami client library.
+
+%files devel
+%{_includedir}/libringclient
+%{_libdir}/cmake/LibRingClient
+# The following is a symbolic link.
+%{_libdir}/libringclient.so
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
diff --git a/packaging/rules/fedora/jami-one-click.spec b/packaging/rules/fedora/jami-one-click.spec
deleted file mode 100644
index c29286b0..00000000
--- a/packaging/rules/fedora/jami-one-click.spec
+++ /dev/null
@@ -1,229 +0,0 @@
-%define name        jami-all
-%define version     RELEASE_VERSION
-%define release     0
-%define postinst    jami-all.postinst
-
-Name:          %{name}
-Version:       %{version}
-Release:       %{release}%{?dist}
-Summary:       Free software for distributed and secured communication.
-Group:         Applications/Internet
-License:       GPLv3+
-URL:           https://jami.net/
-Source:        jami_%{version}.tar.gz
-#Requires:      jami-daemon = %{version}
-Obsoletes:     ring ring-daemon
-Provides:      ring
-Conflicts:     ring ring-daemon
-
-BuildRequires: make
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: cmake
-BuildRequires: pulseaudio-libs-devel
-BuildRequires: libcanberra-devel
-BuildRequires: libtool
-BuildRequires: dbus-devel
-BuildRequires: expat-devel
-BuildRequires: pcre-devel
-BuildRequires: yaml-cpp-devel
-BuildRequires: boost-devel
-BuildRequires: dbus-c++-devel
-BuildRequires: dbus-devel
-BuildRequires: libXext-devel
-BuildRequires: yasm
-BuildRequires: speex-devel
-BuildRequires: chrpath
-BuildRequires: check
-BuildRequires: astyle
-BuildRequires: uuid-c++-devel
-BuildRequires: gettext-devel
-BuildRequires: gcc-c++
-BuildRequires: which
-BuildRequires: alsa-lib-devel
-BuildRequires: systemd-devel
-BuildRequires: libuuid-devel
-BuildRequires: libXfixes-devel
-BuildRequires: uuid-devel
-BuildRequires: gnutls-devel
-BuildRequires: nettle-devel
-BuildRequires: opus-devel
-BuildRequires: jsoncpp-devel
-BuildRequires: libnatpmp-devel
-BuildRequires: gsm-devel
-BuildRequires: libupnp-devel
-BuildRequires: gcc-c++
-BuildRequires: qt5-qtbase-devel
-BuildRequires: gnome-icon-theme-symbolic
-BuildRequires: clutter-gtk-devel
-BuildRequires: clutter-devel
-BuildRequires: glib2-devel
-BuildRequires: gtk3-devel
-BuildRequires: libnotify-devel
-BuildRequires: qt5-qttools-devel
-BuildRequires: qrencode-devel
-BuildRequires: libappindicator-gtk3-devel
-BuildRequires: NetworkManager-libnm-devel
-BuildRequires: libva-devel
-BuildRequires: webkitgtk4-devel
-BuildRequires: cryptopp-devel
-
-
-%description
-Jami is free software for universal communication which respects freedoms
-and privacy of its users.
-.
-This package contains the desktop client: jami-gnome.
-
-%prep
-%setup -n ring-project
-
-%build
-###########################
-## Ring Daemon configure ##
-###########################
-mkdir -p daemon/contrib/native
-cd %{_builddir}/ring-project/daemon/contrib/native && \
-    ../bootstrap \
-        --no-checksums \
-        --disable-ogg \
-        --disable-flac \
-        --disable-vorbis \
-        --disable-vorbisenc \
-        --disable-speex \
-        --disable-sndfile \
-        --disable-gsm \
-        --disable-speexdsp \
-        --disable-natpmp && \
-    make list && \
-    make fetch && \
-    make -j4 V=1 && \
-    make -j4 V=1 .ffmpeg
-
-cd %{_builddir}/ring-project/daemon && \
-    ./autogen.sh && \
-    ./configure \
-        --prefix=%{_prefix} \
-        --libdir=%{_libdir} \
-        --disable-shared
-
-#############################
-## libringclient configure ##
-#############################
-cd %{_builddir}/ring-project/lrc && \
-    mkdir build && \
-    cd build && \
-    cmake \
-        -DRING_BUILD_DIR=%{_builddir}/ring-project/daemon/src \
-        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-        -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
-        -DCMAKE_BUILD_TYPE=Debug \
-        ..
-
-############################
-## gnome client configure ##
-############################
-cd %{_builddir}/ring-project/client-gnome && \
-    mkdir build && \
-    cd build && \
-    cmake \
-        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-        -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
-        -DLibRingClient_PROJECT_DIR=%{_builddir}/ring-project/lrc \
-        -DGSETTINGS_LOCALCOMPILE=OFF \
-        ..
-
-#######################
-## Ring Daemon build ##
-#######################
-make -C %{_builddir}/ring-project/daemon -j4 V=1
-pod2man %{_builddir}/ring-project/daemon/man/dring.pod > %{_builddir}/ring-project/daemon/dring.1
-
-#########################
-## libringclient build ##
-#########################
-make -C %{_builddir}/ring-project/lrc/build -j4 V=1
-
-########################
-## gnome client build ##
-########################
-make -C %{_builddir}/ring-project/client-gnome/build LDFLAGS="-lpthread" -j4 V=1
-
-
-%install
-#########################
-## Ring Daemon install ##
-#########################
-DESTDIR=%{buildroot} make -C daemon install
-cp %{_builddir}/ring-project/daemon/dring.1 %{buildroot}/%{_mandir}/man1/dring.1
-rm -rfv %{buildroot}/%{_prefix}/include
-rm -rfv %{buildroot}/%{_libdir}/*.a
-rm -rfv %{buildroot}/%{_libdir}/*.la
-
-###########################
-## libringclient install ##
-###########################
-DESTDIR=%{buildroot} make -C lrc/build install
-rm -rfv %{buildroot}/%{_prefix}/include
-
-# This is a symlink, should be in -dev package
-rm -v %{buildroot}/%{_libdir}/libringclient.so
-
-# cmake files
-rm -rfv %{buildroot}/%{_libdir}/cmake
-
-##########################
-## gnome client install ##
-##########################
-DESTDIR=%{buildroot} make -C client-gnome/build install
-ln -sf %{_bindir}/jami %{buildroot}/%{_bindir}/ring.cx
-
-##########################
-## post install script  ##
-##########################
-#mkdir -p %{buildroot}/opt/repo-package/
-cp %{_builddir}/ring-project/packaging/rules/fedora/%{postinst} %{buildroot}/%{_bindir}
-chmod a+x %{buildroot}/%{_bindir}/%{postinst}
-
-%files
-%defattr(-,root,root,-)
-%{_bindir}/jami
-%{_bindir}/ring.cx
-%{_bindir}/jami-gnome
-%{_libdir}/libringclient*.so*
-%{_datadir}/glib-2.0/schemas/net.jami.Jami.gschema.xml
-%{_datadir}/applications/jami-gnome.desktop
-%{_datadir}/jami-gnome/jami-gnome.desktop
-%{_datadir}/icons/hicolor/scalable/apps/jami.svg
-%{_datadir}/metainfo/jami-gnome.appdata.xml
-%{_datadir}/libringclient/*
-%{_datadir}/locale/*
-%{_datadir}/sounds/jami-gnome/*
-%doc %{_mandir}/man1/dring*
-%{_libdir}/ring/dring
-%{_datadir}/ring/ringtones
-%{_datadir}/dbus-1/services/*
-%{_datadir}/dbus-1/interfaces/
-%{_bindir}/%{postinst}
-
-
-%post
-/sbin/ldconfig
-/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
-if [ $1 == 1 ];then
-   %{_bindir}/%{postinst}
-fi
-
-%postun
-/sbin/ldconfig
-
-if [ $1 -eq 0 ] ; then
-    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
-    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-fi
-
-%posttrans
-
-/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-
-%changelog
diff --git a/packaging/rules/fedora/jami.spec b/packaging/rules/fedora/jami.spec
deleted file mode 100644
index 2a35dcf9..00000000
--- a/packaging/rules/fedora/jami.spec
+++ /dev/null
@@ -1,280 +0,0 @@
-%define name        jami
-%define version     RELEASE_VERSION
-%define release     0
-
-Name:          %{name}
-Version:       %{version}
-Release:       %{release}%{?dist}
-Summary:       Free software for distributed and secured communication.
-Group:         Applications/Internet
-License:       GPLv3+
-URL:           https://jami.net/
-Source:        jami_%{version}.tar.gz
-Requires:      jami-daemon = %{version}
-Obsoletes:     ring ring-daemon
-Provides:      ring
-Conflicts:     ring ring-daemon
-
-BuildRequires: make
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: cmake
-BuildRequires: pulseaudio-libs-devel
-BuildRequires: libcanberra-devel
-BuildRequires: libtool
-BuildRequires: dbus-devel
-BuildRequires: expat-devel
-BuildRequires: pcre-devel
-BuildRequires: yaml-cpp-devel
-BuildRequires: boost-devel
-BuildRequires: dbus-c++-devel
-BuildRequires: dbus-devel
-BuildRequires: libXext-devel
-BuildRequires: yasm
-BuildRequires: speex-devel
-BuildRequires: chrpath
-BuildRequires: check
-BuildRequires: astyle
-BuildRequires: uuid-c++-devel
-BuildRequires: gettext-devel
-BuildRequires: gcc-c++
-BuildRequires: which
-BuildRequires: alsa-lib-devel
-BuildRequires: systemd-devel
-BuildRequires: libuuid-devel
-BuildRequires: libXfixes-devel
-BuildRequires: uuid-devel
-BuildRequires: gnutls-devel
-BuildRequires: nettle-devel
-BuildRequires: opus-devel
-BuildRequires: jsoncpp-devel
-BuildRequires: libnatpmp-devel
-BuildRequires: gsm-devel
-BuildRequires: libupnp-devel
-BuildRequires: gcc-c++
-BuildRequires: qt5-qtbase-devel
-BuildRequires: gnome-icon-theme-symbolic
-BuildRequires: clutter-gtk-devel
-BuildRequires: clutter-devel
-BuildRequires: glib2-devel
-BuildRequires: gtk3-devel
-BuildRequires: libnotify-devel
-BuildRequires: qt5-qttools-devel
-BuildRequires: qrencode-devel
-BuildRequires: libappindicator-gtk3-devel
-BuildRequires: NetworkManager-libnm-devel
-BuildRequires: libva-devel
-BuildRequires: webkitgtk4-devel
-BuildRequires: cryptopp-devel
-BuildRequires: libvdpau-devel
-
-%description
-Jami is free software for universal communication which respects freedoms
-and privacy of its users.
-.
-This package contains the desktop client: jami-gnome.
-
-%package daemon
-Summary: Free software for distributed and secured communication - daemon
-
-%description daemon
-Jami is free software for universal communication which respects freedoms
-and privacy of its users.
-.
-This package contains the Jami daemon: dring.
-
-
-%package all
-Summary: Free software for distributed and secured communication - daemon
-
-%description all
-Jami is free software for universal communication which respects freedoms
-and privacy of its users.
-
-
-%prep
-%setup -n ring-project
-
-%build
-###########################
-## Ring Daemon configure ##
-###########################
-mkdir -p daemon/contrib/native
-cd %{_builddir}/ring-project/daemon/contrib/native && \
-    ../bootstrap \
-        --no-checksums \
-        --disable-ogg \
-        --disable-flac \
-        --disable-vorbis \
-        --disable-vorbisenc \
-        --disable-speex \
-        --disable-sndfile \
-        --disable-gsm \
-        --disable-speexdsp \
-        --disable-natpmp && \
-    make list && \
-    make fetch && \
-    make -j4 V=1 && \
-    make -j4 V=1 .ffmpeg
-
-cd %{_builddir}/ring-project/daemon && \
-    ./autogen.sh && \
-    ./configure \
-        --prefix=%{_prefix} \
-        --libdir=%{_libdir} \
-        --disable-shared
-
-#############################
-## libringclient configure ##
-#############################
-cd %{_builddir}/ring-project/lrc && \
-    mkdir build && \
-    cd build && \
-    cmake \
-        -DRING_BUILD_DIR=%{_builddir}/ring-project/daemon/src \
-        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-        -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
-        -DCMAKE_BUILD_TYPE=Debug \
-        ..
-
-############################
-## gnome client configure ##
-############################
-cd %{_builddir}/ring-project/client-gnome && \
-    mkdir build && \
-    cd build && \
-    cmake \
-        -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-        -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
-        -DLibRingClient_PROJECT_DIR=%{_builddir}/ring-project/lrc \
-        -DGSETTINGS_LOCALCOMPILE=OFF \
-        ..
-
-#######################
-## Ring Daemon build ##
-#######################
-make -C %{_builddir}/ring-project/daemon -j4 V=1
-pod2man %{_builddir}/ring-project/daemon/man/dring.pod > %{_builddir}/ring-project/daemon/dring.1
-
-#########################
-## libringclient build ##
-#########################
-make -C %{_builddir}/ring-project/lrc/build -j4 V=1
-
-########################
-## gnome client build ##
-########################
-make -C %{_builddir}/ring-project/client-gnome/build LDFLAGS="-lpthread" -j4 V=1
-
-
-%install
-#########################
-## Ring Daemon install ##
-#########################
-DESTDIR=%{buildroot} make -C daemon install
-cp %{_builddir}/ring-project/daemon/dring.1 %{buildroot}/%{_mandir}/man1/dring.1
-rm -rfv %{buildroot}/%{_prefix}/include
-rm -rfv %{buildroot}/%{_libdir}/*.a
-rm -rfv %{buildroot}/%{_libdir}/*.la
-
-###########################
-## libringclient install ##
-###########################
-DESTDIR=%{buildroot} make -C lrc/build install
-rm -rfv %{buildroot}/%{_prefix}/include
-
-# This is a symlink, should be in -dev package
-rm -v %{buildroot}/%{_libdir}/libringclient.so
-
-# cmake files
-rm -rfv %{buildroot}/%{_libdir}/cmake
-
-##########################
-## gnome client install ##
-##########################
-DESTDIR=%{buildroot} make -C client-gnome/build install
-ln -sf %{_bindir}/jami %{buildroot}/%{_bindir}/ring.cx
-
-%files
-%defattr(-,root,root,-)
-%{_bindir}/jami
-%{_bindir}/ring.cx
-%{_bindir}/jami-gnome
-%{_libdir}/libringclient*.so*
-%{_datadir}/glib-2.0/schemas/net.jami.Jami.gschema.xml
-%{_datadir}/applications/jami-gnome.desktop
-%{_datadir}/jami-gnome/jami-gnome.desktop
-%{_datadir}/icons/hicolor/scalable/apps/jami.svg
-%{_datadir}/metainfo/jami-gnome.appdata.xml
-%{_datadir}/libringclient/*
-%{_datadir}/locale/*
-%{_datadir}/sounds/jami-gnome/*
-%doc %{_mandir}/man1/dring*
-
-%files daemon
-%defattr(-,root,root,-)
-%{_libdir}/ring/dring
-%{_datadir}/ring/ringtones
-%{_datadir}/dbus-1/services/*
-%{_datadir}/dbus-1/interfaces/*
-
-%files all
-%defattr(-,root,root,-)
-%{_bindir}/jami
-%{_bindir}/ring.cx
-%{_bindir}/jami-gnome
-%{_libdir}/libringclient*.so*
-%{_datadir}/glib-2.0/schemas/net.jami.Jami.gschema.xml
-%{_datadir}/applications/jami-gnome.desktop
-%{_datadir}/jami-gnome/jami-gnome.desktop
-%{_datadir}/icons/hicolor/scalable/apps/jami.svg
-%{_datadir}/metainfo/jami-gnome.appdata.xml
-%{_datadir}/libringclient/*
-%{_datadir}/locale/*
-%{_datadir}/sounds/jami-gnome/*
-%doc %{_mandir}/man1/dring*
-%{_libdir}/ring/dring
-%{_datadir}/ring/ringtones
-%{_datadir}/dbus-1/services/*
-%{_datadir}/dbus-1/interfaces/*
-
-
-%post
-/sbin/ldconfig
-/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
-
-
-%post all
-/sbin/ldconfig
-/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
-
-
-%postun
-/sbin/ldconfig
-
-if [ $1 -eq 0 ] ; then
-    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
-    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-fi
-
-
-%postun all
-
-/sbin/ldconfig
-if [ $1 -eq 0 ] ; then
-    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
-    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-fi
-
-
-%posttrans
-
-/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-
-
-%posttrans all
-
-/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
-
-
-%changelog
diff --git a/scripts/build-package-fedora.sh b/scripts/build-package-fedora.sh
index 0bd0430c..17cb3c90 100755
--- a/scripts/build-package-fedora.sh
+++ b/scripts/build-package-fedora.sh
@@ -1,8 +1,9 @@
 #!/usr/bin/env bash
 #
-# Copyright (C) 2016-2019 Savoir-faire Linux Inc.
+# Copyright (C) 2016-2021 Savoir-faire Linux Inc.
 #
 # Author: Alexandre Viau <alexandre.viau@savoirfairelinux.com>
+# Author: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,55 +24,41 @@
 
 set -e
 
-# import the spec file
+# Import the spec file.
 mkdir -p /opt/ring-project
 cd /opt/ring-project
 cp /opt/ring-project-ro/packaging/rules/fedora/* .
 
-#create tree for build
+# Prepare the build tree.
 rpmdev-setuptree
 
-# place the source
+# Copy the source tarball.
 cp /opt/ring-project-ro/jami_*.tar.gz /root/rpmbuild/SOURCES
 
-# Set the version
+# Set the version and associated comment.
 sed -i "s/RELEASE_VERSION/${RELEASE_VERSION}/g" *.spec
-if [ ${DISTRIBUTION} == "fedora_32" ] || [ ${DISTRIBUTION} == "fedora_33" ] || [ ${DISTRIBUTION} == "fedora_34" ]; then
-    # Remove Obsoletes for Fedora 32, as we don't publish "ring"
-    sed -i '/^Obsoletes:/d' *.spec
-    sed -i '/^Provides:/d' *.spec
-    sed -i '/^Conflicts:/d' *.spec
-    # gnome-icon-theme-symbolic is removed from Fedora, but icons are well integrated
-    sed -i '/gnome-icon-theme-symbolic/d' *.spec
-fi
+rpmdev-bumpspec --comment="Automatic nightly release" \
+                --userstring="Jenkins <jami@lists.savoirfairelinux.net>" *.spec
 
-rpmdev-bumpspec --comment="Automatic nightly release" --userstring="Jenkins <ring@lists.savoirfairelinux.net>" jami.spec
-rpmdev-bumpspec --comment="Automatic nightly release" --userstring="Jenkins <ring@lists.savoirfairelinux.net>" jami-one-click.spec
+# TODO: We could use mock to build Fedora/RHEL packages in minimal
+# chroots matching the environment defined in the spec files.  It also
+# has a --chain option to chain the build of dependent packages.
 
+# Build the daemon and install it.
+rpmbuild -ba jami-daemon.spec
+rpm --install /root/rpmbuild/RPMS/x86_64/jami-daemon-*
 
-# install build deps
-dnf builddep -y jami.spec || echo "ignoring dnf builddep failure"
+# Build the client library and install it.
+rpmbuild -ba jami-libclient.spec
+rpm --install /root/rpmbuild/RPMS/x86_64/jami-libclient-*
 
-# build the package
-QA_RPATHS=$(( 0x0001|0x0010 )) rpmbuild -ba jami.spec
+# Build the GNOME client.
+rpmbuild -ba jami-gnome.spec
 
-# move to output
+# Move the built packages to the output directory.
 mv /root/rpmbuild/RPMS/*/* /opt/output
 touch /opt/output/.packages-built
 chown -R ${CURRENT_UID}:${CURRENT_UID} /opt/output
 
-## JAMI ONE CLICK INSTALL RPM
-
-#copy script jami-all.postinst which add repo
-mkdir -p /root/rpmbuild/BUILD/ring-project/packaging/rules/one-click-install/
-cp jami-all.postinst  /root/rpmbuild/BUILD/ring-project/packaging/rules/one-click-install/
-
-# build the package
-QA_RPATHS=$(( 0x0001|0x0010 )) rpmbuild -ba jami-one-click.spec
-
-# move to output
-mkdir -p /opt/output/one-click-install
-mv /root/rpmbuild/RPMS/*/* /opt/output/one-click-install
-touch /opt/output/one-click-install/.packages-built
-chown -R ${CURRENT_UID}:${CURRENT_UID} /opt/output/one-click-install
-
+# TODO: One click install: create a package that combines the already
+# built package into one.
-- 
GitLab