# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils multilib ssl-cert versionator JABBER_ETC="/etc/jabber" JABBER_RUN="/var/run/jabber" JABBER_SPOOL="/var/spool/jabber" JABBER_LOG="/var/log/jabber" DESCRIPTION="The Erlang Jabber Daemon" HOMEPAGE="http://ejabberd.jabber.ru/" RESTRICT="primaryuri" SRC_URI="http://process-one.net/en/projects/${PN}/download/${PV}/${P}.tar.gz mod_presence? ( http://linuxlovers.at/site/files/${P}-presence-pixmaps.tar.gz )" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="mod_irc mod_muc mod_pubsub ldap odbc web postgres mysql mod_proxy mod_presence mod_statsdx" DEPEND="${RDEPEND} >=net-im/jabber-base-0.01 >=dev-libs/expat-1.95 >=dev-lang/erlang-10.2.0 " # odbc? ( dev-db/unixODBC ) # ldap? ( =net-nds/openldap-2* ) # postgres? ( =dev-erl/${E_PGSQL} ) # mysql? ( =dev-erl/${E_MYSQL} )" #RDEPEND="postgres? ( dev-db/postgresql ) # mysql? ( dev-db/mysql )" PROVIDE="virtual/jabber-server" S=${WORKDIR}/${P}/src src_unpack() { unpack ${A} MYSQL_P=$(best_version dev-db/mysql) MYSQL_PV=${MYSQL_P/dev-db\/mysql-/} # # If we have to work with MySQL 4.1 or greater, ejabberd's native # MySQL-driver has to be patched to query "SET NAMES 'utf8'" on connecting # the database. # if use mysql && \ (( \ [ $(get_major_version ${MYSQL_PV}) -eq 4 ] && \ [ $(get_major_version $(get_after_major_version ${MYSQL_PV})) -ge 1] \ ) \ || \ [ $(get_major_version ${MYSQL_PV}) -ge 5 ] \ ); then epatch ${FILESDIR}/${P}-mysql-connect-utf8.patch fi if use mod_presence; then epatch ${FILESDIR}/${P}-mod-presence.patch fi if use mod_statsdx; then epatch ${FILESDIR}/${P}-statsdx.patch epatch ${FILESDIR}/${P}-statsdx-web.patch fi if use mod_proxy; then epatch ${FILESDIR}/${P}-mod-proxy.patch fi } src_compile() { econf ${myconf} \ $(use_enable mod_irc) \ $(use_enable ldap eldap) \ $(use_enable mod_muc) \ $(use_enable mod_pubsub) \ $(use_enable ssl tls) \ $(use_enable web) \ $(use_enable odbc) \ || die "econf failed" emake || die "compiling ejabberd core 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" insinto /usr/share/doc/${PF} use postgres && doins odbc/pg.sql use mysql && doins odbc/mysql.sql dodoc doc/release_notes_${PV}.txt dohtml doc/*.{html,png} use postgres && { pa="-pa /usr/$(get_libdir)/erlang/lib/${E_PGSQL}/ebin" } use mysql && { pa=${pa}" -pa /usr/$(get_libdir)/erlang/lib/${E_MYSQL}/ebin" } # # Create /usr/bin/ejabberd # cat < ${T}/ejabberd #!/bin/bash erl -pa /usr/$(get_libdir)/erlang/lib/${P}/ebin \\ ${pa} \\ -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 # # Create /usr/bin/ejabberdctl # cat < ${T}/ejabberdctl #!/bin/sh exec env HOME=${JABBER_RUN} \\ erl -pa /usr/$(get_libdir)/erlang/lib/${P}/ebin \\ ${pa} \\ -noinput \\ -sname ejabberdctl \\ -s ejabberd_ctl \\ -extra \$@ EOF dobin ${T}/ejabberdctl dobin ${T}/ejabberd newinitd ${FILESDIR}/${P}.initd ${PN} newconfd ${FILESDIR}/${P}.confd ${PN} insinto ${JABBER_ETC} if use ssl; 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 "Configuration file has been installed in ${JABBER_ETC}/ejabberd.cfg." einfo "Edit it according to your needs. For configuration instructions," einfo "please see /usr/share/doc/${PF}/html/guide.html" fi # if use ssl ; then #there einfo "A script to generate a ssl key has been installed in" #is no einfo "${JABBER_ETC}/self-cert.sh . Use it and change the config file to" #script? einfo "point to the full path" # fi if use ssl ; then einfo "SSl is enabled, please change all references to ./ssl.pem" einfo "in your ejabberd.cfg to a full path, for example" einfo "/etc/jabber/ssl.pem (which was created by a script)." fi if ! use web ; then einfo "The web USE flag is off, this will disable the web admin interface," einfo "if this was not the intention then add web to your USE flags." fi if use mod_muc ; then einfo "To enable MUC-Logging, create a directory in your Webhost" einfo "and enable something like these lines in your ejabberd.cfg: " einfo "{mod_muc_log, [{access_log, muc}," einfo " {cssfile, \"http://jabber.linuxlovers.at/muclog.css\"}, " einfo " {dirtype, plain}, " einfo " {outdir, \"/var/www/jabber.linuxlovers.at/htdocs/muclog\"}," einfo " {timezone, local}, " einfo " {top_link, {\"http://linuxlovers.at/site\", \"LinuxLovers.at\"}} " einfo "]}, " einfo " " fi if use mod_proxy ; then einfo "mod_proxy enabled! Visit http://ejabberd.jabber.ru/mod_proxy65" einfo "for more information. Sample configuration in ejabberd.cfg." fi if use mod_statsdx ; then einfo "Advanced stats module installed ! http://ejabberd.jabber.ru/mod_statsdx" einfo "You will need a line like {mod_statsdx, [{hooks, false}]}," fi if use mod_presence ; then einfo "Web Presence 0.0.4 enabled! Visit http://ejabberd.jabber.ru/mod_presence" einfo " more information. Small note: you need a line like" einfo " {mod_presence, [{access, local}]}," einfo "somewhere in the modules section of your ejabberd.cfg." fi }