Name: datovka
Version: 4.22.0
Release: 1
Summary: A free graphical interface for Czech Databox (Datové schránky)

License: GPLv3+ with exceptions
URL: https://www.datovka.cz/
Source0: https://secure.nic.cz/files/datove_schranky/%{version}/datovka-%{version}.tar.xz
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qttools-devel
BuildRequires: openssl-devel
BuildRequires: qt5-linguist
BuildRequires: qt5-qtsvg-devel
BuildRequires: qt5-qtwebsockets-devel
BuildRequires: desktop-file-utils
BuildRequires: libdatovka-devel
BuildRequires: make
# https://gitlab.nic.cz/datovka/datovka/-/issues/541
Patch0:        datovka-4.19.0-s390x-disable-failing-test.patch

%description
GUI application allowing access to Czech Databox - an electronic communication
interface endorsed by the Czech government.

%prep
%autosetup -p1

# drop failing tests (upstream notified)
pushd tests
rm -f test_crypto_message.pri test_isds_message.pri
popd

%build
lrelease-qt5 datovka.pro
%{qmake_qt5} PREFIX=%{_prefix} DISABLE_VERSION_CHECK_BY_DEFAULT=1
%make_build

%install
mkdir -p %{buildroot}%{_bindir}
%make_install INSTALL_ROOT=%{buildroot}
%find_lang %{name} --with-qt
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop

%check
cd tests
%{qmake_qt5} tests.pro PREFIX=%{_prefix}
%make_build
./tests

%files -f %{name}.lang
%doc %{_pkgdocdir}
%{_bindir}/datovka
%{_datadir}/applications/datovka.desktop
%{_datadir}/icons/hicolor/*/apps/datovka.png
%{_datadir}/metainfo/datovka.metainfo.xml

%changelog
* Fri May 26 2023 wangtaozhi <wangtaozhi@kylinsec.com.cn> - 4.22.0-1
- Package init
