/[gentoo-x86]/net-im/ejabberd/ejabberd-2.1.11.ebuild
Gentoo

Contents of /net-im/ejabberd/ejabberd-2.1.11.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Sun Sep 23 08:22:11 2012 UTC (23 months, 4 weeks ago) by phajdan.jr
Branch: MAIN
Changes since 1.3: +2 -2 lines
x86 stable wrt bug #427714

(Portage version: 2.1.11.9/cvs/Linux i686)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-im/ejabberd/ejabberd-2.1.11.ebuild,v 1.3 2012/09/06 15:57:29 ago Exp $
4
5 EAPI=4
6
7 inherit eutils multilib pam ssl-cert
8
9 DESCRIPTION="The Erlang Jabber Daemon"
10 HOMEPAGE="http://www.ejabberd.im/"
11 SRC_URI="http://www.process-one.net/downloads/${PN}/${PV}/${P}.tgz
12 mod_statsdx? ( mirror://gentoo/ejabberd-mod_statsdx-1080.patch.gz )"
13
14 LICENSE="GPL-2"
15 SLOT="0"
16 KEYWORDS="amd64 ~arm ~ia64 ppc ~sparc x86"
17 EJABBERD_MODULES="mod_irc mod_muc mod_proxy65 mod_pubsub mod_statsdx"
18 IUSE="captcha debug ldap odbc pam +web zlib ${EJABBERD_MODULES}"
19
20 DEPEND=">=net-im/jabber-base-0.01
21 >=dev-libs/expat-1.95
22 >=dev-lang/erlang-12.2.5[ssl]
23 odbc? ( dev-db/unixODBC )
24 ldap? ( =net-nds/openldap-2* )
25 >=dev-libs/openssl-0.9.8e
26 captcha? ( media-gfx/imagemagick[truetype,png] )
27 zlib? ( sys-libs/zlib )"
28 #>=sys-apps/shadow-4.1.4.2-r3 - fixes bug in su that made ejabberdctl unworkable.
29 RDEPEND="${DEPEND}
30 >=sys-apps/shadow-4.1.4.2-r3
31 pam? ( virtual/pam )"
32
33 S=${WORKDIR}/${P}/src
34
35 # paths in net-im/jabber-base
36 JABBER_ETC="${EPREFIX}/etc/jabber"
37 #JABBER_RUN="/var/run/jabber"
38 JABBER_SPOOL="${EPREFIX}/var/spool/jabber"
39 JABBER_LOG="${EPREFIX}/var/log/jabber"
40 JABBER_DOC="${EPREFIX}/usr/share/doc/${PF}"
41
42 src_prepare() {
43 if use mod_statsdx; then
44 ewarn "mod_statsdx is not a part of upstream tarball but is a third-party module"
45 ewarn "taken from here: http://www.ejabberd.im/mod_stats2file"
46 EPATCH_OPTS="-p2" epatch "${WORKDIR}/ejabberd-mod_statsdx-1080.patch"
47 fi
48
49 # don't install release notes (we'll do this manually)
50 sed '/install .* [.][.]\/doc\/[*][.]txt $(DOCDIR)/d' -i Makefile.in || die
51 # Set correct paths
52 sed -e "/^EJABBERDDIR[[:space:]]*=/{s:ejabberd:${PF}:}" \
53 -e "/^ETCDIR[[:space:]]*=/{s:@sysconfdir@/ejabberd:${JABBER_ETC}:}" \
54 -e "/^LOGDIR[[:space:]]*=/{s:@localstatedir@/log/ejabberd:${JABBER_LOG}:}" \
55 -e "/^SPOOLDIR[[:space:]]*=/{s:@localstatedir@/lib/ejabberd:${JABBER_SPOOL}:}" \
56 -i Makefile.in || die
57 sed -e "/EJABBERDDIR=/{s:ejabberd:${PF}:}" \
58 -e "s|\(ETCDIR=\)@SYSCONFDIR@.*|\1${JABBER_ETC}|" \
59 -e "s|\(LOGS_DIR=\)@LOCALSTATEDIR@.*|\1${JABBER_LOG}|" \
60 -e "s|\(SPOOLDIR=\)@LOCALSTATEDIR@.*|\1${JABBER_SPOOL}|" \
61 -i ejabberdctl.template || die
62
63 # Set shell, so it'll work even in case jabber user have no shell
64 # This is gentoo specific I guess since other distributions may have
65 # ejabberd user with reall shell, while we share this user among different
66 # jabberd implementations.
67 sed '/^HOME/aSHELL=/bin/sh' -i ejabberdctl.template || die
68 sed '/^export HOME/aexport SHELL' -i ejabberdctl.template || die
69
70 #sed -e "s:/share/doc/ejabberd/:${JABBER_DOC}:" -i web/ejabberd_web_admin.erl
71
72 # fix up the ssl cert paths in ejabberd.cfg to use our cert
73 sed -e "s:/path/to/ssl.pem:/etc/ssl/ejabberd/server.pem:g" \
74 -i ejabberd.cfg.example || die "Failed sed ejabberd.cfg.example"
75
76 # correct path to captcha script in default ejabberd.cfg
77 sed -e 's|\({captcha_cmd,[[:space:]]*"\).\+"}|\1/usr/'$(get_libdir)'/erlang/lib/'${P}'/priv/bin/captcha.sh"}|' \
78 -i ejabberd.cfg.example || die "Failed sed ejabberd.cfg.example"
79
80 # disable mod_irc in ejabberd.cfg
81 if ! use mod_irc; then
82 sed -i -e "s/{mod_irc,/%{mod_irc,/" \
83 -i ejabberd.cfg.example || die "Failed to disable mod_irc"
84 fi
85
86 }
87
88 src_configure() {
89 econf \
90 --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
91 --libdir="${EPREFIX}/usr/$(get_libdir)/erlang/lib/" \
92 $(use_enable mod_irc) \
93 $(use_enable ldap eldap) \
94 $(use_enable mod_muc) \
95 $(use_enable mod_proxy65) \
96 $(use_enable mod_pubsub) \
97 $(use_enable web) \
98 $(use_enable odbc) \
99 $(use_enable zlib ejabberd_zlib) \
100 $(use_enable pam) \
101 --enable-user=jabber
102 }
103
104 src_compile() {
105 emake $(use debug && echo debug=true ejabberd_debug=true)
106 }
107
108 src_install() {
109 emake DESTDIR="${ED}" install
110
111 # Pam helper module permissions
112 # http://www.process-one.net/docs/ejabberd/guide_en.html
113 if use pam; then
114 pamd_mimic_system xmpp auth account || die "Cannot create pam.d file"
115 fowners root:jabber "/usr/$(get_libdir)/erlang/lib/${PF}/priv/bin/epam"
116 fperms 4750 "/usr/$(get_libdir)/erlang/lib/${PF}/priv/bin/epam"
117 fi
118
119 cd "${WORKDIR}/${P}/doc"
120 dodoc "release_notes_${PV%%_rc*}.txt"
121
122 #dodir /var/lib/ejabberd
123 newinitd "${FILESDIR}/${PN}-3.initd" ${PN}
124 newconfd "${FILESDIR}/${PN}-3.confd" ${PN}
125 }
126
127 pkg_postinst() {
128 elog "For configuration instructions, please see"
129 elog "/usr/share/doc/${PF}/html/guide.html, or the online version at"
130 elog "http://www.process-one.net/en/ejabberd/docs/guide_en/"
131
132 if ! use web ; then
133 ewarn
134 ewarn "The web USE flag is off, this has disabled the web admin interface."
135 ewarn
136 fi
137
138 elog
139 elog '===================================================================='
140 elog 'Quick Start Guide:'
141 elog '1) Add output of `hostname -f` to /etc/jabber/ejabberd.cfg line 91'
142 elog ' {hosts, ["localhost", "thehost"]}.'
143 elog '2) Add an admin user to /etc/jabber/ejabberd.cfg line 360'
144 elog ' {acl, admin, {user, "theadmin", "thehost"}}.'
145 elog '3) Start the server'
146 elog ' # /etc/init.d/ejabberd start'
147 elog '4) Register the admin user'
148 elog ' # /usr/sbin/ejabberdctl register theadmin thehost thepassword'
149 elog '5) Log in with your favourite jabber client or using the web admin'
150
151 # Upgrading from ejabberd-2.0.x:
152 if grep -E '^[^#]*EJABBERD_NODE=' "${EROOT}/etc/conf.d/ejabberd" >/dev/null 2>&1; then
153 source "${EROOT}/etc/conf.d/ejabberd"
154 ewarn
155 ewarn "!!! WARNING !!! WARNING !!! WARNING !!! WARNING !!!"
156 ewarn "Starting with 2.1.x some paths and configuration files were"
157 ewarn "changed to reflect upstream intentions better. Notable changes are:"
158 ewarn
159 ewarn "1. Everything (even init scripts) is now handled with ejabberdctl script."
160 ewarn "Thus main configuration file became /etc/jabberd/ejabberdctl.cfg"
161 ewarn "You must update ERLANG_NODE there with the value of EJABBERD_NODE"
162 ewarn "from /etc/conf.d/ejebberd or ejabberd will refuse to start."
163 ewarn
164 ewarn "2. SSL certificate is now generated with ssl-cert eclass and resides"
165 ewarn "at standard location: /etc/ssl/ejabberd/server.pem."
166 ewarn
167 ewarn "3. Cookie now resides at /var/spool/jabber/.erlang.cookie"
168 ewarn
169 ewarn "4. /var/log/jabber/sasl.log is now /var/log/jabber/erlang.log"
170 ewarn
171 ewarn "5. Crash dumps (if any) will be located at /var/log/jabber"
172
173 local i ctlcfg new_ctlcfg
174 i=0
175 ctlcfg=${EROOT}/etc/jabber/ejabberdctl.cfg
176 while :; do
177 new_ctlcfg=$(printf "${EROOT}/etc/jabber/._cfg%04d_ejabberdctl.cfg" ${i})
178 [[ ! -e ${new_ctlcfg} ]] && break
179 ctlcfg=${new_ctlcfg}
180 ((i++))
181 done
182
183 ewarn
184 ewarn "Updating ${ctlcfg} (debug: ${new_ctlcfg})"
185 sed -e "/#ERLANG_NODE=/aERLANG_NODE=$EJABBERD_NODE" "${ctlcfg}" > "${new_ctlcfg}" || die
186
187 if [[ -e ${EROOT}/var/run/jabber/.erlang.cookie ]]; then
188 ewarn "Moving .erlang.cookie..."
189 if [[ -e ${EROOT}/var/spool/jabber/.erlang.cookie ]]; then
190 mv -v "${EROOT}"/var/spool/jabber/.erlang.cookie{,bak}
191 fi
192 mv -v "${EROOT}"/var/{run/jabber,spool/jabber}/.erlang.cookie
193 fi
194 ewarn
195 ewarn "We'll try to handle upgrade automagically but, please, do your"
196 ewarn "own checks and do not forget to run 'etc-update'!"
197 ewarn "PLEASE! Run 'etc-update' now!"
198 fi
199
200 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Ejabberd XMPP Server}"
201 install_cert /etc/ssl/ejabberd/server
202 # Fix ssl cert permissions bug #369809
203 chown root:jabber "${EROOT}/etc/ssl/ejabberd/server.pem"
204 chmod 0440 "${EROOT}/etc/ssl/ejabberd/server.pem"
205 if [[ -e ${EROOT}/etc/jabber/ssl.pem ]]; then
206 ewarn
207 ewarn "The location of SSL certificates has changed. If you are"
208 ewarn "upgrading from ${CATEGORY}/${PN}-2.0.5* or earlier you might"
209 ewarn "want to move your old certificates from /etc/jabber into"
210 ewarn "/etc/ssl/ejabberd/, update config files and"
211 ewarn "rm /etc/jabber/ssl.pem to avoid this message."
212 ewarn
213 fi
214 }

  ViewVC Help
Powered by ViewVC 1.1.20