%define debug_package %{nil}

Name:           ukui-session-manager
Version:        3.0.2
Release:        8
Summary:    Session manager of the UKUI desktop environment
License:         LGPL-2.1+ GPL-3+
URL:            http://www.ukui.org
Source0:        %{name}-%{version}.tar.gz

BuildRequires:  cmake,libXtst-devel,libX11-devel,xdg-user-dirs,kf5-kidletime-devel,qt5-qtx11extras-devel,qt5-qtbase-devel,systemd-devel,qt5-qttools-devel,qt5-qtmultimedia-devel,gsettings-qt-devel,pkgconf
Requires: ukui-themes
Requires: glib2
Requires: qt5-qtmultimedia

Recommends: peony
Recommends: ukwm
Recommends: ukui-panel
Recommends: ukui-polkit
Recommends: ukui-screensaver
Recommends: ukui-settings-daemon

Provides: x-session-manager

patch0: 0001-fix-poweroff.patch
patch1: 0002-reset-changelog-and-format.patch
patch2: 0003-adjust-the-sequence-to-make-translation-file-loaded-first.patch
patch3: 0004-add-startlogout-signal.patch
patch4: 0005-update-debian-changelog.patch
patch5: 0006-ukui-session-session-application.patch

%description
 This package contains a session that can be started from a display
 manager such as lightdm. It will load all necessary applications for
 a full-featured user session.
 This package contain the session manager component.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

%build
mkdir cmake-build
pushd cmake-build
%cmake3 ..
%{make_build}
popd

%install
pushd cmake-build
%make_install INSTALL_ROOT=%{buildroot}
popd
#mkdir -p %{buildroot}/etc/X11/Xsession.d/    %{buildroot}/usr/share/man/man1/
#install -m644  debian/99ukui-environment %{buildroot}/etc/X11/Xsession.d/99ukui-environment
install -d   %{buildroot}/usr/share/man/man1/ %{buildroot}/etc/polkit-1/localauthority/50-local.d/
install -m644 data/com.ubuntu.enable-hibernate.pkla %{buildroot}/etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
gzip -c man/ukui-session.1 >  %{buildroot}/usr/share/man/man1/ukui-session.1.gz
gzip -c man/ukui-session-tools.1 > %{buildroot}/usr/share/man/man1/ukui-session-tools.1.gz

%clean
rm -rf $RPM_BUILD_ROOT

%files
%doc debian/changelog debian/copyright
#%%{_sysconfdir}/X11/Xsession.d/99ukui-environment
%{_sysconfdir}/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
%{_datadir}/*
%{_prefix}/bin/ukui-session
%{_prefix}/bin/ukui-session-tools
#%%{_datadir}/man/man1/ukui-session.1.gz
#%%{_datadir}/man/man1/ukui-session-tools.1.gz

%changelog
* Wed Apr 06 2022 tanyulong <tanyulong@kylinos.cn> - 3.0.2-8
- add yaml file 

* Tue Dec 07 2021 tanyulong <tanyulong@kylinos.cn> - 3.0.2-7
- add patch: 0006-ukui-session-session-application.patch

* Thu Dec 02 2021 tanyulong <tanyulong@kylinos.cn> - 3.0.2-6
- update debian changelog

* Thu Nov 11  2021 tanyulong <tanyulong@kylinos.cn> - 3.0.2-5
- add startlogout signal

* Mon Nov 1  2021 tanyulong <tanyulong@kylinos.cn> - 3.0.2-4
- adjust the sequence to make translation file loaded first

* Thu Oct 28 2021 tanyulong <tanyulong@kylinos.cn> - 3.0.2-3
- reset changelog and format

* Thu Dec 3 2020 lvhan <lvhan@kylinos.cn> - 3.0.2-2
- fix poweroff

* Mon Oct 26 2020 douyan <douyan@kylinos.cn> - 3.0.2-1
- update to upstream version 3.0.1

* Thu Jul 9 2020 douyan <douyan@kylinos.cn> - 2.0.2-1
- Init package for openEuler
