# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 inherit eutils multilib ssl-cert ####### There should be an ######### ########## jabber.eclass ########### JABBER_ETC="/etc/jabber" JABBER_RUN="/var/run/jabber" JABBER_SPOOL="/var/spool/jabber/ejabberd" JABBER_LOG="/var/log/jabber" ##################################### DESCRIPTION="The Erlang Jabber Daemon" HOMEPAGE="http://ejabberd.jabber.ru/" SRC_URI="http://process-one.net/en/projects/ejabberd/download/${PV}/${P}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86 ~amd64" IUSE="${IUSE} icq irc ldap msn muc odbc oscar postgres pubsub web yahoo" DEPEND="${DEPEND} net-im/jabber-base >=dev-libs/expat-1.95 >=dev-lang/erlang-10.2.0 odbc? ( dev-db/unixODBC ) ldap? ( =net-nds/openldap-2* )" RDEPEND="postgres? ( dev-db/postgresql )" PDEPEND="msn? ( net-im/msn-transport ) oscar? ( net-im/aim-transport ) yahoo? ( net-im/yahoo-transport ) icq? ( net-im/jit )" PROVIDE="virtual/jabber-server" S=${WORKDIR}/${P}/src src_compile() { local myconf use icq && \ myconf="${myconf} --enable-roster-gateway-workaround" use irc || \ myconf="${myconf} --disable-mod_irc" use ldap || \ myconf="${myconf} --disable-eldap" use muc || \ myconf="${myconf} --disable-mod_muc" use odbc || use postgres && \ myconf="${myconf} --enable-odbc" use pubsub || \ myconf="--disable-mod_pubsub" use ssl || \ myconf="${myconf} --disable-tls" use web || \ myconf="${myconf} --disable-web" econf \ ${myconf} || die "econf ailed" emake || die "emake failed" } src_install() { make \ DESTDIR=${D} \ EJABBERDDIR=${D}/usr/$(get_libdir)/erlang/lib/${P} \ ETCDIR=${D}${JABBER_ETC} \ LOGDIR=${D}${JABBER_LOG} \ install \ || die "install failed" mv ${D}${JABBER_ETC}/ejabberd.cfg ${D}${JABBER_ETC}/ejabberd.cfg.example cd .. insinto /usr/share/doc/${PF} use postgres && doins src/odbc/pg.sql dodoc doc/release_notes_{$PV}.txt dohtml doc/*.{html,png} cat < ${T}/ejabberd #!/bin/bash erl -pa /usr/$(get_libdir)/erlang/lib/${P}/ebin \\ -sname ejabberd \\ -s ejabberd \\ -ejabberd config \"${JABBER_ETC}/ejabberd.cfg\" \\ log_path \"${JABBER_LOG}/ejabberd.log\" \\ -kernel inetrc \"${JABBER_ETC}/inetrc\" \\ -sasl sasl_error_logger \{file,\"${JABBER_LOG}/sasl.log\"\} \\ -mnesia dir \"${JABBER_SPOOL}\" \\ \$@ EOF cat < ${T}/ejabberdctl #!/bin/sh exec env HOME=${JABBER_RUN} \\ erl -pa /usr/lib/erlang/lib/${P}/ebin \\ -noinput \\ -sname ejabberdctl \\ -s ejabberd_ctl \\ -extra \$@ EOF dobin ${T}/ejabberdctl dobin ${T}/ejabberd newinitd ${FILESDIR}/${PN}-1.0.0.initd ${PN} newconfd ${FILESDIR}/${PN}-1.0.0.confd ${PN} dodir ${JABBER_SPOOL} fowners jabber:jabber ${JABBER_SPOOL} insinto ${JABBER_ETC} if use ssl && [ ! -e ${JABBER_ETC}/ssl.pem ]; then docert ssl rm -f ${D}${JABBER_ETC}/ssl.{crt,csr,key} fowners jabber:jabber ${JABBER_ETC}/ssl.pem fi doins ${FILESDIR}/inetrc } pkg_postinst() { if [ ! -e ${JABBER_ETC}/ejabberd.cfg ] then einfo " " einfo "A sample configuration file has been installed in ${JABBER_ETC}/ejabberd.cfg.example." einfo "Please copy it to ${JABBER_ETC}/ejabberd.cfg and edit it according to your needs." einfo "For configuration instructions, please see /usr/share/doc/${PF}/html/guide.html" fi if [ -e /etc/ejabberd/ejabberd.cfg ] then einfo " " einfo "You seem to have upgraded from an earlier install of ejabberd and you will need" einfo "to move the spool files from /var/spool/ejabberd to ${JABBER_SPOOL}, and make sure" einfo "the owner is jabber:jabber. Also make sure the .erlang.cookie is placed in" einfo "${JABBER_RUN} also with jabber:jabber owner. Last you must move " einfo "/etc/ejabber/ejabberd.cfg to ${JABBER_ETC} and update it (look in ejabberd.cfg.example" einfo "for more information)." fi if use ssl ; then einfo " " einfo "A script to generate a ssl key has been installed in" einfo "${JABBER_ETC}/self-cert.sh . Use it and change the config file to" einfo "point to the full path" fi if ! use web ; then einfo " " einfo "The web USE flag is off, this will disable the web admin interface," einfo "if his was not the intention then add web to your USE flags." fi if ! use muc ; then einfo " " einfo "The muc USE flag is off, this will disable the Multi User Chat (MUC)" einfo "internal module, if his was not the intention then add muc to your USE flags." fi if ! use pubsub ; then einfo " " einfo "The pubsub USE flag is off, this will disable Publish-Subscribe, you probably" einfo "want this (look in JEP-0060). If this was not the intention then add pubsub to" einfo "your USE flags." fi if ! use irc ; then einfo " " einfo "The irc USE flag is off, this will disable the integrated IRC transport," einfo "if his was not the intention then add irc to your USE flags." fi }