File libkolab.spec of Package libkolab

#
# spec file for package libkolab
#
# Copyright (c) 2012 SUSE LINUX Products 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/
#


%global phpdir php5
%global php_extdir %{_libdir}/%{phpdir}/extensions
%global php_inidir %{_sysconfdir}/%{phpdir}/conf.d

Name:           libkolab
Version:        0.4.1
Release:        0
%define soname  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:            http://wiki.kolab.org/Kolab_3.0_development#libkolab
Source:         http://mirror.kolabsys.com/pub/releases/%{name}-%{version}.tar.gz
# Patch to hack SWIGUtils.cmake to find PHP5 on openSUSE
Patch0:         fix_php5_bindings.diff
BuildRequires:  libkdepimlibs4-devel
BuildRequires:  libkolabxml-devel
BuildRequires:  libxerces-c-devel
BuildRequires:  php5-devel
BuildRequires:  python-devel
BuildRequires:  swig
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%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 %{name}%{soname}
Summary:        Conversions from/to KDE containers
Group:          Development/Libraries/C and C++

%description -n %{name}%{soname}
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-%{name}%{soname}
Summary:        PHP Bindings for libkolab
Group:          Development/Languages/Other
Provides:       php-kolab = %{version}

%description -n php-%{name}%{soname}
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-%{name}%{soname}
Summary:        Python bindings for libkolab
Group:          Development/Languages/Python
Provides:       python-kolab = %{version}

%description -n python-%{name}%{soname}
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:       %{name}%{soname} = %{version}
Requires:       libkdepimlibs4-devel
Requires:       libkolabxml-devel
Requires:       libxerces-c-devel

%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
%patch0 -p0

%build
  export CXXFLAGS="%{optflags}"
  export CFLAGS="$CXXFLAGS"

  mkdir build
  cd build

  cmake -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
        -DLIB_INSTALL_DIR="%{_lib}" \
        -DCMAKE_SKIP_RPATH=TRUE \
        -DCMAKE_BUILD_TYPE=RELEASE \
        -DPHP_BINDINGS=TRUE -DPHP_INSTALL_DIR=%{php_extdir} \
        -DPYTHON_BINDINGS=TRUE -DPYTHON_INSTALL_DIR=%{python_sitearch} \
        ..

  make %{?_smp_mflags}

%install
  cd build
  make DESTDIR=%{buildroot} install

  mkdir -p %{buildroot}/%{_datadir}/%{phpdir}
  mv %{buildroot}/%{php_extdir}/*.php %{buildroot}/%{_datadir}/%{phpdir}/.

  mkdir -p %{buildroot}/%{php_inidir}
  cat >%{buildroot}/%{php_inidir}/kolab.ini <<EOF
; Kolab libraries
extension=kolabformat.so
extension=kolabshared.so
extension=kolabobject.so
extension=kolabcalendaring.so
EOF

%post -n %{name}%{soname} -p /sbin/ldconfig
%postun -n %{name}%{soname} -p /sbin/ldconfig

%files -n %{name}%{soname}
%defattr(-,root,root)
%doc COPYING* README RELEASE-NOTES
%{_libdir}/libkolab.so.*

%files -n php-%{name}%{soname}
%defattr(-,root,root)
%config(noreplace) %{php_inidir}/kolab.ini
%{_datadir}/%{phpdir}/kolabcalendaring.php
%{php_extdir}/kolabcalendaring.so
%{_datadir}/%{phpdir}/kolabicalendar.php
%{php_extdir}/kolabicalendar.so
%{_datadir}/%{phpdir}/kolabobject.php
%{php_extdir}/kolabobject.so
%{_datadir}/%{phpdir}/kolabshared.php
%{php_extdir}/kolabshared.so

%files -n python-%{name}%{soname}
%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/_shared.so*
%{python_sitearch}/kolab/shared.py*

%files devel
%defattr(-,root,root)
%{_includedir}/kolab/
%{_libdir}/libkolab.so
%{_libdir}/cmake/Libkolab/

%changelog
openSUSE Build Service is sponsored by