Name:           ktorrent
Summary:        A BitTorrent program
Summary(ja):    BitTorrent クライアント
Version:        4.3.0
Release:        1%{?_dist_release}

Group:          Applications/Internet
License:        GPLv2+
URL:            http://ktorrent.org/

Source0:        http://ktorrent.org/downloads/%{version}/ktorrent-%{version}%{?pre}.tar.bz2

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires: avahi-devel
BuildRequires: cmake   
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: gmp-devel
#BuildRequires: GeoIP-devel
# libtaskmanager support, for plasma applet
BuildRequires: kdebase-workspace-devel
BuildRequires: kdelibs4-devel >= 4.2.0
BuildRequires: kdepimlibs-devel
BuildRequires: libktorrent-devel >= 1.1.0
BuildRequires: plasma-devel
BuildRequires: qca2-devel
BuildRequires: taglib-devel
BuildRequires: soprano-devel

Obsoletes: ktorrent < 3.2.3-2

Provides: plasma-engine-ktorrent = %{version}-%{release}

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

%description
KTorrent is a BitTorrent program for KDE. Its main features are native KDE
integration, download of torrent files, upload speed capping, internet
searching using various search engines, UDP Trackers and UPnP support.

%package libs
Summary: Runtime libraries for %{name}
Summary(ja): %{name} のランタイムライブラリ
Group: System Environment/Libraries
#Requires: %{name} = %{version}-%{release}
#{?_kde4_version:Requires: kdelibs4%{?_isa} >= %{_kde4_version}} 

%description libs
%{summary}.

%package -n kde-plasma-ktorrent
Summary: ktorrent plasma applet
Summary(ja): ktorrent の Plasma アプレット
Group: Applications/Internet
Requires: plasma-engine-ktorrent = %{version}-%{release}

%description -n kde-plasma-ktorrent
%{summary}.


%prep
%setup -q -n %{name}-%{version}%{?pre}

%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 \
    -DLIB_INSTALL_DIR:PATH=%{_libdir} \
    -DLIBEXEC_INSTALL_DIR:PATH=%{_libexecdir}/kde4 \
    -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \
    -DWITH_SYSTEM_GEOIP:BOOL=OFF \
    -DWITH_BUILTIN_COUNTRY_FLAGS:BOOL=OFF \
    ..
popd

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

%install
%{__rm} -rf %{buildroot}
make install/fast DESTDIR=%{buildroot} -C %{_target_platform}

# unpackaged files
rm -f %{buildroot}%{_libdir}/lib{ktcore,ktupnp}.so

%find_lang %{name}

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

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

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || :
update-desktop-database -q &> /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-desktop-database -q &> /dev/null ||:
fi

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc ChangeLog COPYING
%{_bindir}/ktmagnetdownloader
%{_bindir}/ktorrent
%{_bindir}/ktupnptest
%{_libdir}/kde4/ktbwschedulerplugin.so
%{_libdir}/kde4/ktinfowidgetplugin.so
%{_libdir}/kde4/ktipfilterplugin.so
%{_libdir}/kde4/ktlogviewerplugin.so
%{_libdir}/kde4/ktmagnetgeneratorplugin.so
%{_libdir}/kde4/ktmediaplayerplugin.so
%{_libdir}/kde4/ktscanfolderplugin.so
%{_libdir}/kde4/ktsearchplugin.so
%{_libdir}/kde4/ktstatsplugin.so
%{_libdir}/kde4/ktupnpplugin.so
%{_libdir}/kde4/ktwebinterfaceplugin.so
%{_libdir}/kde4/ktzeroconfplugin.so
%{_libdir}/kde4/ktdownloadorderplugin.so
%{_libdir}/kde4/ktscriptingplugin.so
%{_libdir}/kde4/ktshutdownplugin.so
%{_libdir}/kde4/ktsyndicationplugin.so
%{_libdir}/kde4/plasma_engine_ktorrent.so
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/applications/kde4/ktorrent.desktop
%{_datadir}/kde4/apps/ktorrent/
%{_datadir}/kde4/services/kt*plugin.desktop
%{_datadir}/kde4/services/magnet.protocol
%{_datadir}/kde4/services/plasma-dataengine-ktorrent.desktop
%{_datadir}/kde4/servicetypes/ktorrentplugin.desktop
%{_docdir}/HTML/en/ktorrent

%files libs
%defattr(-,root,root,-)
%{_libdir}/libktcore.so.*

%files -n kde-plasma-ktorrent
%defattr(-,root,root,-)
%{_datadir}/kde4/services/plasma-applet-ktorrent.desktop
%{_libdir}/kde4/plasma_applet_ktorrent.so


%changelog
* Sun Sep 02 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.3.0-1
- new upstream release

* Mon Aug 13 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.2.1-1
- new upstream release

* Sun Oct  2 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.1.2-1
- new upstream release

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

* Wed Jan 26 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.0.5-1
- Initial build for Vine Linux

* Thu Jul  8 2010 Alexey Kurov <nucleo@fedoraproject.org> - 4.0.2-1
- ktorrent-4.0.2
- drop DSO linking patch

* Tue Jun 15 2010 Alexey Kurov <nucleo@fedoraproject.org> - 4.0.1-1
- ktorrent-4.0.1
- fix DSO linking

* Mon May 24 2010 Rex Dieter <rdieter@fedoraproject.org> - 4.0.0-1
- ktorrent-4.0.0

* Thu May 06 2010 Rex Dieter <rdieter@fedoraproject.org> - 4.0-0.4.rc1
- ktorrent-4.0rc1

* Mon Apr 05 2010 Rex Dieter <rdieter@fedoraproject.org> - 4.0-0.3.beta2
- ktorrent-4.0beta2

* Thu Jan 28 2010 Rex Dieter <rdieter@fedoraproject.org> - 4.0-0.2.beta1
- -libs: use %%{_kde4_version}

* Mon Dec 21 2009 Rex Dieter <rdieter@fedoraproject.org> - 4.0-0.1.beta1
- ktorrent-4.0beta1

* Thu Dec 17 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.3.2-1
- ktorrent-3.3.2

* Mon Nov 23 2009 Roland Wolters <wolters.liste@gmx.net> - 3.3.1-1
- ktorrent-3.3.1

* Mon Nov 09 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.3-1
- ktorrent-3.3
- -libs: add/fix scriptlets, move kdelibs4 dep here

* Sat Oct 24 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.3-0.1.rc1
- ktorrent-3.3rc1

* Sun Sep 27 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.2.4-1
- ktorrent-3.2.4

* Mon Aug 24 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.2.3-3
- upstream tarball respin

* Sun Aug 23 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.2.3-2
- kde-plasma-ktorrent pkg (so main pkg doesn't pull in kdebase-workspace)
- -libs to make multilib friendly

* Wed Aug 12 2009 Roland Wolters <wolters.liste@gmx.net> - 3.2.3-1
- ktorrent-3.2.3

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

* Tue Jul 07 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.2.2-3
- don't use internal flags (prefer those provided by kdebase-runtime-flags)

* Wed Jun 03 2009 Roland Wolters <wolters.liste@gmx.net> - 3.2.2-2
- ktorrent-3.2.2

* Tue May 05 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.2.1-3
- crash adjusting speed from systray (kdebug#188447, rhbz#499147)

* Wed Apr 29 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.2.1-2
- -DWITH_SYSTEM_GEOIP=1

* Mon Apr 06 2009 Rex Dieter <rdieter@fedoraproject.org> - 3.2.1-1
- ktorrent-3.2.1
- optimize scriptlets

* Tue Feb 26 2009 Roland Wolters <wolters.liste@gmx.net> - 3.2-8
- Some spec file dependency fixes.

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

* Tue Feb 17 2009 Roland Wolters <wolters.liste@gmx.net> - 3.2-1
- Update to new version ktorrent 3.2
 
* Tue Feb 01 2009 Roland Wolters <wolters.liste@gmx.net> - 3.1.6-4
- ktorrent-3.1.6-4

* Mon Nov 17 2008 Rex Dieter <rdieter@fedoraproject.org> - 3.1.5-1
- ktorrent-3.1.5 (#469870)

* Thu Oct 23 2008 Rex Dieter <rdieter@fedoraproject.org> - 3.1.4-1
- ktorrent-3.1.4 (#468233)

* Tue Oct 14 2008 Rex Dieter <rdieter@fedoraproject.org> - 3.1.3-4
- KDEDInit could not launch .../ktorrent (#451559, kde#157853)

* Mon Oct 13 2008 Roland Wolters <wolters.liste@gmx.net> - 3.1.3-3
- Update to upstream version 3.1.3

* Fri Aug 08 2008 Rex Dieter <rdieter@fedoraproject.org> - 3.1.2-1
- ktorrent-3.1.2

* Sun Jul 13 2008 Roland Wolters <wolters.liste@gmx.net> - 3.1-5
- Update to version 3.1

* Wed May 14 2008 Roland Wolters <wolters.liste@gmx.net> - 3.0.2-3
- bugfix update to version 3.0.2
- some spec file fixes due to an update error

* Mon Apr 28 2008 Rex Dieter <rdieter@fedoraproject.org> - 3.0.1-4
- %%postun: remove extraneous scriplets
- -devel: own %%{_kde4_includedir}/libbtcore/ (and subdirs)
- -devel: Requires: kdelibs4-devel
- drop: Requires: oxygen-icon-theme (kde4 runtime already does)
- Requires(post,postun): xdg-utils

* Thu Apr 17 2008 Roland Wolters <wolters.liste@gmx.net> - 3.0.1-3
- bugfix update to version 3.0.1

* Tue Feb 19 2008 Roland Wolters <wolters.liste@gmx.net> - 3.0.0-7
- further spec file improvements for the 3.0.0 version

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 3.0.0-2
- Autorebuild for GCC 4.3

* Mon Feb 18 2008 Roland Wolters <wolters.liste@gmx.net> - 3.0.0-1
- first KDE 4 build

* Sun Jan 27 2008 Roland Wolters <wolters.liste@gmx.net> - 2.2.5-5
- updated to bugfix version 2.2.5
- fixed build-system-Qt problem in spec file

* Sat Dec 01 2007 Roland Wolters <wolters.liste@gmx.net> - 2.2.4-2
- changed build require from kdelibs-devel to kdelibs3-devel

* Thu Nov 21 2007 Roland Wolters <wolters.liste@gmx.net> - 2.2.4-1
- bugfix update to version 2.2.4

* Fri Nov 16 2007 Roland Wolters <wolters.liste@gmx.net> - 2.2.3-2
- fixed version number for libktorrent file (2.2.2 for now)

* Thu Nov 15 2007 Roland Wolters <wolters.liste@gmx.net> - 2.2.3-1
- features and bugfix update to version 2.2.3

* Wed Aug 19 2007 Roland Wolters <wolters.liste@gmx.net> - 2.2.2-1
- bugfix update to version 2.2.2

* Thu Aug 16 2007 Roland Wolters <wolters.liste@gmx.net> - 2.2.1-3
- licence tag corrected

* Wed Jul 25 2007 Jesse Keating <jkeating@redhat.com> - 2.2.1-2
- Rebuild for RH #249435

* Tue Jul 24 2007 Roland Wolters <wolters.liste@gmx.net> 2.2.1-1
- update to bugfix upstream 2.2.1

* Fri Jul 06 2007 Roland Wolters <wolters.liste@gmx.net> 2.2-2
- spec-file fixes re-included

* Tue Jul 03 2007 Roland Wolters <wolters.liste@gmx.net> 2.2-1
- update to upstream 2.2:
	- cleaner UI
	- - New file selection dialog
	- Statistics plugin with pretty graphs
	- Possibility to open as many tabs as you want
	- Diskspace monitoring and stopping of downloads when the diskspace
	  drops below a certain value
	- Individual torrent speed limits
	- Full disk preallocation to avoid fragmentation

* Wed Jun 13 2007 Roland Wolters <wolters.liste@gmx.net> 2.2rc1-1
- update to upstream 2.2rc1

* Tue Apr 03 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 2.1.3-1
- ktorrent-2.1.3 (#235014)
- optimize %%configure

* Fri Mar 09 2007 Roland Wolters <wolters.liste@gmx.net> 2.1.2-2
- update to upstream 2.1.2

* Mon Mar 05 2007 Roland Wolters <wolters.liste@gmx.net> 2.1.1-2
- update to upstream 2.1.1

* Wed Feb 07 2007 Roland Wolters <wolters.liste@gmx.net> 2.1-7
- spec-file adjustments

* Wed Feb 07 2007 Roland Wolters <wolters.liste@gmx.net> 2.1-6
- fixed plugins bug
- fixed configure warnings

* Tue Feb 06 2007 Roland Wolters <wolters.liste@gmx.net> 2.1-4
- added avahi-devel dependecy

* Mon Feb 05 2007 Roland Wolters <wolters.liste@gmx.net> 2.1-3
- Update to upstream version 2.1

* Fri Oct 13 2006 Roland Wolters <wolters.liste@gmx.net> 2.0.3-4
- Update to upstream version 2.0.3
- added znow patch for ppc

* Thu Sep 07 2006 Roland Wolters <wolters.liste@gmx.net> 2.0.2-3
- mass rebuild

* Tue Aug 30 2006 Roland Wolters <wolters.liste@gmx.net> 2.0.2-1
- minor bugfix update

* Tue Aug 29 2006 Roland Wolters <wolters.liste@gmx.net> 2.0.1-3
- mass rebuild

* Mon Aug 21 2006 Roland Wolters <wolters.liste@gmx.net> 2.0.1-1
- update to version 2.0.1

* Sun Aug 20 2006 Roland Wolters <wolters.liste@gmx.net> 2.0-6
- increased minor version to avoid broken update path

* Mon Aug 14 2006 Roland Wolters <wolters.liste@gmx.net> 2.0-3
- fixed small errors in spec file

* Wed Aug 09 2006 Roland Wolters <wolters.liste@gmx.net> 2.0-1
- update to version 2.0

* Fri Jun 23 2006 Roland Wolters <wolters.liste@gmx.net> 1.2-6
- fixed doublication error in rpm spec
- spec file polishing

* Fri Jun 23 2006 Roland Wolters <wolters.liste@gmx.net> 1.2-5
- added %%{_datadir}/apps/ktorrent
- removed redundant KTorrent in summary

* Wed Jun 21 2006 Roland Wolters <wolters.liste@gmx.net> 1.2-4
- changed e-mail address to correct packager address

* Wed Apr  5 2006 Roland Wolters <rolandwolters@web.de> 1.2-3
- corrected *.desktop files
- changed icon scriplets

* Wed Apr  5 2006 Roland Wolters <rolandwolters@web.de> 1.2-2
- set vendor string to ""
- added gtk-update-icon-cache scriplets to post and postun
- added desktop-database scriplet because of MimeType in ktorrent.desktop
- moved %%{_libdir}/kde3/* to main package
- moved %%{_libdir}/libktorrent.so to main package
- configure with disable-static and enable-shared
- added %%exclude %%{_libdir}/lib*.la

* Mon Apr  3 2006 Roland Wolters <rolandwolters@web.de> 1.2-1
- initial packaging
