File libkolab.spec of Package libkolab
#
# spec file for package libkolab
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%bcond_without kde
%bcond_with tests
%define php_extdir %{_libdir}/php5/extensions
%define php_confdir %{_sysconfdir}/php5/conf.d
%define libname %{name}0
Name: libkolab
Version: 0.6.0
Release: 0
Summary: Conversions from/to KDE containers
License: LGPL-2.0+ and LGPL-3.0+ and AGPL-3.0+
Group: Development/Libraries/C and C++
Url: https://kolab.org/about/libkolab
Source: http://mirror.kolabsys.com/pub/releases/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM 0001-Add-support-for-exceptions.patch
Patch0001: 0001-Add-support-for-exceptions.patch
# PATCH-FIX-UPSTREAM 0002-Support-for-THISANDFUTURE.patch
Patch0002: 0002-Support-for-THISANDFUTURE.patch
# PATCH-FIX-UPSTREAM 0003-Move-QT_DECLARE_METADATA-logic-to-cmake.patch
Patch0003: 0003-Move-QT_DECLARE_METADATA-logic-to-cmake.patch
# PATCH-FIX-UPSTREAM libkolab-0.6.0_check_for_generic_tag.patch
Patch0100: libkolab-0.6.0_check_for_generic_tag.patch
BuildRequires: boost-devel
BuildRequires: cmake >= 2.6
BuildRequires: libkolabxml-devel >= 1.0
BuildRequires: libqt4-devel
BuildRequires: libxerces-c-devel
BuildRequires: php-devel >= 5.3
BuildRequires: python-devel
BuildRequires: swig >= 2.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with kde}
BuildRequires: libkdepimlibs4-devel >= 4.9
%else
BuildRequires: libcalendaring-devel
%endif
%if 0%{?suse_version} < 1140
BuildRequires: uuid-devel = 1.6.2
%endif
%description
libkolab provides conversions from/to KDE containers, mime message handling and facilities
to read and write kolabv2 and kolabv3.
The Akonadi-Kolab-Resource as well as the upgradetool are based on this code.
%package -n %{libname}
Summary: Conversions from/to KDE containers
Group: Development/Libraries/C and C++
%description -n %{libname}
libkolab provides conversions from/to KDE containers, mime message handling and facilities
to read and write kolabv2 and kolabv3.
The Akonadi-Kolab-Resource as well as the upgradetool are based on this code.
%package -n php-%{libname}
Summary: PHP Bindings for libkolab
Group: Development/Languages/Other
Requires: %{libname} = %{version}
Provides: php-kolab = %{version}
%description -n php-%{libname}
libkolab provides conversions from/to KDE containers, mime message handling and facilities
to read and write kolabv2 and kolabv3.
This package provides PHP Bindings for libkolab.
%package -n python-%{libname}
Summary: Python bindings for libkolab
Group: Development/Languages/Python
Requires: %{libname} = %{version}
Provides: python-kolab = %{version}
%description -n python-%{libname}
libkolab provides conversions from/to KDE containers, mime message handling and facilities
to read and write kolabv2 and kolabv3.
This package provides Python bindings for libkolab.
%package devel
Summary: Conversions from/to KDE containers
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: libXerces-c-devel
%if %{with kde}
Requires: libkdepimlibs4-devel >= 4.9
%else
Requires: libcalendaring-devel
%endif
Requires: libkolabxml-devel >= 0.8.4
%description devel
libkolab provides conversions from/to KDE containers, mime message handling and facilities
to read and write kolabv2 and kolabv3.
The Akonadi-Kolab-Resource as well as the upgradetool are based on this code.
%prep
%setup -q
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0100 -p1
# Lower cmake requirements for SLE 11
%if 0%{?suse_version} < 1140
sed -i '3s;cmake_minimum_required(VERSION 2.6.4);cmake_minimum_required(VERSION 2.6.2);' CMakeLists.txt
%endif
%build
# cmake: with earlier releases, we have to create and cd manually, as %%cmake is not available
%if 0%{?suse_version} < 1310
%define cmake cmake
mkdir build
cd build
%endif
# TESTS: require X and most fail anyway
%cmake \
-DLibkolabxml_DIR=%{_libdir}/cmake/Libkolabxml \
%if %{with kde}
-DUSE_LIBCALENDARING=FALSE \
%else
-DUSE_LIBCALENDARING=TRUE \
%endif
-DPHP_BINDINGS=TRUE -DPHP_INSTALL_DIR=%{php_extdir} \
-DPYTHON_BINDINGS=TRUE -DPYTHON_INSTALL_DIR=%{python_sitearch} \
%if %{with tests}
-DBUILD_TESTS=TRUE \
%else
-DBUILD_TESTS=FALSE \
%endif
%if 0%{?suse_version} < 1310
-DCMAKE_INSTALL_PREFIX="%{_prefix}" \
-DLIB_INSTALL_DIR=%{_lib} \
..
%endif
make %{?_smp_mflags}
%install
# cmake: with earlier releases, we have to change dir manually, as %%cmake_install is not available
%if 0%{?suse_version} < 1310
cd build/
make DESTDIR=%{buildroot} install
%else
%cmake_install
%endif
mkdir -p %{buildroot}%{_datadir}/php5
mv %{buildroot}%{php_extdir}/*.php %{buildroot}%{_datadir}/php5/.
mkdir -p %{buildroot}%{php_confdir}
cat >%{buildroot}%{php_confdir}/kolab.ini <<EOF
; Kolab libraries
extension=kolabcalendaring.so
extension=kolabicalendar.so
extension=kolabobject.so
extension=kolabshared.so
EOF
cat >%{buildroot}%{php_confdir}/kolabdummy.ini <<EOF
; Kolab libraries
extension=dummy.so
EOF
%if %{with tests}
%check
cd build/tests
./benchmarktest || :
./calendaringtest || :
./formattest || :
./freebusytest || :
./icalendartest || :
./kcalconversiontest || :
./upgradetest || :
%endif
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files -n %{libname}
%defattr(-,root,root)
%doc COPYING* README RELEASE-NOTES
%{_libdir}/libkolab.so.*
%files -n php-%{libname}
%defattr(-,root,root)
%config(noreplace) %{php_confdir}/kolab.ini
%config(noreplace) %{php_confdir}/kolabdummy.ini
%{_datadir}/php5/kolabcalendaring.php
%{php_extdir}/kolabcalendaring.so
%{_datadir}/php5/kolabicalendar.php
%{php_extdir}/kolabicalendar.so
%{_datadir}/php5/kolabobject.php
%{php_extdir}/kolabobject.so
%{_datadir}/php5/kolabshared.php
%{php_extdir}/kolabshared.so
%{_datadir}/php5/dummy.php
%{php_extdir}/dummy.so
%files -n python-%{libname}
%defattr(-,root,root)
%dir %{python_sitearch}/kolab
%{python_sitearch}/kolab/_calendaring.so
%{python_sitearch}/kolab/calendaring.py*
%{python_sitearch}/kolab/_icalendar.so
%{python_sitearch}/kolab/icalendar.py*
%{python_sitearch}/kolab/_kolabobject.so
%{python_sitearch}/kolab/kolabobject.py*
%{python_sitearch}/kolab/_shared.so
%{python_sitearch}/kolab/shared.py*
%files devel
%defattr(-,root,root)
%{_includedir}/kolab/
%{_libdir}/libkolab.so
%{_libdir}/cmake/Libkolab/
%changelog