File kopano-webapp.spec of Package kopano-webapp

Name:           kopano-webapp
Summary:        The next-generation web client of Kopano
License:        AGPL-3.0
Group:          Productivity/Networking/Email/Clients
Version:        2.2.0
Release:	0
Url:            http://www.kopano.com

Source:         %{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires:	fdupes
BuildRequires:	ant
BuildRequires:	java >= 1.6.0
BuildRequires:	java-devel >= 1.6.0
BuildRequires:	ant-nodeps
%endif
%if 0%{?centos_version} == 600
BuildRequires:	java-1.7.0-openjdk-devel
BuildRequires:	ant-nodeps
BuildRequires:	ant
%endif
%if 0%{?centos_version} == 700 || 0%{?rhel_version} == 700 || 0%{?fedora_version} == 20
BuildRequires:	java-1.7.0-openjdk-devel
BuildRequires:	ant
%endif
%if 0%{?fedora_version} >= 21
BuildRequires:	java-1.8.0-openjdk-devel
BuildRequires:	ant
%endif

BuildRequires:	php
BuildRequires:	xz
%if 0%{?suse_version} >= 1220
BuildRequires:	libxml2-tools
%else
BuildRequires:	libxml2
%endif
BuildArch:	noarch

# The language files are just in a separate package just to keep the
# file lists relatively short. They are still needed by the base in any case.
Requires:       %name-lang = %version
Requires:       php-mapi >= 7.2.5

%if "%_repository" == "RHEL_6_PHP_56" || "%_repository" == "RHEL_7_PHP_56"
Requires:	rh-php56-php-common  rh-php56-php-xml rh-php56-php-mbstring
%endif

%if "%_repository" == "RHEL_6" || "%_repository" == "RHEL_7"
Requires:	php-common php-xml php-curl php-mbstring
%endif

%if "%_repository" == "SLE_12" || "%_repository" == "SLE_12_PHP7" || "%_repository" == "SLE_15" || "%_repository" == "openSUSE_Leap_15.1" || "%_repository" == "openSUSE_Leap_15.2" || "%_repository" == "openSUSE_Tumbleweed"
Requires:       php-iconv php-zlib php-openssl php-gettext php-xml php-json php-zip php-mbstring
%endif

# Delayed delivery is now in Kopano-WebApp
Obsoletes: kopano-webapp-plugin-delayeddelivery
Provides:  kopano-webapp-plugin-delayeddelivery

%define langdir %_datadir/%name/server/language
%define plugindir %_datadir/%name/plugins

%if 0%{?suse_version}
    %define apache_dir %_sysconfdir/apache2
%else
	%if "%_repository" == "RHEL_6_PHP_56" || "%_repository" == "RHEL_7_PHP_56"
		%define apache_dir /opt/rh/httpd24/root/etc/httpd/
	%else
		%define apache_dir %_sysconfdir/httpd
	%endif
%endif

%description
Provides a web-client written in PHP that makes use of HTML5, JSON and ExtJS
to allow users to make full use of the Kopano
through a modern web browser.

%package lang
Summary:        Languages for package %name
Group:          System/Localization

%description lang
Provides translations to the package %name.

%package plugin-contactfax
Summary:        Contact fax plugin for kopano-webapp
Group:          Productivity/Networking/Email/Clients

%description plugin-contactfax
Opens a new "create mail" dialog with contact's fax number in the To:
field of the email.

%package plugin-folderwidgets
Summary:        Folder widgets plugin for kopano-webapp
Group:          Productivity/Networking/Email/Clients

%description plugin-folderwidgets
A collection of widgets which can show the contents of some of the
default folders for a user.

%package plugin-gmaps
Summary:        Google Maps plugin for kopano-webapp
Group:          Productivity/Networking/Email/Clients

%description plugin-gmaps
Shows contact address on Google Maps with Kopano WebApp.

%package plugin-pimfolder
Summary:        Personal Inbox Management plugin for WebApp
Group:          Productivity/Networking/Email/Clients

%description plugin-pimfolder
Kopano PIM plugin, allows you to set-up a folder quickly moving
your mail to another folder

%package plugin-quickitems
Summary:        Quick Items plugin for kopano-webapp
Group:          Productivity/Networking/Email/Clients

%description plugin-quickitems
Special widgets for easily creating new Mails, Appointments, Contacts,
Tasks and Notes.

%package plugin-titlecounter
Summary:        Titlecounter plugin for kopano-webapp
Group:          Productivity/Networking/Email/Clients

%description plugin-titlecounter
Displays the current amount of unread emails in your browser title.

%package plugin-webappmanual
Summary:        Adds direct WebApp Manual usage
Group:          Productivity/Networking/Email/Clients

%description plugin-webappmanual
Adds a button for direct usage to online documentation of WebApp

%package plugin-zdeveloper
Summary:        Developer plugin for kopano-webapp
Group:          Development/Debug

%description plugin-zdeveloper
Shows all available insertion points on the screen.

%prep
%setup -qn %{name}-%{version}
find . -type f "(" -name "*.js" -o -name "*.php" ")" \
	-exec chmod a-x "{}" "+";
# Set git revision
echo "%{version}-%{release}" > version

%build

ant deploy deploy-plugins;

%install
b="%buildroot";
d="$b/%_datadir";
mkdir -p "$d";
cp -a deploy "$d/%name";

# Install LICENSE.txt
install -m644 LICENSE.txt "$d/%name/LICENSE.txt"

# Apache conf
mkdir -p "$b/%apache_dir/conf.d";
install -Dpm 644 "$d/%name/%name.conf" "$b/%apache_dir/conf.d/%name.conf";

# WebApp config
mkdir -p "$b/%_sysconfdir/kopano/webapp"
mv "$d/%name/config.php.dist" "$b/%_sysconfdir/kopano/webapp/config.php"
ln -s "%_sysconfdir/kopano/webapp/config.php" "$b/%_datadir/kopano-webapp/config.php"
rm "$d/%name/debug.php.dist"
mkdir -p "$b/var/lib/%name/tmp"

# Signatures template scripts
mkdir -p "$b/%_datadir/doc/kopano-webapp/scripts"
cp -a tools/signatures "$b/%_datadir/doc/kopano-webapp/scripts/"

for dir in "$d/%name/plugins"/*; do 
	plugindir=$(basename "$dir")
	if [ -f "$d/%name/plugins/$plugindir/config.php" ];
	then
		mv "$d/%name/plugins/$plugindir/config.php" "$b/%_sysconfdir/kopano/webapp/config-$plugindir.php"
		ln -s "%_sysconfdir/kopano/webapp/config-$plugindir.php" "$d/%name/plugins/$plugindir/config.php"
	else
		echo "we did not find a config.php"
	fi
done

%if 0%{?fdupes:1}
%fdupes %buildroot/%_prefix
%endif

%files
%defattr(-,root,root)
%_datadir/%name
# signature templates
%_datadir/doc/%name
%exclude %plugindir/*
%exclude %langdir
%dir %_sysconfdir/kopano
%dir %_sysconfdir/kopano/webapp

%dir %apache_dir
%dir %apache_dir/conf.d

%if 0%{?suse_version}
%config(noreplace) %attr(0640,root,www) %_sysconfdir/kopano/webapp/config.php
%config(noreplace) %attr(0640,root,www) %apache_dir/conf.d/kopano-webapp.conf
%dir %attr(0770,root,www) /var/lib/kopano-webapp
%else
%config(noreplace) %attr(0640,root,apache) %_sysconfdir/kopano/webapp/config.php
%config(noreplace) %attr(0640,root,apache) %apache_dir/conf.d/kopano-webapp.conf
%dir %attr(0770,root,apache) /var/lib/kopano-webapp
%endif

%if 0%{?suse_version}
%dir %attr(0775, wwwrun, www) /var/lib/kopano-webapp/tmp
%else
%dir %attr(0775, apache, apache) /var/lib/kopano-webapp/tmp
%endif

%config(noreplace) %_datadir/%name/.htaccess

%files lang
%defattr(-,root,root)
%dir %langdir
%lang(ca_ES) %langdir/ca_ES.UTF-8
%lang(cs_CZ) %langdir/cs_CZ.UTF-8
%lang(da_DK) %langdir/da_DK.UTF-8
%lang(de_DE) %langdir/de_DE.UTF-8
%lang(en_US) %langdir/en_US.UTF-8
%lang(es_CA) %langdir/es_CA.UTF-8
%lang(es_ES) %langdir/es_ES.UTF-8
%lang(fi_FI) %langdir/fi_FI.UTF-8
%lang(fr_FR) %langdir/fr_FR.UTF-8
%lang(he_IL) %langdir/he_IL.UTF-8
%lang(hu_HU) %langdir/hu_HU.UTF-8
%lang(it_IT) %langdir/it_IT.UTF-8
%lang(ja_JP) %langdir/ja_JP.UTF-8
%lang(lt_LT) %langdir/lt_LT.UTF-8
%lang(nb_NO) %langdir/nb_NO.UTF-8
%lang(nl_NL) %langdir/nl_NL.UTF-8
%lang(pl_PL) %langdir/pl_PL.UTF-8
%lang(pt_BR) %langdir/pt_BR.UTF-8
%lang(pt_PT) %langdir/pt_PT.UTF-8
%lang(ru_RU) %langdir/ru_RU.UTF-8
%lang(sv_SE) %langdir/sv_SE.UTF-8
%lang(uk_UA) %langdir/uk_UA.UTF-8
%lang(zh_CN) %langdir/zh_CN.UTF-8

%files plugin-contactfax
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/contactfax
%config(noreplace) %_sysconfdir/kopano/webapp/config-contactfax.php

%files plugin-folderwidgets
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/folderwidgets

%files plugin-gmaps
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/gmaps
%config(noreplace) %_sysconfdir/kopano/webapp/config-gmaps.php

%files plugin-pimfolder
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/pimfolder
%config(noreplace) %_sysconfdir/kopano/webapp/config-pimfolder.php

%files plugin-quickitems
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/quickitems

%files plugin-titlecounter
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/titlecounter
%config(noreplace) %_sysconfdir/kopano/webapp/config-titlecounter.php

%files plugin-webappmanual
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/webappmanual
%config(noreplace) %_sysconfdir/kopano/webapp/config-webappmanual.php

%files plugin-zdeveloper
%defattr(-,root,root)
%dir %_datadir/%name
%dir %plugindir
%plugindir/zdeveloper
%config(noreplace) %_sysconfdir/kopano/webapp/config-zdeveloper.php

%changelog
* Wed Apr 27 2016 development@kopano.io
- Current release
openSUSE Build Service is sponsored by