File kolab-freebusy.spec of Package kolab-freebusy

#
# spec file for package kolab-freebusy
#
# Copyright (c) 2014-2015 Aeneas Jaissle <aj@ajaissle.de>
# Copyright (c) 2013 Kolab Systems AG, Zuerich, Switzerland.
#
# 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://issues.kolab.org/
#


%global roundcubepath %{apache_datadir}/roundcubemail
%global roundcubeconfigpath %{_sysconfdir}/roundcubemail
Name:           kolab-freebusy
Version:        1.0.7
Release:        0
Summary:        Kolab Free/Busy Web Presentation Layer
License:        AGPL-3.0+
Group:          Productivity/Networking/Other

Url:            https://kolab.org/
# http://mirror.kolabsys.com/pub/releases/%%{name}-%%{version}.tar.gz
Source0:        %{name}-%{version}+dep.tar.gz
Source1:        %{name}-httpd.conf
Source2:        %{name}.logrotate

# PATCH-FIX-UPSTREAM 0001-Consider-recurrence-exceptions-when-computing-busy-t.patch
Patch1:         0001-Consider-recurrence-exceptions-when-computing-busy-t.patch
# PATCH-FIX-UPSTREAM kolab-freebusy-1.0.7_use_global_rc-framework.patch
Patch10:        %{name}-1.0.7_use_global_rc-framework.patch

BuildArch:      noarch
BuildRequires:  apache-rpm-macros
# Requiring the configuration from roundcubemail
BuildRequires:  roundcubemail >= 1.0
# Requiring the plugins 'libcalendaring', 'libkolab' from roundcubemail-plugins-kolab
BuildRequires:  roundcubemail-plugins-kolab >= 3.1
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Requires:       http_daemon
Requires:       mod_php_any >= 5.3
Requires:       php-pear-Net_LDAP2
Requires:       php-pear-Net_LDAP3
Requires:       roundcube_framework >= 1.0.90
# Requiring the configuration from roundcubemail
Requires:       roundcubemail >= 1.0.90
# Requiring the plugins 'libcalendaring', 'libkolab' from roundcubemail-plugins-kolab
Requires:       roundcubemail-plugins-kolab >= 3.1.90

Recommends:     logrotate
# For Free/Busy data generation
Recommends:     kolab-utils

%description
Kolab is a secure, scalable and reliable groupware server. It is formed by a 
number of well-known and proven components and adds intelligent interaction between them.

This software enables a multi-sourced publication of Free/Busy information for its users.

%prep
%setup -q
%patch1 -p1
%patch10 -p1

# remove unused .htaccess file
find . -type f -name ".htaccess" -delete
# remove external libraries
rm -rf lib/Roundcube/
# remove obsolete plugins contained in roundcubemail-plugins-kolab
rm -rf lib/plugins/*
# remove cruft
find . -type f -name ".git*" -delete
find . -type f -name ".*.yml" -delete

%build

%install
install -d \
    %{buildroot}%{apache_sysconfdir}/conf.d \
    %{buildroot}%{_sysconfdir}/logrotate.d \
    %{buildroot}%{_sysconfdir}/%{name} \
    %{buildroot}%{apache_datadir}/%{name} \
    %{buildroot}%{apache_datadir}/%{name}/config \
    %{buildroot}%{_localstatedir}/cache/%{name} \
    %{buildroot}%{_localstatedir}/log/%{name}

# apache config
sed -e "s#__FREEBUSY_ROOT__#%{apache_datadir}/%{name}#g" %{SOURCE1} > \
  %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf

cp -a lib %{buildroot}%{apache_datadir}/%{name}/lib
cp -a public_html %{buildroot}%{apache_datadir}/%{name}/public_html
cp -a vendor %{buildroot}%{apache_datadir}/%{name}/vendor

# configuration
cp -a config/config.ini.sample %{buildroot}%{_sysconfdir}/%{name}/config.ini

# configuration links
ln -s %{_sysconfdir}/%{name}/config.ini %{buildroot}%{apache_datadir}/%{name}/config/config.ini

# var links
ln -s %{_localstatedir}/log/%{name} %{buildroot}%{apache_datadir}/%{name}/logs

# logrotate config
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

# roundcube plugins
for plugin in libcalendaring libkolab; do
    ln -s %{roundcubepath}/plugins/${plugin} %{buildroot}%{apache_datadir}/%{name}/lib/plugins/${plugin}
done

# roundcube configuration
for config in config defaults; do
    ln -s %{roundcubeconfigpath}/${config}.inc.php %{buildroot}%{apache_datadir}/%{name}/config/${config}.inc.php
done

%pre
if [ -L "%{apache_datadir}/%{name}/config" ]; then
    rm -rf "%{apache_datadir}/%{name}/config"
fi
for plugin in libcalendaring libkolab; do
    if [ -d "%{apache_datadir}/%{name}/lib/plugins/${plugin}" ]; then
        if ! [ -L "%{apache_datadir}/%{name}/lib/plugins/${plugin}" ]; then
            rm -rf "%{apache_datadir}/%{name}/lib/plugins/${plugin}"
        fi
    fi
done

%files
%defattr(-,root,root)
%doc README.md config/config.ini.sample
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%attr(0750,root,%{apache_group}) %dir %{_sysconfdir}/%{name}
%attr(0640,root,%{apache_group}) %config(noreplace) %{_sysconfdir}/%{name}/config.ini
%dir %{apache_datadir}/%{name}
%{apache_datadir}/%{name}/config/
%{apache_datadir}/%{name}/lib/
%{apache_datadir}/%{name}/public_html/
%{apache_datadir}/%{name}/vendor/
%{apache_datadir}/%{name}/logs
%attr(0750,%{apache_user},root) %{_localstatedir}/log/%{name}
%attr(0750,%{apache_user},root) %{_localstatedir}/cache/%{name}

%changelog
openSUSE Build Service is sponsored by