+#
+# Conditional build:
+%bcond_without tests # build without tests
+%bcond_with php # PHP bindings
+%bcond_without python # Python bindings
+
+%define php_name php56
Summary: Kolab Object Handling Library
Name: libkolab
-Version: 0.3
-Release: 0.1
-License: LGPLv3+
+Version: 0.6.0
+Release: 14
+License: LGPL v3+
+Group: Libraries
+Source0: http://mirror.kolabsys.com/pub/releases/%{name}-%{version}.tar.gz
+# Source0-md5: 3c4fc1fec2dfcc0841f29de8f6ff0cd3
+Patch0: 0002-Make-libkolab-compile-with-upstream-kdepimlibs.patch
URL: http://git.kolab.org/libkolab
-Source0: http://git.kolab.org/libkolab/snapshot/%{name}-%{version}.tar.gz
+BuildRequires: QtCore-devel
BuildRequires: curl-devel
-BuildRequires: kde4-kdepimlibs-devel
-BuildRequires: libcalendaring-devel
-BuildRequires: libkolabxml-devel >= 0.7
-BuildRequires: php-devel
+BuildRequires: kde4-kdepimlibs-devel >= 4.8
+BuildRequires: libkolabxml-devel >= 1.1
+BuildRequires: qt4-build
+BuildRequires: rpmbuild(macros) >= 1.600
+BuildRequires: swig
+%if %{with php}
+BuildRequires: %{php_name}-devel
+BuildRequires: %{php_name}-cli
+%if %{with tests}
+BuildRequires: %{php_name}-pcre
+%endif
+BuildRequires: %{php_name}-program
+BuildRequires: swig-php
+%endif
+%if %{with python}
BuildRequires: python-devel
-BuildRequires: qt-devel
+BuildRequires: swig-python
+%endif
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
The libkolab library is an advanced library to handle Kolab objects.
%package devel
Summary: Kolab library development headers
-BuildRequires: kde4-kdepimlibs-devel >= 4.8
-BuildRequires: libcalendaring-devel
+Group: Development/Languages/PHP
Requires: %{name} = %{version}-%{release}
-Requires: libkolabxml-devel >= 0.7
-Requires: php-devel
-Requires: pkgconfig
-Requires: python-devel
+Requires: libkolabxml-devel >= 1.0
%description devel
Development headers for the Kolab object libraries.
-%package -n php-kolab
+%package -n %{php_name}-kolab
Summary: PHP Bindings for libkolab
Group: Libraries
Requires: %{name} = %{version}-%{release}
-Requires: php(api) = %{php_core_api}
-Requires: php(zend-abi) = %{php_zend_api}
+%{?requires_php_extension}
-%description -n php-kolab
-PHP Bindings for libkolab
+%description -n %{php_name}-kolab
+PHP Bindings for libkolab.
%package -n python-kolab
Summary: Python bindings for libkolab
Requires: %{name} = %{version}-%{release}
%description -n python-kolab
-Python bindings for libkolab
+Python bindings for libkolab.
%prep
%setup -q
+%patch0 -p1
%build
-rm -rf build
-mkdir -p build
-pushd build
-%{cmake} -Wno-fatal-errors -Wno-errors \
+install -d build
+cd build
+%cmake \
+ -Wno-fatal-errors -Wno-errors \
-DINCLUDE_INSTALL_DIR=%{_includedir} \
-%if 0%{?rhel} < 7 && 0%{?fedora} < 17
- -DUSE_LIBCALENDARING=ON \
-%endif
+ -DLIB_INSTALL_DIR=%{_libdir} \
+%if %{with php}
-DPHP_BINDINGS=ON \
- -DPHP_INSTALL_DIR=%{php_extdir} \
+ -DPHP_INSTALL_DIR=%{php_extensiondir} \
+ -DPHP_EXECUTABLE=%{__php} \
+%endif
+%if %{with python}
-DPYTHON_BINDINGS=ON \
-DPYTHON_INSTALL_DIR=%{py_sitedir} \
+%endif
..
%{__make}
-popd
-
-%install
-rm -rf $RPM_BUILD_ROOT
-pushd build
-%{__make} install DESTDIR=$RPM_BUILD_ROOT
-popd
-%check
-pushd build/tests
+%if %{with tests}
+cd tests
./benchmarktest || :
./calendaringtest || :
./formattest || :
./icalendartest || :
./kcalconversiontest || :
./upgradetest || :
-popd
+%endif
-%clean
+%install
rm -rf $RPM_BUILD_ROOT
+%{__make} -C build install \
+ DESTDIR=$RPM_BUILD_ROOT
-%post -p /sbin/ldconfig
+%if %{with php}
+install -d $RPM_BUILD_ROOT%{php_data_dir}
+mv $RPM_BUILD_ROOT{%{php_extensiondir}/*.php,%{php_data_dir}}
+%endif
-%postun -p /sbin/ldconfig
+%if %{with python}
+%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
+%py_comp $RPM_BUILD_ROOT%{py_sitedir}
+%py_postclean
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
%files
%defattr(644,root,root,755)
-%{_libdir}/%{name}.so.0
-%{_libdir}/%{name}.so.0.3
+%attr(755,root,root) %{_libdir}/%{name}.so.*.*
+%attr(755,root,root) %ghost %{_libdir}/%{name}.so.0
%files devel
%defattr(644,root,root,755)
-%{_libdir}/%{name}.so
+%attr(755,root,root) %{_libdir}/%{name}.so
%{_libdir}/cmake/Libkolab
%{_includedir}/kolab
-%files -n php-kolab
+%if %{with php}
+%files -n %{php_name}-kolab
%defattr(644,root,root,755)
-%{php_extdir}/calendaring.php
-%{php_extdir}/calendaring.so
-%{php_extdir}/icalendar.php
-%{php_extdir}/icalendar.so
+%attr(755,root,root) %{php_extensiondir}/kolabcalendaring.so
+%attr(755,root,root) %{php_extensiondir}/kolabicalendar.so
+%attr(755,root,root) %{php_extensiondir}/kolabobject.so
+%attr(755,root,root) %{php_extensiondir}/kolabshared.so
+%{php_data_dir}/kolabcalendaring.php
+%{php_data_dir}/kolabicalendar.php
+%{php_data_dir}/kolabobject.php
+%{php_data_dir}/kolabshared.php
+%endif
+%if %{with python}
%files -n python-kolab
%defattr(644,root,root,755)
-%{py_sitedir}/_calendaring.so
-%{py_sitedir}/calendaring.py*
-%{py_sitedir}/_icalendar.so
-%{py_sitedir}/icalendar.py*
-
-
+%dir %{py_sitedir}/kolab
+%attr(755,root,root) %{py_sitedir}/kolab/_calendaring.so
+%attr(755,root,root) %{py_sitedir}/kolab/_icalendar.so
+%attr(755,root,root) %{py_sitedir}/kolab/_kolabobject.so
+%attr(755,root,root) %{py_sitedir}/kolab/_shared.so
+%{py_sitedir}/kolab/calendaring.py[co]
+%{py_sitedir}/kolab/icalendar.py[co]
+%{py_sitedir}/kolab/kolabobject.py[co]
+%{py_sitedir}/kolab/shared.py[co]
+%endif