%define iversion 2.0.0

Name:           kcoloredit
Version:        4.4.0
Release:        3%{?_dist_release}
Summary:        A color palette Editor
Summary(ja):    カラーパレットエディタ

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

## upstream patches
# fix FTBFS with the new stricter ld in F13 (#564815): explicitly link libX11
Patch100: kcoloredit-2.0.0-kde4.4.0-ftbfs.patch

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

Requires: kdelibs4 >= %{version}
Requires(post): xdg-utils
Requires(postun): xdg-utils

%description
KColorEdit is a palette files editor. It can be used for editing 
color palettes and for color choosing and naming.

%prep
%setup -qn kcoloredit-%{iversion}-kde%{version}
%patch100 -p1 -b .ftbfs

%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}
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

%clean
rm -rf $RPM_BUILD_ROOT

%post
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null || :

%postun
xdg-icon-resource forceupdate --theme hicolor 2> /dev/null || :


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
%{_bindir}/kcoloredit
%{_datadir}/kde4/apps/kcoloredit/
%{_datadir}/applications/kde4/kcoloredit.desktop
%{_datadir}/icons//hicolor/*/*/kcoloredit.png

%changelog
* Fri Sep 02 2016 Toshiaki Ara <ara_t@384.jp> - 4.4.0-3
- rebuild with gcc-5.4.0

* Fri Jan 16 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> - 4.4.0-2
- rebuilt on current VineSeed
- added Patch100 from Fedora
  * Sat Feb 13 2010 Kevin Kofler <Kevin@tigcc.ticalc.org> - 4.4.0-2
  - fix FTBFS with the new stricter ld in F13 (#564815): explicitly link libX11

* 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

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

* 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
- dependency fixes, cosmetics

* Fri Nov 14 2008 Than Ngo <than@redhat.com> 4.1.3-1
- 4.1.3

* Sat Oct 04 2008 Than Ngo <than@redhat.com> 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-1
- 4.1 (final)

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

* 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
