File horde5-turba.spec of Package horde5-turba

#
# spec file for package horde5-turba
#
# Copyright (c) 2013 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/
#


%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear)
%define xmldir  /var/lib/pear
%define hordedir /usr/share/php5/PEAR/www/horde

Summary:        Turba: A web based addressbook
License:        Apache-1.1
Group:          Productivity/Networking/Web/Utilities

Name:           horde5-turba
Version:        4.0.1
Release:        0
Source0:        http://pear.horde.org/get/turba-%{version}.tgz
Source1:        turba.conf
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://pear.horde.org/package/turba
BuildRequires:  fdupes
BuildRequires:  horde5 >= 5.0.2
BuildRequires:  php >= 5.3.0
BuildRequires:  php-pear >= 1.7.0
BuildRequires:  php5-pear-Horde_Role >= 1.0.1
BuildRequires:  php5-pear-channel-horde

Requires:       horde5 >= 5.0.2
Requires:       php >= 5.3.0
Requires:       php-pear >= 1.7.0
Requires:       php5-pear-Horde_Role >= 1.0.1
Requires:       php5-pear-channel-horde

Requires:       php5-pear-Horde_Auth >= 2.0.0
Requires:       php5-pear-Horde_Core >= 2.0.0
Requires:       php5-pear-Horde_Data >= 2.0.0
Requires:       php5-pear-Horde_Date >= 2.0.0
Requires:       php5-pear-Horde_Exception >= 2.0.0
Requires:       php5-pear-Horde_Form >= 2.0.0
Requires:       php5-pear-Horde_Group >= 2.0.0
Requires:       php5-pear-Horde_History >= 2.0.0
Requires:       php5-pear-Horde_Icalendar >= 2.0.0
Requires:       php5-pear-Horde_Mail >= 2.0.0
Requires:       php5-pear-Horde_Mime >= 2.0.0
Requires:       php5-pear-Horde_Nls >= 2.0.0
Requires:       php5-pear-Horde_Perms >= 2.0.0
Requires:       php5-pear-Horde_Prefs >= 2.0.0
Requires:       php5-pear-Horde_Serialize >= 2.0.0
Requires:       php5-pear-Horde_Share >= 2.0.0
Requires:       php5-pear-Horde_Support >= 2.0.0
Requires:       php5-pear-Horde_Url >= 2.0.0
Requires:       php5-pear-Horde_Util >= 2.0.0
Requires:       php5-pear-Horde_View >= 2.0.0
# binaries
Requires:       php-gettext
Requires:       php-hash
Requires:       php-json
# not so optional
Requires:       php5-pear-Horde_Db >= 2.0.0
# optional
Suggests:       php5-pear-Horde_ActiveSync >= 2.0.0
Suggests:       php5-pear-Horde_Imsp >= 2.0.0
Suggests:       php5-pear-Horde_Ldap >= 2.0.0
Suggests:       php5-pear-Horde_Service_Facebook >= 2.0.0

BuildArch:      noarch

%description
Turba is the Horde contact management application.
Leveraging the Horde framework to provide seamless integration with IMP and other Horde applications,
it supports storing contacts in SQL, LDAP, Kolab, and IMSP address books.

%prep
%setup -c -T
pear -v -c pearrc \
        -d php_dir=%{peardir} \
        -d doc_dir=%{_docdir}/%{name} \
        -d bin_dir=%{_bindir} \
        -d data_dir=%{peardir}/data \
        -d test_dir=%{peardir}/tests \
        -d ext_dir=%{_libdir} \
        -d horde_dir=%{hordedir} \
        -s

%build

%install
pear -c pearrc install --nodeps --packagingroot %{buildroot} %{SOURCE0}
## configs written by the web configurator should go to etc
%{__mkdir_p} %{buildroot}/etc/horde/
%{__mv} %{buildroot}/%{hordedir}/turba/config %{buildroot}/etc/horde/turba
%{__ln_s} /etc/horde/turba %{buildroot}/%{hordedir}/turba/config

## we provide an own apache config and delete the htaccess files
%{__install} -m 0660 -D  %{SOURCE1} %{buildroot}/etc/horde/apache-snippets.d/turba.conf
%{__rm} %{buildroot}/%{hordedir}/turba/lib/.htaccess
%{__rm} %{buildroot}/%{hordedir}/turba/locale/.htaccess
%{__rm} %{buildroot}/%{hordedir}/turba/templates/.htaccess
%{__rm} %{buildroot}/%{peardir}/data/turba/scripts/.htaccess
%{__rm} %{buildroot}/etc/horde/turba/.htaccess

%fdupes %buildroot%{hordedir}/turba
%find_lang turba 

# Clean up unnecessary files
rm pearrc
rm %{buildroot}/%{peardir}/.filemap
rm %{buildroot}/%{peardir}/.lock
rm -rf %{buildroot}/%{peardir}/.registry
rm -rf %{buildroot}%{peardir}/.channels
rm %{buildroot}%{peardir}/.depdb
rm %{buildroot}%{peardir}/.depdblock

# Install XML package description
mkdir -p %{buildroot}%{xmldir}
tar -xzf %{SOURCE0} package.xml
cp -p package.xml %{buildroot}%{xmldir}/turba.xml

%clean
rm -rf %{buildroot}

%post
pear install --nodeps --soft --force --register-only %{xmldir}/turba.xml

%postun
if [ "$1" -eq "0" ]; then
    pear uninstall --nodeps --ignore-errors --register-only pear.horde.org/turba
fi

%files -f turba.lang
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%{peardir}/*
%{xmldir}/turba.xml
%{hordedir}/turba
%attr(0775,root,www) %{hordedir}/turba/config
%{_bindir}/turba-convert-datatree-shares-to-sql
%{_bindir}/turba-convert-sql-shares-to-sqlng
%{_bindir}/turba-import-squirrelmail-file-abook
%{_bindir}/turba-import-squirrelmail-sql-abook
%{_bindir}/turba-import-vcards
%{_bindir}/turba-public-to-horde-share
%config /etc/horde/apache-snippets.d/turba.conf
%attr(0750,wwwrun,www) %dir /etc/horde/turba
%attr(0640,wwwrun,www) %config /etc/horde/turba/*

%changelog
openSUSE Build Service is sponsored by