zarafa/net-mail/zarafa/zarafa-7.1.5.42059.ebuild

198 lines
7.2 KiB
Bash

# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
PHP_EXT_NAME="mapi"
PHP_EXT_INI="yes"
PHP_EXT_ZENDEXT="no"
USE_PHP="php5-3 php5-4"
PYTHON_DEPEND="python? 2"
inherit eutils flag-o-matic php-ext-base-r1 python unpacker autotools versionator
DESCRIPTION="Open Source Groupware Solution"
HOMEPAGE="http://zarafa.com/"
ZARAFA_RELEASE="final"
MY_PV=$(replace_version_separator 3 '-' )
MY_PVV=$(replace_version_separator 3 'beta' $MY_PV )
MY_PVM=$(get_version_component_range 1-2 )
MY_PVR=$(get_version_component_range 1-3 )
SRC_URI="http://download.zarafa.com/community/${ZARAFA_RELEASE}/${MY_PVM}/${MY_PV}/sourcecode/zcp-${MY_PVR}.tar.gz
amd64? ( licensed? ( http://download.zarafa.com/community/${ZARAFA_RELEASE}/${MY_PVM}/${MY_PV}/zcp-${MY_PV}-ubuntu-12.04-x86_64-free.tar.gz
https://launchpad.net/ubuntu/+archive/primary/+files/libboost-system1.46.1_1.46.1-7ubuntu3_amd64.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libboost-filesystem1.46.1_1.46.1-7ubuntu3_amd64.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libssl1.0.0_1.0.1-4ubuntu5.10_amd64.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libicu48_4.8.1.1-3_amd64.deb ) )
x86? ( licensed? ( http://download.zarafa.com/community/${ZARAFA_RELEASE}/${MY_PVM}/${MY_PV}/zcp-${MY_PV}-ubuntu-12.04-i386-free.tar.gz
https://launchpad.net/ubuntu/+archive/primary/+files/libboost-system1.46.1_1.46.1-7ubuntu3_i386.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libboost-filesystem1.46.1_1.46.1-7ubuntu3_i386.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libssl1.0.0_1.0.1-4ubuntu5.10_i386.deb
https://launchpad.net/ubuntu/+archive/primary/+files/libicu48_4.8.1.1-3_i386.deb ) )"
S="${WORKDIR}"/zarafa-${MY_PVR}
ZARAFA_SERVICES="dagent gateway ical monitor search server spooler"
LICENSE="AGPL-3"
SLOT="0"
KEYWORDS="~x86 ~amd64 ~arm"
RESTRICT="mirror"
IUSE="debug kerberos icu ldap logrotate perl +python static +swig tcmalloc licensed sparsehash profiling pic"
RDEPEND=">=dev-libs/libical-0.44
>=dev-cpp/libvmime-0.9.2_pre512
virtual/httpd-php
virtual/mysql
=dev-cpp/clucene-0.9.21b*
dev-db/kyotocabinet
dev-libs/boost
dev-libs/libxml2
dev-libs/openssl
net-misc/curl
sys-libs/e2fsprogs-libs
sys-libs/zlib
icu? ( dev-libs/icu )
kerberos? ( virtual/krb5 )
ldap? ( net-nds/openldap )
logrotate? ( app-admin/logrotate )
perl? ( dev-lang/perl )
python? ( dev-lang/python )
tcmalloc? ( dev-util/google-perftools )
swig? ( <dev-lang/swig-2 )"
DEPEND="${RDEPEND}
sparsehash? ( dev-cpp/sparsehash )
dev-util/pkgconfig
sys-devel/gettext"
pkg_setup() {
python_set_active_version 2
python_pkg_setup
}
src_prepare() {
EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
edos2unix php-webclient-ajax/config.php.dist
AT_M4DIR="autoconf" eautoreconf
if use licensed; then
# not a hack just correct a script
sed -i "s!/etc/default/zarafa-ssm!/etc/conf.d/zarafa-ssm!g" "${WORKDIR}"/licensed/usr/bin/zarafa-ssm || die "sed failed"
fi
append-flags "-fPIC"
}
src_unpack() {
unpack zcp-${MY_PVR}.tar.gz
if use licensed; then
if [[ "${ARCH}" == "amd64" ]]; then
unpack zcp-${MY_PV}-ubuntu-12.04-x86_64-free.tar.gz
fi
if [[ "${ARCH}" == "x86" ]]; then
unpack zcp-${MY_PV}-ubuntu-12.04-i386-free.tar.gz
fi
pushd "${WORKDIR}"
mkdir licensed
cd licensed
unpack_deb $(find ./../ -name "zarafa-licensed*.deb")
unpack_deb $(find ./../ -name "zarafa-client*.deb")
unpack_deb $(find ./../../ -name "libboost-system1.46.1*.deb")
unpack_deb $(find ./../../ -name "libboost-filesystem1.46.1*.deb")
unpack_deb $(find ./../../ -name "libssl1.0.0*.deb")
unpack_deb $(find ./../../ -name "libicu48*.deb")
popd
fi
cd "${S}"
}
src_configure() {
append-flags -fpermissive
econf \
--enable-oss \
--disable-testtools \
--enable-release \
--enable-unicode \
--enable-epoll \
--with-userscript-prefix=/etc/zarafa/userscripts \
--with-quotatemplate-prefix=/etc/zarafa/quotamails \
--with-searchscripts-prefix=/etc/zarafa/searchscripts \
$(use_with pic) \
$(use_enable icu) \
$(use_enable static) \
$(use_enable perl) \
$(use_enable python) \
$(use_enable swig) \
$(use_enable tcmalloc)
$(use_enable profiling) \
$(use_enable sparsehash) \
$(use_enable debug)
}
src_compile() {
find swig -type f | xargs touch
emake || die "emake failed"
}
src_install() {
make DESTDIR="${D}" install || die "make install failed"
make DESTDIR="${D}" install-ajax-webaccess || die "make install-ajax-webaccess failed"
#make DESTDIR="${D}" install-mobile-webaccess || die "make install-mobile-webaccess failed"
php-ext-base-r1_src_install
if [[ "${ARCH}" == "x86" || "${ARCH}" == "amd64" ]]; then
dobin "${WORKDIR}"/licensed/usr/bin/zarafa-ssm || die "Failed to install licensed binaries"
make_wrapper zarafa-licensed "/opt/zarafa/bin/zarafa-licensed" /opt/zarafa/bin /opt/zarafa/$(get_libdir)
make_wrapper zarafa-report "/opt/zarafa/bin/zarafa-report" /opt/zarafa/bin /opt/zarafa/$(get_libdir)
if use licensed; then
ZARAFA_SERVICES="${ZARAFA_SERVICES} licensed"
into /opt/zarafa
dobin "${WORKDIR}"/licensed/usr/bin/zarafa-{licensed,report} || die "Failed to install licensed binaries"
dolib.so $(find ${WORKDIR}/licensed -name "*.so*")
doman "${WORKDIR}"/licensed/usr/share/man/*/zarafa-*.gz || die "Failed to install man files"
dodoc "${WORKDIR}"/licensed/usr/share/doc/zarafa-licensed/* || die "Failed to install docs"
insinto /etc/zarafa
doins -r "${WORKDIR}"/licensed/etc/zarafa/* || die "Failed to install config files"
insinto /etc/cron.d
doins "${WORKDIR}"/licensed/etc/cron.d/* || die "Failed to install cron files"
doconfd "${WORKDIR}"/licensed/etc/default/zarafa-ssm || die "Failed to install sysconfig files"
fi
fi
insinto /etc/apache2/modules.d
#newins "${FILESDIR}/50_zarafa-webaccess-mobile.conf" 50_zarafa-webaccess-mobile.conf || die "Failed to install apache config files"
newins "${FILESDIR}/50_zarafa-webaccess.conf" 50_zarafa-webaccess.conf || die "Failed to install apache config files"
rm "${D}"/usr/share/zarafa-webaccess/*.conf || die "Failed to remove apache config files"
#rm "${D}"/usr/share/zarafa-webaccess-mobile/*.conf || die "Failed to remove apache config files"
rm "${D}"/etc/conf.d/zarafa || die "Failed to remove wrong file files"
exeinto /etc/zarafa/userscripts/
newexe "${FILESDIR}"/junklearn.dspam junklearn
if use logrotate; then
insinto /etc/logrotate.d
newins "${FILESDIR}"/zarafa.logrotate zarafa || die "Failed to install logrotate"
fi
if use ldap; then
insinto /etc/openldap/schema
doins installer/ldap/zarafa.* || die "Failed to install ldap schema files"
fi
insinto /etc/zarafa
doins "${S}"/installer/linux/*.cfg || die "Failed to install config files"
dodir /var/log/zarafa
keepdir /var/log/zarafa
for service in ${ZARAFA_SERVICES}; do
newconfd "${FILESDIR}/zarafa-${service}.confd" "zarafa-${service}"
newinitd "${FILESDIR}/zarafa-${service}.initd" "zarafa-${service}"
done
}