%define pkgrelease  2
%if 0%{?openeuler}
%define specrelease %{pkgrelease}
%else
## allow specrelease to have configurable %%{?dist} tag in other distribution
%define specrelease %{pkgrelease}%{?dist}
%endif

Name:           deepin-log-viewer
Version:        5.9.13
Release:        %{specrelease}
Summary:        Log Viewer is a useful tool for viewing system logs
License:        GPLv3+
URL:            https://github.com/linuxdeepin/%{name}
Source0:        %{name}-%{version}.tar.gz
Patch0:         0001-feat-round-master-function.patch
Patch1:		0001-fix-xorg-application-log-problem.patch
Patch2:	        0002-add-boot.log-file-judge.patch	

BuildRequires: qt5-devel
BuildRequires: gcc-c++
BuildRequires: cmake3
BuildRequires: dtkcore-devel
BuildRequires: dtkwidget-devel
BuildRequires: dtkgui-devel
BuildRequires: systemd-devel
BuildRequires: libicu-devel
BuildRequires: qt5-rpm-macros
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qttools-devel
BuildRequires: pkgconfig(dframeworkdbus)
BuildRequires: gtest-devel
BuildRequires: gmock-devel
BuildRequires: kf5-kcodecs-devel
BuildRequires: libzip-devel
BuildRequires: xerces-c-devel
BuildRequires: boost-devel
BuildRequires: minizip-devel
BuildRequires: rapidjson-devel
BuildRequires: libtool-ltdl-devel
BuildRequires: fftw-libs
BuildRequires: qt5-qtbase-private-devel
BuildRequires: dtkcommon-devel
BuildRequires: qt5-qtsvg-devel
BuildRequires: zlib-devel
BuildRequires: polkit-qt5-1-devel


%description
Log Viewer is a useful tool for viewing system logs.

%prep
%autosetup -p1


%build
export PATH=%{_qt5_bindir}:$PATH
sed -i "s|^cmake_minimum_required.*|cmake_minimum_required(VERSION 3.0)|" $(find . -name "CMakeLists.txt")
mkdir build && pushd build 
%cmake -DCMAKE_BUILD_TYPE=Release ../  -DAPP_VERSION=%{version} -DVERSION=%{version} 
%make_build  

popd

%install
%make_install -C build INSTALL_ROOT="%buildroot"
cp %buildroot/usr/lib/deepin-daemon/log-view-service  %buildroot/usr/bin/log-view-service

%files
%doc README.md
%license LICENSE.txt
%{_bindir}/%{name}
%{_bindir}/logViewerAuth
%{_bindir}/logViewerTruncate
%{_datadir}/applications/%{name}.desktop
%{_datadir}/%{name}/translations/*.qm
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/polkit-1/actions/*.policy
%{_datadir}/deepin-manual/manual-assets/application/deepin-log-viewer/log-viewer/*
/usr/bin/log-view-service
/usr/lib/deepin-daemon/log-view-service
/usr/share/dbus-1/system-services/com.deepin.logviewer.service
/usr/share/dbus-1/system.d/com.deepin.logviewer.conf
%{_datadir}/%{name}/DocxTemplate/*.dfw


%changelog
* Thu Sep 21 2023 hanshuang <hanshuang@uniontech.com> - 5.9.13-2
- fix xorg application log problem

* Wed Jul 26 2023 leeffo <liweiganga@uniontech.com> - 5.9.13-1
- upgrade to version 5.9.13

* Fri Mar 31 2023 liweiganga <liweiganga@uniontech.com> - 5.8.34-1
- update: update to 5.8.34

* Tue Jul 19 2022 konglidong <konglidong@uniontech.com> - 5.8.7-1
- update to 5.8.7

* Mon Feb 07 2022 liweigang <liweiganga@uniontech.com> - 5.8.0.23-2
- fix build error

* Mon Jul 12 2021 weidong <weidong@uniontech.com> - 5.8.0.23-1
- Update 5.8.0.23

* Fri Aug 28 2020 chenbo pan <panchenbo@uniontech.com> - 5.0.10-2
- fix compile fail

* Thu Jul 30 2020 openEuler Buildteam <buildteam@openeuler.org> - 5.6.1-1
- Package init
