Name:    libkgapi
Summary: Google APIs for KDE
Summary(ja): KDE 向け Google API 集
Version: 0.4.3
Release: 1%{?_dist_release}

License: GPLv2+
Group:   System Environment/Libraries
URL:     https://projects.kde.org/projects/extragear/libs/libkgapi

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

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: kdelibs-devel >= 4.7.0
BuildRequires: kdepimlibs-devel >= 4.6
BuildRequires: libkipi-devel
BuildRequires: qjson-devel
BuildRequires: soprano-devel
BuildRequires: libboost-devel

Requires: kdelibs4 >= 4.7.0


%description
LibKGAPI (previously called LibKGoogle) is a C++ library that implements APIs for
various Google services.

Currently supported APIs:
  - Calendar API v3 (https://developers.google.com/google-apps/calendar)
  - Contacts API v3 (https://developers.google.com/google-apps/contacts/v3/)
  - Tasks API v1 (https://developers.google.com/google-apps/tasks)


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

%description devel
%{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 \
    -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 $RPM_BUILD_ROOT

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


%check
export PKG_CONFIG_PATH=$RPM_BUILD_ROOT%{_datadir}/pkgconfig:$RPM_BUILD_ROOT%{_libdir}/pkgconfig
pkg-config --modversion libkipi


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

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

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


%files
%defattr(-,root,root,-)
%doc LICENSE README
%{_libdir}/libkgapi.so.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/kde4/%{name}
%{_libdir}/libkgapi.so
%{_libdir}/cmake/LibKGAPI
%{_libdir}/pkgconfig/%{name}.pc


%changelog
* Sun Nov 04 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.4.3-1
- new upstream release

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

* Sun Aug 12 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.4.1-1
- initial build