File syncthingtray.spec of Package syncthingtray
#
# spec file for package syncthingtray
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018-2021 Martchus
#
# 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 libver 13
# disable web view under PowerPC and s390x (Qt WebEngine not available)
%ifnarch ppc ppc64 ppc64le s390x
%define webview_provider webengine
%else
%define webview_provider none
%endif
# define _libqt5_plugindir macro for Fedora
%if 0%{?fedora_version}
%define _libqt5_plugindir %{_libdir}/qt5/plugins
%endif
# avoid dependency to qt5qmlimport(martchus.syncthingplasmoid.0) >= 6
%global __requires_exclude (martchus.syncthingplasmoid.0)
%global __provides_exclude (martchus.syncthingplasmoid.0)
Name: syncthingtray
Version: 1.4.11
Release: 0
Summary: Tray application for Syncthing
License: GPL-2.0+
Group: System/Packages
Url: https://github.com/Martchus/%{name}
Source: %{name}-%{version}.tar.xz
BuildRequires: cmake >= 3.9
%if 0%{?fedora}
%else
BuildRequires: ninja
%endif
BuildRequires: cppunit-devel >= 1.14.0
%if 0%{?sle_version} && 0%{?sle_version} < 160000
BuildRequires: gcc9-c++
%else
BuildRequires: gcc-c++
%endif
BuildRequires: c++utilities-devel
%if 0%{?fedora}
BuildRequires: boost-devel > 1.75
%else
%if 0%{?sle_version} && 0%{?sle_version} < 160000
BuildRequires: libboost_headers1_75_0-devel
BuildRequires: libboost_filesystem1_75_0-devel
BuildRequires: libboost_system1_75_0-devel
%else
BuildRequires: boost-devel > 1.75
BuildRequires: libboost_filesystem-devel > 1.75
%endif
%endif
BuildRequires: extra-cmake-modules
%if 0%{?fedora_version}
BuildRequires: kf5-kio-devel
BuildRequires: kf5-plasma-devel
BuildRequires: qt5-qtbase-devel >= 5.8.0
BuildRequires: qt5-qtdeclarative-devel >= 5.8.0
BuildRequires: qt5-qtsvg-devel >= 5.8.0
BuildRequires: qt5-qttools-devel >= 5.8.0
%if "%{webview_provider}" == "webengine"
BuildRequires: qt5-qtwebengine-devel >= 5.8.0
%endif
%else
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
BuildRequires: libqt5-qtbase-devel >= 5.6.0
BuildRequires: libqt5-qtdeclarative-devel >= 5.6.0
BuildRequires: libqt5-qtsvg-devel >= 5.6.0
BuildRequires: libqt5-qttools-devel >= 5.6.0
%if "%{webview_provider}" == "webengine"
BuildRequires: libqt5-qtwebengine-devel >= 5.6.0
%endif
%else
BuildRequires: libqt5-qtbase-devel >= 5.8.0
BuildRequires: libqt5-qtdeclarative-devel >= 5.8.0
BuildRequires: libqt5-qtsvg-devel >= 5.8.0
BuildRequires: libqt5-qttools-devel >= 5.8.0
%if "%{webview_provider}" == "webengine"
BuildRequires: libqt5-qtwebengine-devel >= 5.8.0
%endif
BuildRequires: kio-devel
BuildRequires: plasma-framework-devel
%endif
BuildRequires: update-desktop-files
%endif
BuildRequires: syncthing
BuildRequires: pkgconfig
BuildRequires: qtutilities-devel
BuildRequires: qtforkawesome-devel
BuildRequires: qtquickforkawesome-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Qt5-based tray application for Syncthing
%package -n syncthingctl
Summary: Simple command line application to control Syncthing
Group: System/Packages
%description -n syncthingctl
Simple command line application to control Syncthing (part of Syncthing Tray)
%package -n syncthingplasmoid
Summary: Widget for Plasma 5 desktop to control Syncthing
Group: System/Packages
%if 0%{?fedora_version}
%else
%requires_ge libKF5Plasma5
%endif
%description -n syncthingplasmoid
Widget for Plasma 5 desktop to control Syncthing (part of Syncthing Tray)
%package -n libsyncthingconnector%{libver}
Summary: C++ library to access Syncthing
Group: System/Packages
Provides: libsyncthingconnector = %{version}
Obsoletes: libsyncthingconnector < %{version}
%description -n libsyncthingconnector%{libver}
C++ library to access Syncthing (backend library of Syncthing Tray)
%package -n syncthingconnector-devel
Summary: Devel files for libsyncthingconnector
Group: Development/Libraries/C and C++
Requires: c++utilities-devel
Requires: libsyncthingconnector%{libver} = %{version}
Requires: qtutilities-devel
%description -n syncthingconnector-devel
C++ library to access Syncthing (backend library of Syncthing Tray) - development files
%package -n libsyncthingmodel%{libver}
Summary: Qt5 models for Syncthing data
Group: System/Packages
Requires: qtforkawesomeiconengine
Provides: libsyncthingmodel = %{version}
Obsoletes: libsyncthingmodel < %{version}
%description -n libsyncthingmodel%{libver}
Qt models for Syncthing data (backend library of Syncthing Tray)
%package -n syncthingmodel-devel
Summary: Devel files for libsyncthingmodel
Group: Development/Libraries/C and C++
Requires: libsyncthingmodel%{libver} = %{version}
Requires: syncthingconnector-devel
%description -n syncthingmodel-devel
Qt models for Syncthing data (backend library of Syncthing Tray) - development files
%package -n libsyncthingwidgets%{libver}
Summary: Qt5 widgets for Syncthing tray
Group: System/Packages
Requires: qtforkawesomeiconengine
Provides: libsyncthingwidgets = %{version}
Obsoletes: libsyncthingwidgets < %{version}
%description -n libsyncthingwidgets%{libver}
Qt widgets for Syncthing tray (backend library of Syncthing Tray)
%package -n syncthingwidgets-devel
Summary: Devel files for libsyncthingmodel
Group: Development/Libraries/C and C++
Requires: libsyncthingwidgets%{libver} = %{version}
Requires: syncthingmodel-devel
%description -n syncthingwidgets-devel
Qt widgets for Syncthing tray (backend library of Syncthing Tray) - development files
%package -n syncthingfileitemaction
Summary: KIO file item action for Syncthing
Group: System/Packages
%description -n syncthingfileitemaction
KIO plugin to show Syncthing actions in Dolphin context menu
%prep
%setup -q -n %{name}-%{version}
%build
%if 0%{?sle_version} && 0%{?sle_version} < 160000
export CC=gcc-9
export CXX=g++-9
%endif
%if 0%{?fedora}
%else
%define __builder ninja
%endif
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%cmake \
-DQUICK_GUI:BOOL=NO \
-DBUILTIN_TRANSLATIONS:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DNO_PLASMOID:BOOL=ON \
-DNO_FILE_ITEM_ACTION_PLUGIN:BOOL=ON \
-DQT_PLUGIN_DIR=%{_libqt5_plugindir} \
-DWEBVIEW_PROVIDER:STRING=%{webview_provider} \
-DJS_PROVIDER:STRING=qml
%else
%cmake \
-DQUICK_GUI:BOOL=NO \
-DBUILTIN_TRANSLATIONS:BOOL=ON \
-DQT_PLUGIN_DIR=%{_libqt5_plugindir} \
-DWEBVIEW_PROVIDER:STRING=%{webview_provider} \
-DJS_PROVIDER:STRING=qml
%endif
%if 0%{?fedora} && 0%{?fedora_version} < 33
make %{?_smp_mflags}
%else
%cmake_build
%endif
%check
export QT_QPA_PLATFORM=offscreen
export SYNCTHING_TEST_TIMEOUT_FACTOR=10
export SYNCTHINGTRAY_WIZARD_SETUP_DETECTION_TIMEOUT=5000
%if 0%{?fedora}
%if 0%{?fedora_version} < 33
make %{?_smp_mflags} check
%else
export LD_LIBRARY_PATH="$PWD/%{__cmake_builddir}/connector:$PWD/%{__cmake_builddir}/testhelper:$LD_LIBRARY_PATH"
%cmake_build --target check
%endif
%else
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%else
%if (0%{?sle_version} == 150200 || 0%{?sle_version} == 150300) && 0%{?is_opensuse}
# FIXME: fix tests under Leap 15.2 which fail at some point with "1/2 Test #1: syncthingconnector_run_tests .....***Exception: SegFault 0.01 sec"
%else
cd "%{__builddir}"
export LD_LIBRARY_PATH="$PWD/connector:$PWD/testhelper:$LD_LIBRARY_PATH"
%cmake_build check
%endif
%endif
%endif
%install
%if 0%{?fedora} && 0%{?fedora_version} < 33
DESTDIR=%{buildroot} make %{?_smp_mflags} install
%else
%cmake_install
%if 0%{?fedora}
%else
%suse_update_desktop_file -r %{name} Network FileTransfer
%endif
%endif
# remove devel files for plugins
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%else
rm -r %{buildroot}/%{_libdir}/pkgconfig/syncthingfileitemaction.pc
rm -r %{buildroot}/%{_libdir}/pkgconfig/syncthingplasmoid.pc
rm -r %{buildroot}/%{_datadir}/syncthingfileitemaction
rm -r %{buildroot}/%{_datadir}/syncthingplasmoid
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post -n libsyncthingconnector%{libver} -p /sbin/ldconfig
%postun -n libsyncthingconnector%{libver} -p /sbin/ldconfig
%post -n libsyncthingmodel%{libver} -p /sbin/ldconfig
%postun -n libsyncthingmodel%{libver} -p /sbin/ldconfig
%post -n libsyncthingwidgets%{libver} -p /sbin/ldconfig
%postun -n libsyncthingwidgets%{libver} -p /sbin/ldconfig
%post -n syncthingctl -p /sbin/ldconfig
%postun -n syncthingctl -p /sbin/ldconfig
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%else
%post -n syncthingplasmoid -p /sbin/ldconfig
%postun -n syncthingplasmoid -p /sbin/ldconfig
%post -n syncthingfileitemaction -p /sbin/ldconfig
%postun -n syncthingfileitemaction -p /sbin/ldconfig
%endif
%files
%doc README.md
%{_bindir}/syncthingtray
%{_datadir}/applications/syncthingtray.desktop
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%else
%{_datadir}/metainfo/syncthingtray.appdata.xml
%endif
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%{_datadir}/icons/hicolor/scalable/apps/syncthingtray.svg
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/syncthingtray
%files -n syncthingctl
%{_bindir}/syncthingctl
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/syncthingctl
%files -n libsyncthingconnector%{libver}
%{_libdir}/libsyncthingconnector.so.*
%files -n syncthingconnector-devel
%{_includedir}/syncthingconnector
%{_libdir}/libsyncthingconnector.so
%{_libdir}/pkgconfig/syncthingconnector.pc
%dir %{_datadir}/syncthingconnector
%{_datadir}/syncthingconnector/cmake
%files -n libsyncthingmodel%{libver}
%{_libdir}/libsyncthingmodel.so.*
%files -n syncthingmodel-devel
%{_includedir}/syncthingmodel
%{_libdir}/libsyncthingmodel.so
%{_libdir}/pkgconfig/syncthingmodel.pc
%dir %{_datadir}/syncthingmodel
%{_datadir}/syncthingmodel/cmake
%files -n libsyncthingwidgets%{libver}
%{_libdir}/libsyncthingwidgets.so.*
%files -n syncthingwidgets-devel
%{_includedir}/syncthingwidgets
%{_libdir}/libsyncthingwidgets.so
%{_libdir}/pkgconfig/syncthingwidgets.pc
%dir %{_datadir}/syncthingwidgets
%{_datadir}/syncthingwidgets/cmake
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%else
%files -n syncthingfileitemaction
%dir %{_libqt5_plugindir}
%{_libqt5_plugindir}/libsyncthingfileitemaction.so
%dir %{_datadir}/kservices5
%{_datadir}/kservices5/syncthingfileitemaction.desktop
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%else
%{_datadir}/metainfo/syncthingfileitemaction.appdata.xml
%endif
%files -n syncthingplasmoid
%dir %{_libqt5_plugindir}/plasma/applets
%{_libqt5_plugindir}/plasma/applets/libsyncthingplasmoid.so
%dir %{_datadir}/kservices5
%{_datadir}/kservices5/plasma-applet-martchus.syncthingplasmoid.desktop
%if 0%{?sle_version} && 0%{?sle_version} <= 120400
%else
%{_datadir}/metainfo/syncthingplasmoid.appdata.xml
%endif
%dir %{_datadir}/plasma
%dir %{_datadir}/plasma/plasmoids
%dir %{_datadir}/plasma/plasmoids/martchus.syncthingplasmoid
%{_datadir}/plasma/plasmoids/martchus.syncthingplasmoid/*
%endif
%changelog