Name:           kylin-weather
Version:        3.1.2
Release:        6
Summary:        Indicator that displays China weather information
License:        GPL-3.0+
URL:            https://gitee.com/openkylin/kylin-weather
Source0:        %{name}-%{version}.tar.gz
Patch01:        0001-fix-compile-error-of-kylin-weather.patch
Patch02:        0001-fix-coredump-of-kylin-weather.patch
Patch03:	0001-use-QRandomGenerator-and-fix-code-error.patch
Patch04:	0001-use-reference-when-appropriate.patch
Patch05:	0001-fix-wrong-date-on-third-day-of-weekly-weather.patch

BuildRequires:  qt5-qtbase-devel
BuildRequires:  qtchooser
BuildRequires:  qt5-qtscript-devel
BuildRequires:  qt5-qttools-devel
BuildRequires:  pkgconf
BuildRequires:  GeoIP-devel
BuildRequires:  libX11-devel
BuildRequires:  gsettings-qt-devel
BuildRequires:  qt5-qtx11extras-devel
BuildRequires:  kf5-kwindowsystem-devel
BuildRequires:  ukui-interface


%description
Kylin Weather displays detail weather information for one place,
including weather forecast and observe weather, and you can
change it.

%prep
%setup -q
%patch 1 -p1
%patch 2 -p1
%patch 3 -p1
%patch 4 -p1
%patch 5 -p1

%build
mkdir build && pushd build
%{qmake_qt5} ..
%{make_build}
popd


%install
pushd build
rm -rf $RPM_BUILD_ROOT
make INSTALL_ROOT=%{buildroot} install
popd

%clean
rm -rf $RPM_BUILD_ROOT

%post
glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/null ||:
indicatorPath="/etc/xdg/autostart/indicator-china-weather.desktop"
if [ ! -d "$indicatorPath" ]; then
    rm -f "$indicatorPath"
fi

%files
%{_sysconfdir}/xdg/autostart/kylin-weather.desktop
%{_bindir}/kylin-weather
%{_datadir}/applications/kylin-weather.desktop
%{_datadir}/glib-2.0/schemas/org.kylin.weather.gschema.xml
%{_datadir}/glib-2.0/schemas/org.ukui.log4qt.kylin-weather.gschema.xml
%{_datadir}/kylin-weather/translations/kylin-weather_zh_CN.qm
%{_datadir}/kylin-user-guide/*

%changelog
* Wed May 08 2024 houhongxun <houhongxun@kylinos.cn> - 3.1.2-6
- fix wrong date on third day of weekly weather

* Wed May 08 2024 houhongxun <houhongxun@kylinos.cn> - 3.1.2-5
- use reference when appropriate

* Mon May 06 2024 houhongxun <houhongxun@kylinos.cn> - 3.1.2-4
- use QRandomGenerator to generate random numbers
- fix some code errors

* Sat Nov 25 2023 hua_yadong <huayadong@kylinos.cn> - 3.1.2-3
- add 0001-fix-coredump-of-kylin-weather.patch

* Tue May 30 2023 peijiankang <peijiankang@kylinos.cn> - 3.1.2-2
- fix install warining

* Mon Jan 30 2023 peijiankang <peijiankang@kylinos.cn> - 3.1.2-1
- Init Package for openEuler

