Name:           kiconedit
Summary:        An icon editor
Summary(ja):    アイコンエディタ
Version:        4.4.0
Release:        3%{?_dist_release}

Group:          Applications/Graphics
License:        GPLv2+
URL:            https://www.kde.org/applications/graphics/kiconedit/
Source0:        ftp://ftp.kde.org/pub/kde/stable/%{version}/src/extragear/%{name}-%{version}.tar.bz2

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

Requires: kdelibs4 >= %{version}
Conflicts: kdegraphics3

%description
KIconEdit is designed to help create icons for 
KDE using the standard icon palette.


%prep
%setup -q

# update docbook version to make doc-translations build with kdelibs >= 4.5
sed -i -e 's#<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4\.1\.2-Based Variant V1\.1//EN" "dtd/kdex\.dtd" \[#<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [#g' doc-translations/*_kiconedit/*/index.docbook

%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/fast DESTDIR=$RPM_BUILD_ROOT -C %{_target_platform}

%find_lang %{name}
HTML_DIR=$(kde4-config --expandvars --install html)
if [ -d $RPM_BUILD_ROOT${HTML_DIR} ]; then
for lang_dir in $RPM_BUILD_ROOT${HTML_DIR}/* ; do
  if [ -d ${lang_dir} ]; then
    lang=$(basename ${lang_dir})
    echo "%lang(${lang}) ${HTML_DIR}/${lang}/%{name}/" >> %{name}.lang
  fi
done
fi

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/kde4/%{name}.desktop


%clean
rm -rf %{buildroot}


%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 AUTHORS COPYING COPYING.DOC NEWS
%{_bindir}/kiconedit
%{_datadir}/kde4/apps/kiconedit/
%{_datadir}/applications/kde4/kiconedit.desktop
%{_datadir}/icons/hicolor/*/*/*


%changelog
* Fri Jan 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 4.4.0-3
- rebuilt on current VineSeed
- update docbook version to make doc-translations 

* Sun Jul 18 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.4.0-2
- added Conflicts: kdegraphics3

* Mon Mar 22 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.4.0-1
- new upstream release
- built with new toolchain

* Fri Nov 27 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.3.3-1
- new upstream release

* Sat Sep 12 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.3.1-2
- initial build for Vine Linux

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

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

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

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

* Mon May 11 2009 Rex Dieter <rdieter@fedoraproject.org> 4.2.3-2
- fix %%_docdir/HTML/<lang> ownership

* Fri May 08 2009 Rex Dieter <rdieter@fedoraproject.org> 4.2.3-1
- 4.2.3
- optimize scriptlets

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

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

* Mon Nov 17 2008 Rex Dieter <rdieter@fedoraproject.org> 4.1.3-2
- scriptlet, dependency fixes

* Sun Nov 09 2008 Sebastian Vahl <fedora@deadbabylon.de> 4.1.3-1
- 4.1.3

* Fri Oct 03 2008 Rex Dieter <rdieter@fedoraproject.org> 4.1.2-1
- 4.1.2

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

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

* Mon May 26 2008 Than Ngo <than@redhat.com> 4.0.80-1
- 4.1 beta 1

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

* Mon Mar 31 2008 Kevin Kofler <Kevin@tigcc.ticalc.org> 4.0.3-1
- update to 4.0.3
- rebuild for NDEBUG and _kde4_libexecdir

* Tue Mar 04 2008 Sebastian Vahl <fedora@deadbabylon.de> 4.0.2-1
- new upstream version: 4.0.2

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

* Fri Feb 08 2008 Sebastian Vahl <fedora@deadbabylon.de> 4.0.1-1
- new upstream version: 4.0.1

* Fri Jan 25 2008 Sebastian Vahl <fedora@deadbabylon.de> 4.0.0-1
- Initial version of kde-4.0.0 version
