1 |
commit: 26bb839b36582337bb3e4627e5e55a49004e567b |
2 |
Author: Florian Schmaus <flo <AT> geekplace <DOT> eu> |
3 |
AuthorDate: Thu Apr 8 07:08:54 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 1 09:35:41 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26bb839b |
7 |
|
8 |
net-im/ejabberd: add 21.04 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/766686 |
11 |
Signed-off-by: Florian Schmaus <flo <AT> geekplace.eu> |
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
net-im/ejabberd/Manifest | 1 + |
15 |
net-im/ejabberd/ejabberd-21.04.ebuild | 271 ++++++++++++++++++++++++++++++++++ |
16 |
2 files changed, 272 insertions(+) |
17 |
|
18 |
diff --git a/net-im/ejabberd/Manifest b/net-im/ejabberd/Manifest |
19 |
index 7f4a644bda9..bc7d6279d24 100644 |
20 |
--- a/net-im/ejabberd/Manifest |
21 |
+++ b/net-im/ejabberd/Manifest |
22 |
@@ -1,2 +1,3 @@ |
23 |
DIST ejabberd-20.04.tar.gz 2022319 BLAKE2B 02ce782bc58a808f38dff58715204059c51762187abff7f5c77ff08eb13330b66485234eb2204c4336770d75303417ee74077466a07e701aa512158ff641a578 SHA512 7c478bbd73577e06f21e26804f4eb57deb52a0ebdd12e45034e810314cb73bb2ec60b55c6f266271eb45d5ebc135a39c498a29706d6d1f5087fd2b509a8844ca |
24 |
DIST ejabberd-20.07.tar.gz 2029485 BLAKE2B c6d9e177b150135595c4670b96386e752d795fab219619edbd5f887975b1edfc79bfe2606b57d2edb34af9fe15c8a545dc70b8d50faa7f667bac5fcef985bb4c SHA512 d31bea2bcf83c2404104a1153664abceda900dca1ef86216970eac32115da521826ee1b80b020d21dafbdff2cfee8b210de6e68ba795068f7fc51545e0e381fc |
25 |
+DIST ejabberd-21.04.tar.gz 1560926 BLAKE2B 9d00c892317a93e5754d6f265499e904bb7c22542495039d8cc5cd7296cd5b1c73f14844acc0f4b041b6595346ce01d633926fde9f693a7cd794afbb3c228eb8 SHA512 d30642e90be1feb8673e9d7b3b513a17d54d94405057034c706bbd43d288e89479adb0ebaf8a4e8ff0f7e394f027d01bf171690c00e4169951ceecfbc0af4dc2 |
26 |
|
27 |
diff --git a/net-im/ejabberd/ejabberd-21.04.ebuild b/net-im/ejabberd/ejabberd-21.04.ebuild |
28 |
new file mode 100644 |
29 |
index 00000000000..3f35fb5be97 |
30 |
--- /dev/null |
31 |
+++ b/net-im/ejabberd/ejabberd-21.04.ebuild |
32 |
@@ -0,0 +1,271 @@ |
33 |
+# Copyright 1999-2021 Gentoo Authors |
34 |
+# Distributed under the terms of the GNU General Public License v2 |
35 |
+ |
36 |
+EAPI=6 |
37 |
+ |
38 |
+SSL_CERT_MANDATORY=1 |
39 |
+ |
40 |
+inherit pam rebar ssl-cert systemd tmpfiles |
41 |
+ |
42 |
+DESCRIPTION="Robust, scalable and extensible XMPP server" |
43 |
+HOMEPAGE="https://www.ejabberd.im/ https://github.com/processone/ejabberd/" |
44 |
+SRC_URI="https://static.process-one.net/${PN}/downloads/${PV}/${P}.tgz |
45 |
+ -> ${P}.tar.gz" |
46 |
+ |
47 |
+LICENSE="GPL-2" |
48 |
+SLOT="0" |
49 |
+KEYWORDS="~amd64 ~arm ~ia64 ~sparc ~x86" |
50 |
+REQUIRED_USE="mssql? ( odbc )" |
51 |
+# TODO: Add 'tools' flag. |
52 |
+IUSE="captcha debug full-xml ldap mssql mysql odbc pam postgres redis |
53 |
+ roster-gw sip sqlite +stun zlib" |
54 |
+ |
55 |
+RESTRICT="test" |
56 |
+ |
57 |
+# TODO: Add dependencies for 'tools' flag enabled. |
58 |
+# TODO: tools? ( |
59 |
+# TODO: >=dev-erlang/luerl-0.3 |
60 |
+# TODO: ) |
61 |
+DEPEND=">=dev-lang/erlang-19.3[odbc?,ssl] |
62 |
+ >=dev-erlang/cache_tab-1.0.28 |
63 |
+ >=dev-erlang/eimp-1.0.20 |
64 |
+ >=dev-erlang/fast_tls-1.1.12 |
65 |
+ >=dev-erlang/fast_xml-1.1.46 |
66 |
+ >=dev-erlang/fast_yaml-1.0.31 |
67 |
+ >=dev-erlang/yconf-1.0.11 |
68 |
+ >=dev-erlang/jiffy-1.0.5 |
69 |
+ >=dev-erlang/jose-1.9.0 |
70 |
+ >=dev-erlang/lager-3.6.10 |
71 |
+ >=dev-erlang/p1_oauth2-0.6.9 |
72 |
+ >=dev-erlang/p1_utils-1.0.22 |
73 |
+ >=dev-erlang/stringprep-1.0.25 |
74 |
+ >=dev-erlang/xmpp-1.5.3 |
75 |
+ >=dev-erlang/pkix-1.0.7 |
76 |
+ >=dev-erlang/mqtree-1.0.13 |
77 |
+ >=dev-erlang/idna-6.0.0-r1 |
78 |
+ >=dev-erlang/p1_acme-1.0.12 |
79 |
+ >=dev-erlang/base64url-1.0.1 |
80 |
+ >=net-im/jabber-base-0.01 |
81 |
+ ldap? ( =net-nds/openldap-2* ) |
82 |
+ mysql? ( >=dev-erlang/p1_mysql-1.0.18 ) |
83 |
+ odbc? ( dev-db/unixODBC ) |
84 |
+ pam? ( >=dev-erlang/epam-1.0.10 ) |
85 |
+ postgres? ( >=dev-erlang/p1_pgsql-1.1.11 ) |
86 |
+ redis? ( >=dev-erlang/eredis-1.0.8 ) |
87 |
+ sip? ( >=dev-erlang/esip-1.0.42 ) |
88 |
+ sqlite? ( >=dev-erlang/sqlite3-1.1.12 ) |
89 |
+ stun? ( >=dev-erlang/stun-1.0.43 ) |
90 |
+ zlib? ( >=dev-erlang/ezlib-1.0.9 )" |
91 |
+RDEPEND="${DEPEND} |
92 |
+ captcha? ( media-gfx/imagemagick[truetype,png] )" |
93 |
+ |
94 |
+DOCS=( CHANGELOG.md README.md ) |
95 |
+PATCHES=( "${FILESDIR}/${PN}-19.08-ejabberdctl.patch" |
96 |
+ "${FILESDIR}/${PN}-17.04-0002-Dont-overwrite-service-file.patch") |
97 |
+ |
98 |
+EJABBERD_CERT="${EPREFIX}/etc/ssl/ejabberd/server.pem" |
99 |
+# Paths in net-im/jabber-base |
100 |
+JABBER_ETC="${EPREFIX}/etc/jabber" |
101 |
+JABBER_LOG="${EPREFIX}/var/log/jabber" |
102 |
+JABBER_SPOOL="${EPREFIX}/var/spool/jabber" |
103 |
+ |
104 |
+# Adjust example configuration file to Gentoo. |
105 |
+# - Use our sample certificate. |
106 |
+adjust_config() { |
107 |
+ sed -rne "/^#?\s+certfiles:/{p;a\ - ${EJABBERD_CERT}" -e ":a;n;/^#?\s+-/ba};p" \ |
108 |
+ -i "${S}/ejabberd.yml.example" \ |
109 |
+ || die 'failed to adjust example config' |
110 |
+ sed -re 's/^#\s+(certfiles)/\1/' \ |
111 |
+ -i "${S}/ejabberd.yml.example" \ |
112 |
+ || die 'failed to adjust example config' |
113 |
+} |
114 |
+ |
115 |
+# Set paths to ejabberd lib directory consistently to point always to directory |
116 |
+# suffixed with version. |
117 |
+correct_ejabberd_paths() { |
118 |
+ sed -e "/^EJABBERDDIR[[:space:]]*=/{s:ejabberd:${P}:}" \ |
119 |
+ -i "${S}/Makefile.in" \ |
120 |
+ || die 'failed to set ejabberd path in Makefile.in' |
121 |
+ sed -e "/EJABBERD_BIN_PATH=/{s:ejabberd:${P}:}" \ |
122 |
+ -i "${S}/ejabberdctl.template" \ |
123 |
+ || die 'failed to set ejabberd path in ejabberdctl.template' |
124 |
+} |
125 |
+ |
126 |
+# Get epam-wrapper from 'files' directory and correct path to lib directory in |
127 |
+# it. epam-wrapper is placed into work directory. It is assumed no epam-wrapper |
128 |
+# file exists there already. |
129 |
+customize_epam_wrapper() { |
130 |
+ local epam_wrapper_src="${1}" |
131 |
+ local epam_wrapper_dst="${S}/epam-wrapper" |
132 |
+ |
133 |
+ [[ -e ${epam_wrapper_dst} ]] && die 'epam-wrapper already exists' |
134 |
+ sed -r -e "s@^(ERL_LIBS=).*\$@\1${EPREFIX}$(get_erl_libs)@" \ |
135 |
+ "${epam_wrapper_src}" >"${epam_wrapper_dst}" \ |
136 |
+ || die 'failed to install epam-wrapper' |
137 |
+} |
138 |
+ |
139 |
+# Check if we are missing a default certificate. |
140 |
+ejabberd_cert_missing() { |
141 |
+ if grep -qs "^\s\+- ${EJABBERD_CERT}" "${EROOT%/}${JABBER_ETC}/ejabberd.yml"; then |
142 |
+ if [[ -f "${EROOT%/}${EJABBERD_CERT}" ]]; then |
143 |
+ # default certificate is present in config and exists - not installing |
144 |
+ return 1 |
145 |
+ else |
146 |
+ # default certificate is present in config |
147 |
+ # but doesn't exist - need to install one |
148 |
+ return 0 |
149 |
+ fi |
150 |
+ fi |
151 |
+ # no default certificate in config - not installing |
152 |
+ return 1 |
153 |
+} |
154 |
+ |
155 |
+# Generate and install sample ejabberd certificate. It's installed into |
156 |
+# EJABBERD_CERT path. |
157 |
+ejabberd_cert_install() { |
158 |
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-ejabberd XMPP Server}" |
159 |
+ install_cert "${EJABBERD_CERT%.*}" |
160 |
+ chown root:jabber "${EROOT%/}${EJABBERD_CERT}" || die |
161 |
+ chmod 0440 "${EROOT%/}${EJABBERD_CERT}" || die |
162 |
+} |
163 |
+ |
164 |
+# Get path to ejabberd lib directory. |
165 |
+# |
166 |
+# This is the path ./configure script Base for this path is path set in |
167 |
+# ./configure script which is /usr/lib by default. If libdir is explicitely set |
168 |
+# to something else than this should be adjusted here as well. |
169 |
+get_ejabberd_path() { |
170 |
+ echo "/usr/$(get_libdir)/${P}" |
171 |
+} |
172 |
+ |
173 |
+# Make ejabberd.service for systemd from upstream provided template. |
174 |
+make_ejabberd_service() { |
175 |
+ sed -r \ |
176 |
+ -e 's!@ctlscriptpath@!/usr/sbin!g' \ |
177 |
+ -e 's!^(User|Group)=(.*)!\1=jabber!' \ |
178 |
+ -e 's!^(After)=(.*)!\1=epmd.service network.target!' \ |
179 |
+ -e '/^After=/ a Requires=epmd.service' \ |
180 |
+ "${PN}.service.template" >"${PN}.service" \ |
181 |
+ || die 'failed to make ejabberd.service' |
182 |
+} |
183 |
+ |
184 |
+# Set paths to defined by net-im/jabber-base. |
185 |
+set_jabberbase_paths() { |
186 |
+ sed -e "/^ETCDIR[[:space:]]*=/{s:@sysconfdir@/ejabberd:${JABBER_ETC}:}" \ |
187 |
+ -e "/^LOGDIR[[:space:]]*=/{s:@localstatedir@/log/ejabberd:${JABBER_LOG}:}" \ |
188 |
+ -e "/^SPOOLDIR[[:space:]]*=/{s:@localstatedir@/lib/ejabberd:${JABBER_SPOOL}:}" \ |
189 |
+ -i "${S}/Makefile.in" \ |
190 |
+ || die 'failed to set paths in Makefile.in' |
191 |
+ sed -e "s|\(ETC_DIR:=\"\){{sysconfdir}}[^\"]*|\1${JABBER_ETC}|" \ |
192 |
+ -e "s|\(LOGS_DIR:=\"\){{localstatedir}}[^\"]*|\1${JABBER_LOG}|" \ |
193 |
+ -e "s|\(SPOOL_DIR:=\"\){{localstatedir}}[^\"]*|\1${JABBER_SPOOL}|" \ |
194 |
+ -i "${S}/ejabberdctl.template" \ |
195 |
+ || die 'failed to set paths ejabberdctl.template' |
196 |
+} |
197 |
+ |
198 |
+src_prepare() { |
199 |
+ default |
200 |
+ |
201 |
+ rebar_remove_deps |
202 |
+ correct_ejabberd_paths |
203 |
+ set_jabberbase_paths |
204 |
+ make_ejabberd_service |
205 |
+ adjust_config |
206 |
+ customize_epam_wrapper "${FILESDIR}/epam-wrapper" |
207 |
+ |
208 |
+ rebar_fix_include_path fast_xml |
209 |
+ rebar_fix_include_path p1_utils |
210 |
+ rebar_fix_include_path xmpp |
211 |
+ |
212 |
+ # Fix bug #591862. ERL_LIBS should point directly to ejabberd directory |
213 |
+ # rather than its parent which is default. That way ejabberd directory |
214 |
+ # takes precedence is module lookup. |
215 |
+ local ejabberd_erl_libs="$(get_ejabberd_path):$(get_erl_libs)" |
216 |
+ sed -e "s|\(ERL_LIBS=\){{libdir}}.*|\1${ejabberd_erl_libs}|" \ |
217 |
+ -i "${S}/ejabberdctl.template" \ |
218 |
+ || die 'failed to set ERL_LIBS in ejabberdctl.template' |
219 |
+} |
220 |
+ |
221 |
+src_configure() { |
222 |
+ econf \ |
223 |
+ --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \ |
224 |
+ --enable-user=jabber \ |
225 |
+ $(use_enable debug) \ |
226 |
+ $(use_enable full-xml) \ |
227 |
+ $(use_enable mssql) \ |
228 |
+ $(use_enable mysql) \ |
229 |
+ $(use_enable odbc) \ |
230 |
+ $(use_enable pam) \ |
231 |
+ $(use_enable postgres pgsql) \ |
232 |
+ $(use_enable redis) \ |
233 |
+ $(use_enable roster-gw roster-gateway-workaround) \ |
234 |
+ $(use_enable sqlite) \ |
235 |
+ $(use_enable sip) \ |
236 |
+ $(use_enable stun) \ |
237 |
+ $(use_enable zlib) |
238 |
+ |
239 |
+ # more options to support |
240 |
+ # --enable-elixir requires https://github.com/elixir-lang/elixir |
241 |
+} |
242 |
+ |
243 |
+src_compile() { |
244 |
+ emake REBAR='rebar -v' src |
245 |
+} |
246 |
+ |
247 |
+src_install() { |
248 |
+ default |
249 |
+ |
250 |
+ keepdir /var/lib/lock/ejabberdctl |
251 |
+ rm -rf "${ED%/}/var/log" || die |
252 |
+ rm -rf "${ED%/}/var/spool" || die |
253 |
+ |
254 |
+ if use pam; then |
255 |
+ local epam_path="$(get_ejabberd_path)/priv/bin/epam" |
256 |
+ |
257 |
+ pamd_mimic_system xmpp auth account |
258 |
+ into "$(get_ejabberd_path)/priv" |
259 |
+ newbin epam-wrapper epam |
260 |
+ fi |
261 |
+ |
262 |
+ newconfd "${FILESDIR}/${PN}.confd" "${PN}" |
263 |
+ newinitd "${FILESDIR}/${PN}.initd" "${PN}" |
264 |
+ systemd_dounit "${PN}.service" |
265 |
+ dotmpfiles "${FILESDIR}/${PN}.tmpfiles.conf" |
266 |
+ |
267 |
+ insinto /etc/logrotate.d |
268 |
+ newins "${FILESDIR}/${PN}.logrotate" "${PN}" |
269 |
+} |
270 |
+ |
271 |
+pkg_preinst() { |
272 |
+ if use pam; then |
273 |
+ einfo "Adding jabber user to epam group to allow ejabberd to use PAM" \ |
274 |
+ "authentication" |
275 |
+ # See |
276 |
+ # <https://docs.ejabberd.im/admin/configuration/#pam-authentication>. |
277 |
+ # epam binary is installed by dev-erlang/epam package, therefore SUID |
278 |
+ # is set by that package. Instead of jabber group it uses epam group, |
279 |
+ # therefore we need to add jabber user to epam group. |
280 |
+ usermod -a -G epam jabber || die |
281 |
+ fi |
282 |
+} |
283 |
+ |
284 |
+pkg_postinst() { |
285 |
+ if [[ ! ${REPLACING_VERSIONS} ]]; then |
286 |
+ echo |
287 |
+ elog "For configuration instructions, please see" |
288 |
+ elog " https://docs.ejabberd.im/" |
289 |
+ echo |
290 |
+ fi |
291 |
+ if [[ " ${REPLACING_VERSIONS} " =~ \ 17\. ]]; then |
292 |
+ ewarn If you are updating from an older version like 17.x |
293 |
+ ewarn you may need to add an access_rules section to your |
294 |
+ ewarn ejabberd.yml config file. |
295 |
+ ewarn Otherwise authentication will be broken and users |
296 |
+ ewarn will not be able to log in. |
297 |
+ echo |
298 |
+ fi |
299 |
+ |
300 |
+ if ejabberd_cert_missing; then |
301 |
+ ejabberd_cert_install |
302 |
+ fi |
303 |
+} |