File qtox_enhanced.spec of Package qtox_enhanced

#
# spec file for package qtox_enhanced
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define realname qTox_enhanced

Name:           qtox_enhanced
Version:        1.17.6.028
Release:        0
Summary:        Tox client
License:        GPL-3.0-only
Group:          Productivity/Networking/Instant Messenger
URL:            https://github.com/Zoxcore/qTox_enhanced
#Source0:        https://github.com/Zoxcore/qTox_enhanced/archive/refs/tags/v%{version}.tar.gz
Source0:        qTox_enhanced-%{version}.tar.gz
#Source1:        https://github.com/toxext/toxext/archive/refs/tags/v0.0.3.tar.gz
Source1:        toxext-0.0.3.tar.gz
#Source2:        https://github.com/toxext/tox_extension_messages/archive/refs/tags/v0.0.3.tar.gz
Source2:        tox_extension_messages-0.0.3.tar.gz
Source3:        qtox_enhanced.keyring
BuildRequires:  cmake >= 2.8.11
BuildRequires:  fdupes
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  cmake(KF5Sonnet) >= 5.45
BuildRequires:  cmake(LibsnoreQt5) >= 0.7.0

BuildRequires:  gcc-c++
BuildRequires:  opencv-devel >= 2.4.9
BuildRequires:  opencv-qt5-devel
BuildRequires:  libQt5Sql5-sqlite
BuildRequires:  libqt5-qtbase-common-devel >= 5.5.0
BuildRequires:  pkgconfig(sqlite3)

%if 0%{?suse_version} > 1500
BuildRequires:  ffmpeg-devel >= 4.0.0, ffmpeg-devel < 5.0
%else
BuildRequires:  ffmpeg-devel
%endif
BuildRequires:  pkgconfig(libavformat) >= 58, pkgconfig(libavformat) < 59
BuildRequires:  pkgconfig(libavdevice) >= 58, pkgconfig(libavdevice) < 59
BuildRequires:  pkgconfig(libavutil) >= 56, pkgconfig(libavutil) < 57 
BuildRequires:  pkgconfig(libavfilter) >= 7, pkgconfig(libavfilter) < 8
BuildRequires:  pkgconfig(libavcodec) >= 58, pkgconfig(libavcodec) < 59
BuildRequires:  pkgconfig(libswscale) >= 5, pkgconfig(libswscale) < 6
BuildRequires:  pkgconfig(libswresample) >= 3, pkgconfig(libswresample) < 4

BuildRequires:  git
BuildRequires:  glib2-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  libqt5-linguist-devel
BuildRequires:  libqt5-qtbase-devel >= 5.5.0
BuildRequires:  snorenotify-qt5-devel
BuildRequires:  sonnet-devel
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5Core) >= 5.5.0
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Multimedia)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(Qt5Test)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  pkgconfig(filteraudio)
BuildRequires:  pkgconfig(gdk-pixbuf-2.0)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(libexif)
BuildRequires:  pkgconfig(libqrencode) >= 3.0.3
BuildRequires:  pkgconfig(libsodium)
BuildRequires:  pkgconfig(openal) >= 1.16.0
BuildRequires:  pkgconfig(opus)
BuildRequires:  pkgconfig(sqlcipher) >= 3.2.0
BuildRequires:  pkgconfig(toxcore) >= 0.2.19
BuildRequires:  pkgconfig(vpx)
BuildRequires:  pkgconfig(xscrnsaver) >= 1.2
BuildRequires:  pkgconfig(libcurl)

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Powerful Tox client that tries to follow the Tox UI mockup while running on all
major systems.

%prep
%setup -q -n qTox_enhanced-%{version}

%build
tar -xvzf %{SOURCE1}
tar -xvzf %{SOURCE2}

# qTox uses the toxext library and some of the extensions that go with it.
# https://github.com/qTox/qTox/blob/master/INSTALL.md#compile-extensions
CFLAGS="%{optflags} -Wno-error=parentheses"

pushd toxext-0.0.3
mkdir build
pushd build
# Note: See buildscirpts/download/download_toxext.sh for which version should be checked out
cmake -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_INSTALL_PREFIX=%{_prefix} ..
make -j$(nproc) PREFIX=%{_prefix}
make install PREFIX=%{_prefix} DESTDIR=%{buildroot}
popd
popd

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:%{buildroot}%{_prefix}/lib/cmake/ToxExt"

pushd tox_extension_messages-0.0.3
# Note: See buildscirpts/download/download_toxext_messages.sh for which version should be checked out
mkdir build
pushd build
cmake -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DToxExt_DIR="%{buildroot}%{_prefix}/lib/cmake/ToxExt" .. 
make -j$(nproc) PREFIX=%{_prefix}
make install PREFIX=%{_prefix} DESTDIR=%{buildroot}
popd
popd

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:%{buildroot}%{_prefix}/lib/cmake/ToxExtensionMessages"

mkdir build
pushd build
cmake -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DUPDATE_CHECK=False \
      -DToxExt_DIR="%{buildroot}%{_prefix}/lib/cmake/ToxExt" \
      -DToxExtensionMessages_DIR="%{buildroot}%{_prefix}/lib/cmake/ToxExtensionMessages" \
      .. 
make %{?_smp_mflags} PREFIX=%{_prefix}
popd

%install
make install -C build PREFIX=%{_prefix} DESTDIR=%{buildroot}
# remove non-standard dimensions
rm -rf %{buildroot}%{_datadir}/icons/hicolor/14x14
# decompress svgz to svg
cd %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
gzip -d < %{name}.svgz > %{name}.svg
rm %{name}.svgz
# fix desktop-file-name
mv %{buildroot}%{_datadir}/applications/io.github.qtox.qTox_enhanced.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop

%fdupes %{buildroot}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%license LICENSE
%doc README.md CHANGELOG.md
%{_bindir}/%{name}
%{_datadir}/metainfo
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%changelog
openSUSE Build Service is sponsored by