%if %{?_dist_release} != "vl5"
%define kde KDE
%else
%define kde KDE4
%endif

Summary: Choqok %{kde} Micro-Blogging Client
Summary(ja): %{kde} マイクロブログクライアント
Name: choqok
Version: 1.3
Release: 1%{?_dist_release}

License: GPLv3
Group: Applications/Internet
URL: http://choqok.gnufolks.org/

Source0: http://choqok.gnufolks.org/pkgs/%{name}-%{version}.tar.bz2

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: cmake >= 2.6
BuildRequires: desktop-file-utils
BuildRequires: kdelibs4-devel
BuildRequires: gettext
BuildRequires: qjson-devel
BuildRequires: qoauth-devel
BuildRequires: attica-devel
BuildRequires: soprano-devel
%if %{?_dist_release} != "vl5"
BuildRequires: libindicate-qt-devel
%endif

Requires: %{name}-libs = %{version}-%{release}

%description
A Free/Open Source micro-blogging client for %{kde}.
The name comes from an ancient Persian word, which means Sparrow!
Choqok currently supports Twitter.com and Identi.ca services.

%package libs
Summary: Runtime libraries for %{name}
Summary(ja): %{name} のランタイムライブラリ
Group:   System Environment/Libraries
# Requires: %{name} = %{version}-%{release}
# for kwallet, among other goodies
Requires: kdebase-runtime

%description libs
%{summary}

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

%description devel
%{summary}


%prep
%setup -q

%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
PATH=$PATH:%{_prefix}/kerberos/bin \
%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} \
    ..
popd

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

%install
rm -rf %{buildroot}

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

%find_lang %{name}

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

%clean
rm -rf %{buildroot}

%post
touch --no-create %{_datadir}/icons/hicolor &> /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 || :
fi

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


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING README AUTHORS changelog TODO
%{_bindir}/choqok
%{_libdir}/kde4/choqok_*.so
%{_libdir}/kde4/kcm_choqok_*.so
%{_libdir}/kde4/konqchoqokplugin.so
%{_datadir}/icons/hicolor/*/actions/retweet.png
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/applications/kde4/choqok.desktop
%{_datadir}/config.kcfg/*.kcfg
%{_datadir}/kde4/services/choqok_*.desktop
%{_datadir}/kde4/apps/choqok
%{_datadir}/kde4/apps/choqok_*/*.rc
%{_datadir}/kde4/apps/dbus-1/services/*
%{_datadir}/kde4/apps/khtml/kpartplugins/*
%{_datadir}/kde4/services/ServiceMenus/*.desktop
%{_datadir}/kde4/servicetypes/choqok*.desktop
%doc %{_docdir}/HTML/*

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

%files devel
%defattr(-,root,root,-)
%{_includedir}/kde4/choqok
%{_libdir}/lib*.so
%{_datadir}/kde4/apps/cmake/*


%changelog
* Mon Sep 03 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> - 1.3-1
- new upstream release

* Fri Feb 03 2012 NAKAMURA Kenta <kenta@vinelinux.org> - 1.2-1
- new upstream release
- added BR: soprano-devel

* Sat Feb 26 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 1.0-1
- new upstream release

* Thu Jan 13 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.9.98-1
- new upstream release
- added BR: qjson-devel, qoauth-devel

* Sat May 22 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 0.9.55-15
- initial build for Vine Linux

* Tue Mar 09 2010 Tejas Dinkar <tejas@gja.in> - 0.9.55-14
- Add dependency from -libs to choqok

* Tue Mar 09 2010 Rex Dieter <rdieter@fedoraprojecdt.org> - 0.9.55-13
- Requires: kdebase-runtime (not kdeutils)

* Tue Mar 09 2010 Tejas Dinkar <tejas@gja.in> - 0.9.55-12
- choqok 1.0-beta

* Wed Sep 23 2009 Rex Dieter <rdieter@fedoraproject.org> - 0.6.6-9
- add icon/desktop-file scriptlets

* Sun Aug 16 2009 Tejas Dinkar <tejas@gja.in> - 0.6.6-8
- Added Dependency on kdeutils
- Choqok 0.6.6 is out

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

* Sun Jun 14 2009 Tejas Dinkar <tejas@gja.in> - 0.6.1-7
- Choqok 0.6.1 is out with the below two patches

* Sat Jun 13 2009 Tejas Dinkar <tejas@gja.in> - 0.6-6
- Fixed the inreplyto (via patch)

* Sat Jun 13 2009 Tejas Dinkar <tejas@gja.in> - 0.6-5
- Fixed the twitpocalypse (via patch)

* Wed May 27 2009 Tejas Dinkar <tejas@gja.in> - 0.6-4
- Changed to 0.6

* Fri Apr 10 2009 Tejas Dinkar <tejas@gja.in> - 0.5-3
- Added the TweetAll patch, remove this by 0.6

* Fri Mar 27 2009 Tejas Dinkar <tejas@gja.in> - 0.5-2
- Added AUTHORS changelog and TODO to doc

* Fri Mar 27 2009 Tejas Dinkar <tejas@gja.in> - 0.5-1
- Initial Version for Fedora
