%global debug_package %{nil}
%global PREFIX /usr/share/ukui-greeter
Name:           ukui-greeter
Version:        1.2.3
Release:        1
Summary:        Lightdm greeter for UKUI
License:        GPL-2.0
URL:            http://www.ukui.org
Source0:        ukui-greeter-%{version}.tar.gz

BuildRequires: pkgconf qt5-qtbase-devel qt5-qtx11extras-devel qt5-qtsvg-devel lightdm-qt5-devel libX11-devel libXtst-devel libXrandr-devel qt5-qttools-devel imlib2-devel
Requires: pkgconf qt5-qtbase-devel qt5-qtx11extras-devel qt5-qtsvg-devel lightdm-qt5-devel libX11-devel libXtst-devel libXrandr-devel qt5-qttools-devel imlib2-devel
Requires: lightdm
Requires: xorg-x11-server-utils
Requires: xorg-x11-server
Requires: xorg-x11-xauth
Requires: xorg-x11-xinit
Requires: xorg-x11-proto-devel
Requires: xorg-x11-drv-libinput
Requires: xorg-x11-xkb-utils

Provides: lightdm-greeter

%description
A greeter for UKUI desktop environment written by Qt5.
 The greeter supports biometric authentication which is
 provided by biometric-authentication service.
%prep
%setup -q

%build
qmake-qt5
make

%install

cd ukui-greeter/

mkdir -p $RPM_BUILD_ROOT%{PREFIX}/translations/ \
         $RPM_BUILD_ROOT%{PREFIX}/images/	\
         $RPM_BUILD_ROOT%{PREFIX}/images/badges/ \
         $RPM_BUILD_ROOT%{_datadir}/lightdm/lightdm.conf.d/ \
         $RPM_BUILD_ROOT%{_sysconfdir}/lightdm/	\
         $RPM_BUILD_ROOT%{_datadir}/xgreeters/	\
         $RPM_BUILD_ROOT%{_datadir}/man/man8/	\
         $RPM_BUILD_ROOT%{_sbindir}/ \
	 $RPM_BUILD_ROOT%{_libdir}/ukui-greeter

chmod 755 ukui-greeter.desktop

pwd 

cp translations/*.qm            $RPM_BUILD_ROOT%{PREFIX}/translations/
cp -r resource/*                $RPM_BUILD_ROOT%{PREFIX}/images/
#cp resource/badges/*.png       %{PREFIX}/images/badges/
cp 95-ukui-greeter.conf         $RPM_BUILD_ROOT%{_datadir}/lightdm/lightdm.conf.d/
cp ukui-greeter.conf            $RPM_BUILD_ROOT%{_sysconfdir}/lightdm/
cp ukui-greeter.desktop         $RPM_BUILD_ROOT%{_datadir}/xgreeters/
cp man/ukui-greeter.8	        $RPM_BUILD_ROOT%{_datadir}/man/man8/
cp ukui-greeter                 $RPM_BUILD_ROOT%{_sbindir}/
#cp ../GetBackground/greeter-get-background   $RPM_BUILD_ROOT%{_libdir}/ukui-greeter/
#cp ../GetDefaultDevice/greeter-get-device    $RPM_BUILD_ROOT%{_libdir}/ukui-greeter/

mkdir -p %{buildroot}/usr/share/doc/ukui-greeter/   %{buildroot}/usr/share/man/man8/
cp ../debian/copyright  %{buildroot}/usr/share/doc/ukui-greeter/
gzip  ../debian/changelog > %{buildroot}/usr/share/doc/ukui-greeter/changelog.gz
#gzip man/ukui-greeter.8 > %{buildroot}/usr/share/man/man8/ukui-greeter.8.gz

%postun

#chmod +s $RPM_BUILD_ROOT%{_libdir}/ukui-greeter/greeter-get-device
#chmod +s $RPM_BUILD_ROOT%{_libdir}/ukui-greeter/greeter-get-background

%clean
##[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%files

%{PREFIX}/translations/*
%{PREFIX}/images/*
%{_datadir}/lightdm/lightdm.conf.d/*
%{_sysconfdir}/lightdm/*
%{_datadir}/xgreeters/*
%{_datadir}/man/man8/*
%{_sbindir}/*
%{_libdir}/ukui-greeter/
%{_datadir}/doc/ukui-greeter/
%changelog

