File z-push.spec of Package z-push
#
# spec file for package z-push
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#
%define wwwroot %{_prefix}/share
%define zpush_dir %{wwwroot}/z-push
Name: z-push
Version: 2.4.5
Release: 0
Summary: An implementation of Microsoft's ActiveSync protocol
# Was http://z-push.sourceforge.net/
License: AGPL-3.0-only
Group: Productivity/Networking/Email/Utilities
URL: https://stash.z-hub.io/projects/ZP/repos/z-push
Source: %{name}-%{version}.tar.xz
Source1: z-push.conf
Source2: z-push-autodiscover.conf
Requires: php >= 5.4
Requires: php-iconv
Requires: php-mbstring
Requires: php-pcntl
Requires: php-posix
Requires: php-soap
Requires: php-sysvmsg
Requires: php-sysvsem
Requires: php-sysvshm
Recommends: php-imap
Recommends: php-curl
Suggests: apache2
Suggests: mod_php_any
BuildArch: noarch
%description
Z-push is an implementation of the ActiveSync protocol which is used
'over-the-air' for multi platform ActiveSync devices.
Devices supported are including Windows Mobile, Android,
iPhone, and Nokia. With Z-push any groupware can
be connected and synced with these devices.
%prep
%setup -q
# fix shebang
sed -i 's|^#!/usr/bin/env |#!%{_bindir}/|' src/backend/kopano/listfolders.php \
src/z-push-admin.php src/z-push-top.php
%build
%install
mkdir -p "%{buildroot}/%{zpush_dir}"
cp -a src/* "%{buildroot}/%{zpush_dir}/"
rm -f "%{buildroot}/%{zpush_dir}/"{INSTALL,LICENSE,TRADEMARKS}
mkdir -p "%{buildroot}/%{_sysconfdir}/z-push";
mkdir -p "%{buildroot}/%{_sysconfdir}/z-push/backend";
# Global config
mv "%{buildroot}/%{zpush_dir}/config.php" "%{buildroot}/%{_sysconfdir}/z-push/config.php";
ln -s "%{_sysconfdir}/z-push/config.php" "%{buildroot}/%{zpush_dir}/config.php";
# Kopano backend config
mv "%{buildroot}/%{zpush_dir}/backend/kopano/config.php" "%{buildroot}/%{_sysconfdir}/z-push/backend/kopano.config.php";
ln -s "%{_sysconfdir}/z-push/backend/kopano.config.php" "%{buildroot}/%{zpush_dir}/backend/kopano/config.php";
# Combined backend config
mv "%{buildroot}/%{zpush_dir}/backend/combined/config.php" "%{buildroot}/%{_sysconfdir}/z-push/backend/combined.config.php";
ln -s "%{_sysconfdir}/z-push/backend/combined.config.php" "%{buildroot}/%{zpush_dir}/backend/combined/config.php";
# IMAP
mv "%{buildroot}/%{zpush_dir}/backend/imap/config.php" "%{buildroot}/%{_sysconfdir}/z-push/backend/imap.config.php";
ln -s "%{_sysconfdir}/z-push/backend/imap.config.php" "%{buildroot}/%{zpush_dir}/backend/imap/config.php";
# Caldav
mv "%{buildroot}/%{zpush_dir}/backend/caldav/config.php" "%{buildroot}/%{_sysconfdir}/z-push/backend/caldav.config.php";
ln -s "%{_sysconfdir}/z-push/backend/caldav.config.php" "%{buildroot}/%{zpush_dir}/backend/caldav/config.php";
# Carddav
mv "%{buildroot}/%{zpush_dir}/backend/carddav/config.php" "%{buildroot}/%{_sysconfdir}/z-push/backend/carddav.config.php";
ln -s "%{_sysconfdir}/z-push/backend/carddav.config.php" "%{buildroot}/%{zpush_dir}/backend/carddav/config.php";
mkdir -p "%{buildroot}/%{_sysconfdir}/apache2/conf.d";
install -Dpm 644 %{SOURCE1} \
"%{buildroot}/%{_sysconfdir}/apache2/conf.d/z-push.conf";
install -Dpm 644 %{SOURCE2} \
"%{buildroot}/%{_sysconfdir}/apache2/conf.d/z-push-autodiscover.conf";
mkdir -p "%{buildroot}/%{_localstatedir}/lib/z-push";
mkdir -p "%{buildroot}/%{_localstatedir}/log/z-push";
%files
%license src/LICENSE src/TRADEMARKS
%dir %{_sysconfdir}/z-push
%dir %{_sysconfdir}/z-push/backend/
%config(noreplace) %attr(0640,root,www) %{_sysconfdir}/z-push/config.php
%config(noreplace) %attr(0640,root,www) %{_sysconfdir}/z-push/backend/kopano.config.php
%config(noreplace) %attr(0640,root,www) %{_sysconfdir}/z-push/backend/combined.config.php
%config(noreplace) %attr(0640,root,www) %{_sysconfdir}/z-push/backend/imap.config.php
%config(noreplace) %attr(0640,root,www) %{_sysconfdir}/z-push/backend/caldav.config.php
%config(noreplace) %attr(0640,root,www) %{_sysconfdir}/z-push/backend/carddav.config.php
%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/conf.d
%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/apache2/conf.d/z-push.conf
%config(noreplace) %attr(0640,root,root) %{_sysconfdir}/apache2/conf.d/z-push-autodiscover.conf
%{zpush_dir}/
%attr(750,wwwrun,www) %dir %{_localstatedir}/lib/z-push
%attr(750,wwwrun,www) %dir %{_localstatedir}/log/z-push
%changelog