Name: kdiff3
Summary: Tool for Comparison and Merge of Files and Directories
Summary(ja): ファイルやディレクトリーの比較/マージを行うツール
Version: 0.9.98
Release: 1%{?_dist_release}

URL: http://kdiff3.sourceforge.net/
License: GPLv2
Group: Development/Tools

Source: http://downloads.sourceforge.net/sourceforge/kdiff3/%{name}-%{version}.tar.gz

# Remove bogus MimeType tag from kdiff3part.desktop
#Patch0:         kdiff3part.desktop.diff
# Install kdiff3_part.rc into correct location
#Patch1:		kdiff3part.rc.diff
# fix build against kde-4.5 (pre)releases
#Patch2:		kdiff3-0.9.95-docbook_fixes.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root

BuildRequires: desktop-file-utils
BuildRequires: cmake
BuildRequires: gettext
BuildRequires: libICE-devel
BuildRequires: libXau-devel
BuildRequires: libXext-devel
BuildRequires: libXdmcp-devel
BuildRequires: libXft-devel
BuildRequires: libXpm-devel
#BuildRequires: kdelibs4-devel >= 4.1
#BuildRequires: kdebase4-devel
BuildRequires: kdelibs-devel >= 4.1
BuildRequires: kdebase-devel
BuildRequires: phonon-devel
BuildRequires: qt4-devel >= 4.4
BuildRequires: openssl-devel
BuildRequires: soprano-devel
BuildRequires: libX11-devel
#Requires: kdelibs4 > 4.1
Requires: kdelibs > 4.1

%description
Shows the differences line by line and character by character (!).
Provides an automatic merge-facility and
an integrated editor for comfortable solving of merge-conflicts.
Supports KIO on KDE (allows accessing ftp, sftp, fish, smb etc.).
Unicode & UTF-8 support

%prep
%setup -q -n %{name}-%{version}
#%patch0 -p1
#%patch1 -p1
#%patch2 -p1 -b .docbook_fixes

%build
%ifarch %{ix86}
export QTDIR=/usr/lib/qt4
%endif
%ifarch x86_64
export QTDIR=/usr/lib64/qt4
%endif

cmake . -DCMAKE_INSTALL_PREFIX=/usr
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}
make install DESTDIR=%{buildroot}

# Desktop.
desktop-file-install --vendor="" \
    --dir=%{buildroot}%{_datadir}/kde4/services \
    %{buildroot}%{_datadir}/kde4/services/kdiff3part.desktop

desktop-file-install  --vendor="" \
    --dir=%{buildroot}%{_datadir}/applications/kde4  \
    --add-category=Development \
        %{buildroot}%{_datadir}/applications/kde4/kdiff3.desktop

# locale's
#%find_lang %{name} || touch %{name}.lang
#%find_lang %{name}plugin || touch %{name}.lang
#cat %{name}plugin.lang >> %{name}.lang

%clean
%{__rm} -rf %{buildroot}

%post
touch --no-create %{_datadir}/icons/hicolor || :
touch --no-create %{_datadir}/icons/locolor || :

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

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

%files
%doc AUTHORS ChangeLog COPYING NEWS README TODO
%{_bindir}/kdiff3
%{_datadir}/applications/*
%{_datadir}/doc/HTML/*
%{_datadir}/kde4/apps/*
%{_datadir}/kde4/services/*
%{_datadir}/icons/hicolor/*
%{_datadir}/icons/locolor/*
%{_datadir}/locale/*
%{_libdir}/kde4/*

%changelog
* Thu Jun 16 2016 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.9.98-1
- new upstream release

* Sun Mar 30 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.9.97-2
- rebuilt with new toolchain

* Thu Aug 16 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.9.97-1
- new upstream release
- deleted Patch0
- changed BuildRequires: kdelibs4-devel >= 4.1, kdebase4-devel to 
  kdelibs-devel >= 4.1, kdebase-devel
- changed Requires: kdelibs4 > 4.1 to kdelibs > 4.1

* Tue Sep 20 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.9.96-1
- new upstream release
- refreshed patch0
- dropt patch1,2
- added BuildRequires: libX11-devel

* Sun May 15 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 0.9.95-4
- add BuildRequires: soprano-devel

* Sat Feb 26 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.9.95-3
- added Patch2 from FC
  * Tue Jul 13 2010 Rex Dieter <rdieter@fedoraproject.org> - 0.9.95-5
  - ftbfs against kde-4.5 (pre)releases

* Sat Jan 15 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.9.95-2
- fixed BR to build on Vine Linux 5

* Thu Aug 5 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.9.95-1
- initial build for VineSeed

* Fri Nov 21 2008 Joachim Eibl - 0.9.94-1
- Untested changes for KDE4.
* Mon May 15 2006 Vadim Likhota <vadim-lvv@yandex.ru> - 0.9.90-1.fc
- write spec for fc/rhel/centos/asp for kdiff3
