Name:    kate
Summary: Advanced Text Editor 
Summary(ja): 高機能なテキストエディタ
Version: 4.14.3
Release: 1%{?_dist_release}

# kwrite LGPLv2+
# kate: app LGPLv2, plugins, LGPLv2 and LGPLv2+ and GPLv2+
# ktexteditor: LGPLv2
# katepart: LGPLv2
License: LGPLv2 and LGPLv2+ and GPLv2+ 
Group:   Applications/Editors
URL:     https://projects.kde.org/projects/kde/kdebase/kate 

Source0: ftp://ftp.kde.org/pub/kde/unstable/%{version}/src/%{name}-%{version}.tar.xz

BuildRoot: %{_tmppath}/%{name}-%{version}
BuildRequires: desktop-file-utils
BuildRequires: kdelibs-devel >= %{version}
BuildRequires: kactivities-devel
BuildRequires: soprano-devel
BuildRequires: sip-devel
BuildRequires: python-devel
BuildRequires: PyQt4-devel
BuildRequires: PyKDE4-devel
BuildRequires: qjson-devel

Requires: kdebase-runtime%{?_kde4_version: >= %{_kde4_version}}
Requires: %{name}-part = %{version}-%{release}
Requires: %{name}-libs = %{version}-%{release}

Vendor: Project Vine
Distribution: Vine Linux

%description
%{summary}.

%package devel
Summary:  Development files for %{name}
Summary(ja): %{name} の開発用ファイル
Group:    Development/Libraries
Requires: %{name}-libs = %{version}-%{release}
Requires: kdelibs-devel

%description devel
%{summary}.

%package libs 
Summary:  Runtime files for %{name}
Summary(ja): %{name} のランタイムライブラリ
Group:    System Environment/Libraries
# when split occurred
Conflicts: kdesdk4-libs < 4.6.95-10
#Requires: %{name} = %{version}-%{release}

%description libs 
%{summary}.

%package part 
Summary: Kate kpart plugin 
Summary(ja): Kate kpart プラグイン
License: LGPLv2
Group:   Applications/Editors
# when split occurred
Conflicts: kdelibs4 < 4.6.95-10

%description part 
%{summary}.

%package -n kwrite
Summary: Text Editor
Summary(ja): テキストエディタ
License: LGPLv2+
Group:   Applications/Editors
# when split occurred
Conflicts: kdebase4 < 4.6.95-10
Requires: %{name}-part = %{version}-%{release} 
Requires: kdebase-runtime%{?_kde4_version: >= %{_kde4_version}}

%description -n kwrite
%{summary}.

%package pate 
Summary: Kate python plugin
Summary(ja): Kate python プラグイン
License: LGPLv2
Group:   System Environment/Libraries

%description pate 
%{summary}.

%prep
%setup -q


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

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


%install
rm -rf $RPM_BUILD_ROOT

make install/fast DESTDIR=$RPM_BUILD_ROOT -C %{_target_platform}

# move devel symlinks (that would otherwise conflict with kdelibs3-devel)
mkdir -p $RPM_BUILD_ROOT%{_libdir}/kde4/devel
pushd $RPM_BUILD_ROOT%{_libdir}
for i in lib*.so
do
    case "$i" in
	libkate*interfaces.so)
	    linktarget=`readlink "$i"`
	    rm -f "$i"
	    ln -sf "../../$linktarget" "kde4/devel/$i"
	    ;;
    esac
done
popd

## unpackaged files
# playground artsticomment -devel bits
rm -fv $RPM_BUILD_ROOT%{_includedir}/kde4/artisticcomment.h
rm -fv $RPM_BUILD_ROOT%{_libdir}/libacomment.a


%check
for f in $RPM_BUILD_ROOT%{_datadir}/applications/kde4/*.desktop ; do
  desktop-file-validate $f
done


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

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

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

%post part -p /sbin/ldconfig
%postun part -p /sbin/ldconfig


%files 
%doc kate/AUTHORS kate/ChangeLog kate/COPYING.LIB kate/README kate/TODO
%{_bindir}/kate
%{_libdir}/libkdeinit4_kate.so
%{_datadir}/applications/kde4/kate.desktop
%{_datadir}/kde4/apps/kate/
%{_datadir}/kde4/apps/katexmltools/
%{_datadir}/kde4/apps/kconf_update/kate*.upd
%{_datadir}/icons/hicolor/*/*/*
%{_mandir}/man1/kate.1.gz
%{_datadir}/config/katerc
%{_datadir}/kde4/services/kate*.desktop
%{_libdir}/kde4/kate*plugin.so
%{_libdir}/kde4/katefiletemplates.so
%{_datadir}/kde4/apps/katepart/
%{_datadir}/kde4/apps/ktexteditor_*/
%{_datadir}/kde4/services/ktexteditor_*.desktop
%{_libdir}/kde4/ktexteditor_*.so
%{_datadir}/kde4/services/plasma-applet-katesession.desktop
%{_datadir}/kde4/servicetypes/kateplugin.desktop
%{_libdir}/kde4/plasma_applet_katesession.so
%{_libdir}/kde4/kate_kttsd.so
%{_datadir}/config/ktexteditor_codesnippets_core.knsrc
# these should *probably* be moved to hicolor -- rex
%{_datadir}/doc/HTML/en/kate/

%files libs
%{_libdir}/libkateinterfaces.so.4*
%{_libdir}/libkatepartinterfaces.so.4*

%files devel
%{_libdir}/kde4/devel/libkateinterfaces.so
%{_libdir}/kde4/devel/libkatepartinterfaces.so
%{_includedir}/kde4/kate_export.h
%{_includedir}/kde4/kate/

%files part
%doc part/AUTHORS part/ChangeLog part/COPYING.LIB
%doc part/INDENTATION part/NEWS part/README* part/TODO*
%{_libdir}/kde4/katepart.so
%{_libdir}/libkatepartinterfaces.so.4*
%{_datadir}/config/katemoderc
%{_datadir}/kde4/services/katepart.desktop

%files -n kwrite 
%{_bindir}/kwrite
%{_datadir}/kde4/apps/kwrite
%{_libdir}/libkdeinit4_kwrite.so
%{_datadir}/applications/kde4/kwrite.desktop
%{_datadir}/kde4/servicetypes/katepythonplugin.desktop
%{_datadir}/doc/HTML/en/kwrite/

%files pate
%{python_sitearch}/PyKate4
%{_datadir}/config/kateschemarc
%{_datadir}/config/katesyntaxhighlightingrc
%{_datadir}/kde4/services/pate.desktop


%changelog
* Thu Jan 01 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.14.3-1
- new upstream release

* Tue May 06 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.12.5-1
- new upstream release

* Sun Feb 09 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.12.2-1
- new upstream release

* Sun Dec 15 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.11.4-1
- new upstream release

* Sun Sep 08 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.11.1-1
- new upstream release

* Sat Jul 06 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.10.5-1
- new upstream release
- add BuildRequires: kactivities-devel, sip-devel, python-devel, PyQt4-devel, PyKDE4-devel, qjson-devel
- create %%{name}-pate subpackage

* Fri Jan 04 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.9.5-1
- new upstream release

* Sat Nov 10 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.9.3-1
- new upstream release

* Sun Oct 07 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.9.2-1
- new upstream release

* Thu Sep 06 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.9.1-1
- new upstream release

* Sun Aug 12 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.9.0-1
- new upstream release

* Fri Dec 23 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.7.4-1
- new upstream release

* Sat Oct 29 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.7.2-1
- new upstream release

* Mon Aug  1 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.7.0-2
- Initial build for Vine Linux

* Tue Jul 26 2011 Jaroslav Reznik <jreznik@redhat.com> 4.7.0-1
- 4.7.0

* Mon Jul 18 2011 Rex Dieter <rdieter@fedoraproject.org> 4.6.95-1
- first try

