%define kdeversion 4.4.0

Name:           kgrab
Summary:        A screen grabbing utility
Summary(ja):    スクリーンキャプチャユーティリティ
Version:        0.1.1
Release:        25%{?_dist_release}

Group:          Applications/Accessories
License:        GPLv2+
URL:            http://extragear.kde.org

Source0:        ftp://ftp.kde.org/pub/kde/stable/%{kdeversion}/src/extragear/%{name}-%{version}-kde%{kdeversion}.tar.bz2

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  kdelibs4-devel >= 4
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  gettext

#{?_kde4_macros_api:Requires: kde4-macros(api) = %{_kde4_macros_api} }

%description
kgrab is a screen grabbing utility for KDE4.

%description -l ja
KDE4 向けのスクリーンキャプチャユーティリティです.

%prep
%setup -qn %{name}-%{version}-kde%{kdeversion}


%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%cmake \
    -DCMAKE_BUILD_TYPE=release \
    -DDATA_INSTALL_DIR:PATH=%{_datadir}/kde4/apps \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/kde4 \
    -DLIBEXEC_INSTALL_DIR:PATH=%{_libexecdir}/kde4 \
    ..
popd

make %{?_smp_mflags} -C %{_target_platform}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT -C %{_target_platform}

# validate desktop file
desktop-file-install --vendor ""                          \
        --dir $RPM_BUILD_ROOT%{_datadir}/applications/kde4   \
        $RPM_BUILD_ROOT%{_datadir}/applications/kde4/%{name}.desktop

%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor &> /dev/null || :

%postun
if [ $1 -eq 0 ] ; then
  update-desktop-database -q &> /dev/null
  touch --no-create %{_datadir}/icons/hicolor &> /dev/null
  gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || :
fi

%posttrans
update-desktop-database -q &> /dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || :


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING COPYING.DOC COPYING.LIB
%{_bindir}/kgrab
%{_datadir}/applications/kde4/kgrab.desktop
%{_datadir}/dbus-1/interfaces/org.kde.kgrab.xml
%{_datadir}/icons/hicolor/*/apps/kgrab.*
%{_datadir}/kde4/apps/kgrab/


%changelog
* Sun Jul 10 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 0.1.1-25
- rebuild with gcc-5.4.0

* Fri Jan 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 0.1.1-24
- rebuilt on current VineSeed

* Sat Jan 15 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.1.1-23
- initial build for Vine Linux
- added Japanese summary

* Fri Feb 12 2010 Sebastian Vahl <svahl@fedoraproject.org> - 0.1.1-22
- 4.4.0
- drop kgrab-0.1.1-X11_libs.patch (already included)

* Tue Nov 24 2009 Kevin Kofler <Kevin@tigcc.ticalc.org> - 0.1.1-21
- rebuild for Qt 4.6.0 RC1 in F13 (was built against Beta 1 with unstable ABI)

* Thu Nov 05 2009 Sebastian Vahl <svahl@fedoraproject.org> - 0.1.1-20
- 4.3.3
- optimize scriptlets

* Tue Sep 01 2009 Sebastian Vahl <svahl@fedoraproject.org> - 0.1.1-19
- 4.3.1

* Tue Aug 04 2009 Than Ngo <than@redhat.com> - 0.1.1-18
- 4.3.0

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Jun 10 2009 Sebastian Vahl <fedora@deadbabylon.de> - 0.1.1-16
- 4.2.4

* Tue May 12 2009 Sebastian Vahl <fedora@deadbabylon.de> - 0.1.1-15
- 4.2.3

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Fri Jan 23 2009 Than Ngo <than@redhat.com> - 0.1.1-13
- 4.2.0

* Fri Dec 05 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> 0.1.1-12
- rebuild for fixed kde-filesystem (macros.kde4) (get rid of rpaths)

* Thu Dec  4 2008 Michael Schwendt <mschwendt@fedoraproject.org> - 0.1.1-11
- Include /usr/share/kde4/apps/kgrab directory.

* Sat Oct 04 2008 Than Ngo <than@redhat.com> 0.1.1-10
- 4.1.2

* Fri Aug 29 2008 Than Ngo <than@redhat.com> 0.1.1-9
- 4.1.1

* Thu Aug 28 2008 Sebastian Vahl <fedora@deadbabylon.de> 0.1.1-8
- 4.1 (final)

* Mon May 26 2008 Than Ngo <than@redhat.com> 0.1.1-7.kde4.0.80
- 4.1 beta1

* Thu Apr 03 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> - 0.1.1-6
- rebuild (again) for the fixed %%{_kde4_buildtype}

* Mon Mar 31 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> - 0.1.1-5
- rebuild for NDEBUG and _kde4_libexecdir

* Thu Feb 14 2008 Sebastian Vahl <fedora@deadbabylon.de> - 0.1.1-4
- remove reference to KDE 4 in summary and description

* Wed Feb 13 2008 Sebastian Vahl <fedora@deadbabylon.de> - 0.1.1-3
- added Requires: kdelibs4 >= 4
- added Requires: oxygen-icon-theme

* Wed Feb 13 2008 Sebastian Vahl <fedora@deadbabylon.de> - 0.1.1-2
- added requires xdg-utils, kde4-macros(api)

* Wed Feb 13 2008 Sebastian Vahl <fedora@deadbabylon.de> - 0.1.1-1
- initial version
