1 |
commit: a42011129282e2508ea7604255ff74f4025c559c |
2 |
Author: Amadeusz Żołnowski <aidecoe <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Aug 27 13:04:38 2016 +0000 |
4 |
Commit: Amadeusz Piotr Żołnowski <aidecoe <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Aug 27 13:12:50 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4201112 |
7 |
|
8 |
net-im/ejabberd: Bump revision |
9 |
|
10 |
Fixes are coming. |
11 |
|
12 |
net-im/ejabberd/ejabberd-16.04-r1.ebuild | 280 +++++++++++++++++++++++++++++++ |
13 |
1 file changed, 280 insertions(+) |
14 |
|
15 |
diff --git a/net-im/ejabberd/ejabberd-16.04-r1.ebuild b/net-im/ejabberd/ejabberd-16.04-r1.ebuild |
16 |
new file mode 100644 |
17 |
index 00000000..3f1c777 |
18 |
--- /dev/null |
19 |
+++ b/net-im/ejabberd/ejabberd-16.04-r1.ebuild |
20 |
@@ -0,0 +1,280 @@ |
21 |
+# Copyright 1999-2016 Gentoo Foundation |
22 |
+# Distributed under the terms of the GNU General Public License v2 |
23 |
+# $Id$ |
24 |
+ |
25 |
+EAPI=6 |
26 |
+ |
27 |
+SSL_CERT_MANDATORY=1 |
28 |
+ |
29 |
+inherit eutils pam rebar ssl-cert systemd |
30 |
+ |
31 |
+DESCRIPTION="Robust, scalable and extensible XMPP server" |
32 |
+HOMEPAGE="http://www.ejabberd.im/ https://github.com/processone/ejabberd/" |
33 |
+SRC_URI="http://www.process-one.net/downloads/${PN}/${PV}/${P}.tgz |
34 |
+ -> ${P}.tar.gz" |
35 |
+ |
36 |
+LICENSE="GPL-2" |
37 |
+SLOT="0" |
38 |
+KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~sparc ~x86" |
39 |
+REQUIRED_USE="mssql? ( odbc )" |
40 |
+# TODO: Add 'tools' flag. |
41 |
+IUSE="captcha debug full-xml hipe ldap mssql mysql nls odbc pam postgres redis |
42 |
+ riak roster-gw sqlite zlib" |
43 |
+ |
44 |
+RESTRICT="test" |
45 |
+ |
46 |
+# TODO: Add dependencies for 'tools' flag enabled. |
47 |
+# TODO: tools? ( |
48 |
+# TODO: >=dev-erlang/meck-0.8.4 |
49 |
+# TODO: >=dev-erlang/moka-1.0.5b |
50 |
+# TODO: ) |
51 |
+CDEPEND=" |
52 |
+ >=dev-erlang/cache_tab-1.0.2 |
53 |
+ >=dev-erlang/esip-1.0.4 |
54 |
+ >=dev-erlang/fast_tls-1.0.3 |
55 |
+ >=dev-erlang/fast_xml-1.1.3 |
56 |
+ >=dev-erlang/fast_yaml-1.0.3 |
57 |
+ >=dev-erlang/jiffy-0.14.7 |
58 |
+ >=dev-erlang/lager-3.0.2 |
59 |
+ >=dev-erlang/luerl-0.2 |
60 |
+ >=dev-erlang/p1_oauth2-0.6.1 |
61 |
+ >=dev-erlang/p1_utils-1.0.4 |
62 |
+ >=dev-erlang/p1_xmlrpc-1.15.1 |
63 |
+ >=dev-erlang/stringprep-1.0.3 |
64 |
+ >=dev-erlang/stun-1.0.3 |
65 |
+ >=dev-lang/erlang-17.1[hipe?,odbc?,ssl] |
66 |
+ <dev-lang/erlang-19 |
67 |
+ >=net-im/jabber-base-0.01 |
68 |
+ ldap? ( =net-nds/openldap-2* ) |
69 |
+ mysql? ( >=dev-erlang/p1_mysql-1.0.1 ) |
70 |
+ nls? ( >=dev-erlang/iconv-1.0.0 ) |
71 |
+ odbc? ( dev-db/unixODBC ) |
72 |
+ pam? ( >=dev-erlang/p1_pam-1.0.0 ) |
73 |
+ postgres? ( >=dev-erlang/p1_pgsql-1.1.0 ) |
74 |
+ redis? ( >=dev-erlang/eredis-1.0.8 ) |
75 |
+ riak? ( |
76 |
+ >=dev-erlang/hamcrest-0.1.0_p20150103 |
77 |
+ >=dev-erlang/riakc-2.1.1_p20151111 |
78 |
+ ) |
79 |
+ sqlite? ( >=dev-erlang/sqlite3-1.1.5 ) |
80 |
+ zlib? ( >=dev-erlang/ezlib-1.0.1 )" |
81 |
+DEPEND="${CDEPEND} |
82 |
+ >=sys-apps/gawk-4.1" |
83 |
+RDEPEND="${CDEPEND} |
84 |
+ captcha? ( media-gfx/imagemagick[truetype,png] )" |
85 |
+ |
86 |
+DOCS=( README ) |
87 |
+PATCHES=( "${FILESDIR}/${P}-ejabberdctl.patch" ) |
88 |
+ |
89 |
+EJABBERD_CERT="${EPREFIX}/etc/ssl/ejabberd/server.pem" |
90 |
+# Paths in net-im/jabber-base |
91 |
+JABBER_ETC="${EPREFIX}/etc/jabber" |
92 |
+JABBER_LOG="${EPREFIX}/var/log/jabber" |
93 |
+JABBER_SPOOL="${EPREFIX}/var/spool/jabber" |
94 |
+ |
95 |
+# Adjust example configuration file to Gentoo. |
96 |
+# - Use our sample certificates. |
97 |
+# - Correct PAM service name. |
98 |
+adjust_config() { |
99 |
+ sed -e "s|\"/path/to/ssl.pem\"|\"${EJABBERD_CERT}\"|g" \ |
100 |
+ -e "s|\"pamservicename\"|\"xmpp\"|" \ |
101 |
+ -i "${S}/ejabberd.yml.example" \ |
102 |
+ || die 'failed to adjust example config' |
103 |
+} |
104 |
+ |
105 |
+# Set paths to ejabberd lib directory consistently to point always to directory |
106 |
+# suffixed with version. |
107 |
+correct_ejabberd_paths() { |
108 |
+ sed -e "/^EJABBERDDIR[[:space:]]*=/{s:ejabberd:${P}:}" \ |
109 |
+ -i "${S}/Makefile.in" \ |
110 |
+ || die 'failed to set ejabberd path in Makefile.in' |
111 |
+ sed -e "/EJABBERD_BIN_PATH=/{s:ejabberd:${P}:}" \ |
112 |
+ -i "${S}/ejabberdctl.template" \ |
113 |
+ || die 'failed to set ejabberd path in ejabberdctl.template' |
114 |
+ sed -e 's|\(captcha_cmd:[[:space:]]*"\).\+"|\1'$(get_ejabberd_path)'/priv/bin/captcha.sh"|' \ |
115 |
+ -i "${S}/ejabberd.yml.example" \ |
116 |
+ || die 'failed to correct path to captcha.sh in example config' |
117 |
+} |
118 |
+ |
119 |
+# Get epam-wrapper from 'files' directory and correct path to lib directory in |
120 |
+# it. epam-wrapper is placed into work directory. It is assumed no epam-wrapper |
121 |
+# file exists there already. |
122 |
+customize_epam_wrapper() { |
123 |
+ local epam_wrapper_src="$1" |
124 |
+ local epam_wrapper_dst="${S}/epam-wrapper" |
125 |
+ |
126 |
+ [[ -e ${epam_wrapper_dst} ]] && die 'epam-wrapper already exists' |
127 |
+ sed -r -e "s@^(ERL_LIBS=).*\$@\1${EPREFIX}$(get_erl_libs)@" \ |
128 |
+ "${epam_wrapper_src}" >"${epam_wrapper_dst}" \ |
129 |
+ || die 'failed to install epam-wrapper' |
130 |
+} |
131 |
+ |
132 |
+# Check if there already exists a certificate. |
133 |
+ejabberd_cert_exists() { |
134 |
+ local cert |
135 |
+ |
136 |
+ for cert in $(gawk -- \ |
137 |
+ 'match($0, /^[[:space:]]*certfile: "([^"]+)"/, m) {print m[1];}' \ |
138 |
+ "${EROOT%/}${JABBER_ETC}/ejabberd.yml"); do |
139 |
+ [[ -f ${cert} ]] && return 0 |
140 |
+ done |
141 |
+ |
142 |
+ return 1 |
143 |
+} |
144 |
+ |
145 |
+# Generate and install sample ejabberd certificate. It's installed into |
146 |
+# EJABBERD_CERT path. |
147 |
+ejabberd_cert_install() { |
148 |
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-ejabberd XMPP Server}" |
149 |
+ install_cert "${EJABBERD_CERT%.*}" |
150 |
+ chown root:jabber "${EROOT%/}${EJABBERD_CERT}" || die |
151 |
+ chmod 0440 "${EROOT%/}${EJABBERD_CERT}" || die |
152 |
+} |
153 |
+ |
154 |
+# Get path to ejabberd lib directory. |
155 |
+get_ejabberd_path() { |
156 |
+ echo "$(get_erl_libs)/${P}" |
157 |
+} |
158 |
+ |
159 |
+# Make ejabberd.service for systemd from upstream provided template. |
160 |
+make_ejabberd_service() { |
161 |
+ sed -r \ |
162 |
+ -e 's!@ctlscriptpath@!/usr/sbin!' \ |
163 |
+ -e 's!(User|Group)=(.*)!\1=jabber!' \ |
164 |
+ "${PN}.service.template" >"${PN}.service" \ |
165 |
+ || die 'failed to make ejabberd.service' |
166 |
+} |
167 |
+ |
168 |
+# Set paths to defined by net-im/jabber-base. |
169 |
+set_jabberbase_paths() { |
170 |
+ sed -e "/^ETCDIR[[:space:]]*=/{s:@sysconfdir@/ejabberd:${JABBER_ETC}:}" \ |
171 |
+ -e "/^LOGDIR[[:space:]]*=/{s:@localstatedir@/log/ejabberd:${JABBER_LOG}:}" \ |
172 |
+ -e "/^SPOOLDIR[[:space:]]*=/{s:@localstatedir@/lib/ejabberd:${JABBER_SPOOL}:}" \ |
173 |
+ -i "${S}/Makefile.in" \ |
174 |
+ || die 'failed to set paths in Makefile.in' |
175 |
+ sed -e "s|\(ETC_DIR=\){{sysconfdir}}.*|\1${JABBER_ETC}|" \ |
176 |
+ -e "s|\(LOGS_DIR=\){{localstatedir}}.*|\1${JABBER_LOG}|" \ |
177 |
+ -e "s|\(SPOOL_DIR=\){{localstatedir}}.*|\1${JABBER_SPOOL}|" \ |
178 |
+ -i "${S}/ejabberdctl.template" \ |
179 |
+ || die 'failed to set paths ejabberdctl.template' |
180 |
+} |
181 |
+ |
182 |
+# Skip installing docs because it's only COPYING that's installed by Makefile. |
183 |
+skip_docs() { |
184 |
+ gawk -i inplace ' |
185 |
+/# Documentation/, /^[[:space:]]*#?[[:space:]]*$/ { |
186 |
+ if ($0 ~ /^[[:space:]]*#?[[:space:]]*$/) { |
187 |
+ print $0; |
188 |
+ } else { |
189 |
+ next; |
190 |
+ } |
191 |
+} |
192 |
+1 |
193 |
+' "${S}/Makefile.in" || die 'failed to remove docs section from Makefile.in' |
194 |
+} |
195 |
+ |
196 |
+src_prepare() { |
197 |
+ default |
198 |
+ |
199 |
+ rebar_remove_deps |
200 |
+ correct_ejabberd_paths |
201 |
+ set_jabberbase_paths |
202 |
+ make_ejabberd_service |
203 |
+ skip_docs |
204 |
+ adjust_config |
205 |
+ customize_epam_wrapper "${FILESDIR}/epam-wrapper" |
206 |
+} |
207 |
+ |
208 |
+src_configure() { |
209 |
+ econf \ |
210 |
+ --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \ |
211 |
+ --libdir="${EPREFIX}$(get_erl_libs)" \ |
212 |
+ --enable-user=jabber \ |
213 |
+ $(use_enable debug) \ |
214 |
+ $(use_enable full-xml) \ |
215 |
+ $(use_enable hipe) \ |
216 |
+ $(use_enable mssql) \ |
217 |
+ $(use_enable mysql) \ |
218 |
+ $(use_enable nls iconv) \ |
219 |
+ $(use_enable odbc) \ |
220 |
+ $(use_enable pam) \ |
221 |
+ $(use_enable postgres pgsql) \ |
222 |
+ $(use_enable redis) \ |
223 |
+ $(use_enable riak) \ |
224 |
+ $(use_enable roster-gw roster-gateway-workaround) \ |
225 |
+ $(use_enable sqlite) \ |
226 |
+ $(use_enable zlib) |
227 |
+} |
228 |
+ |
229 |
+src_compile() { |
230 |
+ emake REBAR='rebar -v' src |
231 |
+} |
232 |
+ |
233 |
+src_install() { |
234 |
+ default |
235 |
+ |
236 |
+ if use pam; then |
237 |
+ local epam_path="$(get_ejabberd_path)/priv/bin/epam" |
238 |
+ |
239 |
+ pamd_mimic_system xmpp auth account || die "cannot create pam.d file" |
240 |
+ into "$(get_ejabberd_path)/priv" |
241 |
+ newbin epam-wrapper epam |
242 |
+ # PAM helper module permissions |
243 |
+ # https://www.process-one.net/docs/ejabberd/guide_en.html#pam |
244 |
+ fowners root:jabber "${epam_path}" |
245 |
+ fperms 4750 "${epam_path}" |
246 |
+ fi |
247 |
+ |
248 |
+ newconfd "${FILESDIR}/${PN}.confd" "${PN}" |
249 |
+ newinitd "${FILESDIR}/${PN}.initd" "${PN}" |
250 |
+ systemd_dounit "${PN}.service" |
251 |
+ systemd_dotmpfilesd "${FILESDIR}/${PN}.tmpfiles.conf" |
252 |
+ |
253 |
+ insinto /etc/logrotate.d |
254 |
+ newins "${FILESDIR}/${PN}.logrotate" "${PN}" |
255 |
+} |
256 |
+ |
257 |
+pkg_postinst() { |
258 |
+ if [[ ! ${REPLACING_VERSIONS} ]]; then |
259 |
+ echo |
260 |
+ elog "For configuration instructions, please see" |
261 |
+ elog " http://www.process-one.net/en/ejabberd/docs/" |
262 |
+ echo |
263 |
+ if [[ " ${REPLACING_VERSIONS} " =~ \ 2\. ]]; then |
264 |
+ ewarn "If you have used pubsub in ejabberd-2.* you may encounter issues after" |
265 |
+ ewarn "migration to ${PV}. pubsub data may not be migrated automatically and" |
266 |
+ ewarn "you may need to run migration script manually, see:" |
267 |
+ ewarn |
268 |
+ ewarn " https://github.com/processone/ejabberd/issues/479#issuecomment-124497456" |
269 |
+ ewarn |
270 |
+ ewarn "In case you don't care about all stored moods, activities, geoinfo and you" |
271 |
+ ewarn "know you don't store in pubsub anything important, you can just remove" |
272 |
+ ewarn "pubsub tables:" |
273 |
+ ewarn |
274 |
+ ewarn " rm ${EROOT%/}${JABBER_SPOOL}/pubsub_*" |
275 |
+ ewarn |
276 |
+ ewarn "See also: https://bugs.gentoo.org/show_bug.cgi?id=588244" |
277 |
+ echo |
278 |
+ fi |
279 |
+ elif [[ -f ${EROOT}etc/jabber/ejabberd.cfg ]]; then |
280 |
+ elog "Ejabberd now defaults to using a YAML format for its config file." |
281 |
+ elog "The old ejabberd.cfg file can be converted using the following instructions:" |
282 |
+ echo |
283 |
+ elog "1. Make sure all processes related to the previous version of ejabberd aren't" |
284 |
+ elog " running. Usually this just means the ejabberd and epmd daemons and possibly" |
285 |
+ elog " the pam-related process (epam) if pam support is enabled." |
286 |
+ elog "2. Run \`ejabberdctl start\` with sufficient permissions. Note that this can" |
287 |
+ elog " fail to start ejabberd properly for various reasons. Check ejabberd's main" |
288 |
+ elog " log file at /var/log/jabber/ejabberd.log to confirm it started successfully." |
289 |
+ elog "3. Run" |
290 |
+ elog " \`ejabberdctl convert_to_yaml /etc/jabber/ejabberd.cfg /etc/jabber/ejabberd.yml.new\`" |
291 |
+ elog " with sufficient permissions, edit and rename /etc/jabber/ejabberd.yml.new to" |
292 |
+ elog " /etc/jabber/ejabberd.yml, and finally restart ejabberd with the new config" |
293 |
+ elog " file." |
294 |
+ echo |
295 |
+ fi |
296 |
+ |
297 |
+ if ! ejabberd_cert_exists; then |
298 |
+ ejabberd_cert_install |
299 |
+ fi |
300 |
+} |