]>
Commit | Line | Data |
---|---|---|
1 | # TODO: | |
2 | # - package all deps (tarballs 10-29) into separate spec files | |
3 | # (like in fedora) | |
4 | # Conditional build: | |
5 | %bcond_with pam # PAM authentication support | |
6 | %bcond_with logdb # enable mod_logdb (server-side message logging) | |
7 | %bcond_with new_sql_schema # build with the new SQL schema | |
8 | ||
9 | Summary: Fault-tolerant distributed Jabber/XMPP server | |
10 | Summary(pl.UTF-8): Odporny na awarie rozproszony serwer Jabbera/XMPP | |
11 | Name: ejabberd | |
12 | Version: 21.12 | |
13 | Release: 1 | |
14 | License: GPL | |
15 | Group: Applications/Communications | |
16 | # Source0: http://www.process-one.net/downloads/ejabberd/%{version}/%{name}-%{version}.tgz | |
17 | Source0: https://www.process-one.net/downloads/downloads-action.php?file=/%{version}/%{name}-%{version}.tgz | |
18 | # Source0-md5: 0382a30b10aa2bf15ee656814c90af49 | |
19 | Source1: %{name}.init | |
20 | Source2: %{name}.sysconfig | |
21 | Source3: %{name}.service | |
22 | Source4: %{name}.logrotate | |
23 | ||
24 | ||
25 | Source10: %{name}-base64url-20190617.tar.gz | |
26 | # Source10-md5: 5a12fd2fb1f992c850aba5115aab3dd4 | |
27 | Source11: %{name}-cache_tab-20210721.tar.gz | |
28 | # Source11-md5: 7cc70bf8d4b6df65a34fe43fd1983abb | |
29 | Source12: %{name}-eimp-20210721.tar.gz | |
30 | # Source12-md5: 8f7b7788e612ca6c03db09866b891940 | |
31 | Source13: %{name}-elixir-20170515.tar.gz | |
32 | # Source13-md5: 73be42f7d0cda7aeee5c0e6dadc0c451 | |
33 | Source14: %{name}-ezlib-20210721.tar.gz | |
34 | # Source14-md5: 8d0382c3ff95f82072b6aa4a3b147b51 | |
35 | Source15: %{name}-fast_tls-20210721.tar.gz | |
36 | # Source15-md5: af03ff816797aa276a4ceff975faaaf8 | |
37 | Source16: %{name}-fast_xml-20211129.tar.gz | |
38 | # Source16-md5: 65ecc85b1d0f8d80dcb034ec3d4bf33f | |
39 | Source17: %{name}-fast_yaml-20210721.tar.gz | |
40 | # Source17-md5: 074d2700df42b61bbe7ec7f8c9d47012 | |
41 | Source18: %{name}-goldrush-20160531.tar.gz | |
42 | # Source18-md5: acac73f0fc85d23671f0c49c68f8df8a | |
43 | Source19: %{name}-idna-20180830.tar.gz | |
44 | # Source19-md5: e34174d5c5e2e91611d3249c690f6d2d | |
45 | Source20: %{name}-jiffy-20200630.tar.gz | |
46 | # Source20-md5: e99a512a9c4395bda77f07990aa9aa97 | |
47 | Source21: %{name}-jose-20201223.tar.gz | |
48 | # Source21-md5: 6e5c9910dc1e1894e31882d49f78967d | |
49 | Source22: %{name}-lager-20210302.tar.gz | |
50 | # Source22-md5: 771b8fd52dac39ebf8df03d7b3f7ce3c | |
51 | Source23: %{name}-mqtree-20210721.tar.gz | |
52 | # Source23-md5: d19e24ec9e57509cc49ef52adb004950 | |
53 | Source24: %{name}-p1_acme-20211129.tar.gz | |
54 | # Source24-md5: 4682d74e8cd6c13384d661dc2bdb79d2 | |
55 | Source25: %{name}-p1_mysql-20210721.tar.gz | |
56 | # Source25-md5: 346f98e9eb7e098d91aef99af47ad3e3 | |
57 | Source26: %{name}-p1_oauth2-20210721.tar.gz | |
58 | # Source26-md5: 02f200cda69fbba041d73239c6720e3a | |
59 | Source27: %{name}-p1_pgsql-20211129.tar.gz | |
60 | # Source27-md5: 3d406d48d19310fc56f743cdfacad2d9 | |
61 | Source28: %{name}-p1_utils-20210721.tar.gz | |
62 | # Source28-md5: 75349258408c43c4a5c87e05129d277c | |
63 | Source29: %{name}-pkix-20210721.tar.gz | |
64 | # Source29-md5: 253920e7a3307b3941f2ff21cec8768c | |
65 | Source30: %{name}-rebar_elixir_plugin-20160105.tar.gz | |
66 | # Source30-md5: 6a069a566d71c3daa45fc4736364adf0 | |
67 | Source31: %{name}-sqlite3-20210721.tar.gz | |
68 | # Source31-md5: a81afbe7543f58fbb2cef732d73b3d3c | |
69 | Source32: %{name}-stringprep-20210721.tar.gz | |
70 | # Source32-md5: 88e1f8eff6f0e7a8b7707ef263cfa623 | |
71 | Source33: %{name}-stun-20211204.tar.gz | |
72 | # Source33-md5: 43efde2a2bcebac99687afb17f2238b1 | |
73 | Source34: %{name}-unicode_util_compat-20170729.tar.gz | |
74 | # Source34-md5: 1b348fdf38dba88ebed2f65125ad8590 | |
75 | Source35: %{name}-xmpp-20211129.tar.gz | |
76 | # Source35-md5: 74ae1ea0ef542142479fdd5de0dad3dc | |
77 | Source36: %{name}-yconf-20210721.tar.gz | |
78 | # Source36-md5: befea2c20d4cc672c78b2b5caa8cf75d | |
79 | ||
80 | Patch0: %{name}-paths.patch | |
81 | Patch1: %{name}-config.patch | |
82 | # https://paleg.github.io/mod_logdb/ | |
83 | # https://github.com/paleg/ejabberd/compare/paleg:19.08...paleg:19.08-mod_logdb.patch | |
84 | Patch3: %{name}-mod_logdb.patch | |
85 | URL: http://www.ejabberd.im/ | |
86 | BuildRequires: autoconf | |
87 | BuildRequires: automake | |
88 | BuildRequires: erlang >= 2:22.2 | |
89 | BuildRequires: expat-devel >= 1.95 | |
90 | BuildRequires: openssl-devel | |
91 | %if %{with pam} | |
92 | BuildRequires: pam-devel | |
93 | %endif | |
94 | BuildRequires: git-core | |
95 | BuildRequires: rpmbuild(macros) >= 1.671 | |
96 | BuildRequires: sqlite3-devel | |
97 | BuildRequires: yaml-devel | |
98 | BuildRequires: zlib-devel | |
99 | Requires(post): /usr/bin/perl | |
100 | Requires(post): jabber-common | |
101 | Requires(post): sed >= 4.0 | |
102 | Requires(post): textutils | |
103 | Requires(post,preun): /sbin/chkconfig | |
104 | Requires(post,preun,postun): systemd-units >= 38 | |
105 | Requires: erlang >= 2:22.2 | |
106 | Requires: expat >= 1.95 | |
107 | Requires: rc-scripts | |
108 | Requires: systemd-units >= 38 | |
109 | Conflicts: logrotate < 3.8.0 | |
110 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
111 | ||
112 | %define _noautoprovfiles %{_libdir}/%{name}/priv/lib/ | |
113 | ||
114 | %description | |
115 | ejabberd is a Free and Open Source fault-tolerant distributed Jabber | |
116 | server. It is written mostly in Erlang. | |
117 | ||
118 | %description -l pl.UTF-8 | |
119 | ejabberd to darmowy, z otwartymi źródłami, odporny na awarie | |
120 | rozproszony serwer Jabbera. Jest napisany w większości w Erlangu. | |
121 | ||
122 | %package logdb | |
123 | Summary: Server-side logging module | |
124 | Group: Applications/Communications | |
125 | Requires: %{name} = %{version}-%{release} | |
126 | ||
127 | %description logdb | |
128 | Server-side logging module. | |
129 | ||
130 | %prep | |
131 | %setup -q -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20 -a 21 -a 22 -a 23 -a 24 -a 25 -a 26 -a 27 -a 28 -a 29 -a 30 -a 31 -a 32 -a 33 -a 34 -a 35 -a 36 | |
132 | %patch0 -p1 | |
133 | %patch1 -p1 | |
134 | #%%patch2 -p1 | |
135 | %if %{with logdb} | |
136 | %patch3 -p1 | |
137 | %endif | |
138 | ||
139 | # Various parts of the build system use 'git describe' | |
140 | # which returns nonsense on manual builds using the builder script | |
141 | # and which fails on the PLD builders | |
142 | # I was not able to locate all 'git describe' invocation, sot let's | |
143 | # fool them with this dummy repository | |
144 | unset GIT_DIR GIT_WORK_TREE | |
145 | git init | |
146 | git config user.email "dummy@example.com" | |
147 | git config user.name "Dummy" | |
148 | git add configure.ac | |
149 | git commit -a -m "dummy commit" | |
150 | git tag "%{version}" | |
151 | ||
152 | sed -i -e 's,#!.*/usr/bin/env.*elixir,#!/usr/bin/elixir,' deps/elixir/bin/mix deps/elixir/lib/mix/lib/mix/tasks/escript.build.ex | |
153 | ||
154 | %build | |
155 | unset GIT_DIR GIT_WORK_TREE | |
156 | %{__aclocal} -I m4 | |
157 | %{__autoconf} | |
158 | %configure \ | |
159 | %{?with_pam --enable-pam} \ | |
160 | --enable-user=jabber \ | |
161 | %{__enable_disable new_sql_schema new-sql-schema} \ | |
162 | --enable-elixir \ | |
163 | --enable-full-xml \ | |
164 | --enable-odbc \ | |
165 | --enable-mysql \ | |
166 | --enable-pgsql \ | |
167 | --enable-sqlite --with-sqlite3 \ | |
168 | %{?with_pam:--enable-pam} \ | |
169 | --enable-zlib | |
170 | ||
171 | touch deps/.got | |
172 | ||
173 | cd deps/stringprep | |
174 | %configure | |
175 | cd ../.. | |
176 | cd deps/fast_tls | |
177 | %configure | |
178 | cd ../.. | |
179 | cd deps/fast_xml | |
180 | %configure | |
181 | cd ../.. | |
182 | cd deps/fast_yaml | |
183 | %configure | |
184 | cd ../.. | |
185 | cd deps/ezlib | |
186 | %configure | |
187 | cd ../.. | |
188 | ||
189 | # for elixir VM | |
190 | LC_ALL=en_US.UTF-8; export LC_ALL | |
191 | %{__make} -j1 | |
192 | ||
193 | %install | |
194 | rm -rf $RPM_BUILD_ROOT | |
195 | install -d $RPM_BUILD_ROOT{/var/lib/%{name},/etc/{sysconfig,rc.d/init.d}} \ | |
196 | $RPM_BUILD_ROOT{%{systemdunitdir},%{_sbindir}} \ | |
197 | $RPM_BUILD_ROOT{/etc/logrotate.d,/var/log/archive/%{name}} | |
198 | ||
199 | unset GIT_DIR GIT_WORK_TREE | |
200 | ||
201 | %{__make} install -j1 \ | |
202 | CHOWN_COMMAND=true \ | |
203 | O_USER="" \ | |
204 | G_USER="" \ | |
205 | DESTDIR=$RPM_BUILD_ROOT | |
206 | ||
207 | sed -e's,@libdir@,%{_libdir},g' -e 's,@EJABBERD_DOC_PATH@,%{_docdir}/%{name}-%{version}/doc,g' %{SOURCE1} > $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} | |
208 | cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name} | |
209 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service | |
210 | cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/%{name} | |
211 | ||
212 | chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{name}* | |
213 | ||
214 | chmod 755 $RPM_BUILD_ROOT%{_libdir}/*/priv/lib/*.so | |
215 | ||
216 | rm -rf _doc 2>/dev/null || : | |
217 | mv $RPM_BUILD_ROOT%{_docdir}/%{name} _doc | |
218 | ||
219 | touch $RPM_BUILD_ROOT%{_sysconfdir}/jabber/ejabberd.cfg | |
220 | touch $RPM_BUILD_ROOT/var/lib/ejabberd/.erlang.cookie | |
221 | ||
222 | %clean | |
223 | rm -rf $RPM_BUILD_ROOT | |
224 | ||
225 | %pre | |
226 | if [ -e /etc/jabber/ejabberd.cfg ] ; then | |
227 | %banner -e %{name} <<'EOF' | |
228 | Old-style /etc/jabber/ejabberd.cfg configuration file exists. You should | |
229 | consider converting it to the new YAML format. You can do this with the | |
230 | 'ejabberdctl convert_to_yaml' command (ejabberd must be already running). | |
231 | EOF | |
232 | fi | |
233 | ||
234 | %post | |
235 | if [ -f %{_sysconfdir}/jabber/secret ] ; then | |
236 | SECRET="$(cat %{_sysconfdir}/jabber/secret)" | |
237 | if [ -n "$SECRET" ] ; then | |
238 | echo -n "Updating component authentication secret in ejabberd config file..." >&2 | |
239 | %{__sed} -i -e "s/@service_secret@/$SECRET/" /etc/jabber/ejabberd.yml | |
240 | echo "done" >&2 | |
241 | fi | |
242 | fi | |
243 | /sbin/chkconfig --add ejabberd | |
244 | if [ -e /var/run/%{name}-upgrade-trigger ] ; then | |
245 | # service will be restarted in the postun trigger | |
246 | rm -f /var/run/%{name}-upgrade-trigger || : | |
247 | else | |
248 | %service ejabberd restart "ejabberd server" | |
249 | %systemd_post %{name}.service | |
250 | fi | |
251 | ||
252 | %preun | |
253 | if [ "$1" = "0" ]; then | |
254 | %service ejabberd stop | |
255 | /sbin/chkconfig --del ejabberd | |
256 | fi | |
257 | %systemd_preun %{name}.service | |
258 | ||
259 | %postun | |
260 | %systemd_reload | |
261 | ||
262 | %triggerprein -- %{name} < 13.10 | |
263 | if [ -e %{_sysconfdir}/jabber/ejabberd.cfg ] ; then | |
264 | if grep -Eq '^[^%]*access_get' %{_sysconfdir}/jabber/ejabberd.cfg ; then | |
265 | echo "Your 'ejabberd.cfg' config file seems to use 'access_get' option of mod_vcard" >&2 | |
266 | echo "this is not supported by this ejabberd version in PLD" >&2 | |
267 | exit 1 | |
268 | fi | |
269 | rm -f %{_sysconfdir}/jabber/ejabberd.yml.rpmnew 2>/dev/null || : | |
270 | fi | |
271 | if [ -e /var/lock/subsys/ejabberd ] ; then | |
272 | # old init script won't stop ejabberd correctly | |
273 | # stop it's all processes here | |
274 | # we assume any 'epmd', 'beam', 'beam.smp' or 'heart' process | |
275 | # running with uid of jabber is ejabberd process | |
276 | pids="$(ps -C "epmd beam beam.smp heart" -o pid=,user= | awk '/jabber/ { print $1 }')" || : | |
277 | if [ -n "$pids" ] ; then | |
278 | %banner -e %{name} <<'EOF' | |
279 | Killing all 'epmd, beam, beam.smp, heart' processed owned by the 'jabber' user to make sure old ejabberd is down. | |
280 | ||
281 | EOF | |
282 | kill $pids || : | |
283 | fi | |
284 | fi | |
285 | touch /var/run/%{name}-upgrade-trigger || : | |
286 | ||
287 | %triggerpostun -- %{name} < 13.10 | |
288 | # convert old 'NODENAME' in /etc/sysconfig/ejabberd | |
289 | # to 'ERLANG_NODE' in /etc/jabber/ejabberdctl.cfg | |
290 | # and move other settings | |
291 | NODENAME="$(hostname)" | |
292 | if [ -e /etc/sysconfig/ejabberd ] ; then | |
293 | . /etc/sysconfig/ejabberd || : | |
294 | fi | |
295 | subst="s/^#ERLANG_NODE=.*/ERLANG_NODE=ejabberd@${NODENAME}/" | |
296 | if [ "$NODENAME" != "localhost" ] ; then | |
297 | %banner -e %{name} <<'EOF' | |
298 | Configured node name (ejabberd@${NODENAME}) is not at 'localhost'. | |
299 | – setting INET_DIST_INTERFACE=0.0.0.0 in /etc/jabber/ejabberdctl.cfg. | |
300 | You should consider tuning that or your firewall configuration. | |
301 | ||
302 | EOF | |
303 | subst="$subst;s/^#INET_DIST_INTERFACE=.*/INET_DIST_INTERFACE=0.0.0.0/" | |
304 | fi | |
305 | if [ -n "$ERL_MAX_PORTS" ] ; then | |
306 | subst="$subst;s/^#ERL_MAX_PORTS=.*/ERL_MAX_PORTS=${ERL_MAX_PORTS}/" | |
307 | fi | |
308 | sed -i -e"$subst" /etc/jabber/ejabberdctl.cfg || : | |
309 | if [ -e /etc/sysconfig/ejabberd ] ; then | |
310 | sed -i.rpmsave \ | |
311 | -e'/^[#[:space:]]*NODENAME=/d;/^# Node name/d' \ | |
312 | -e'/^[#[:space:]]*ERL_MAX_PORTS=/d;/^# uncomment this to allow more then 1024 connections/d' \ | |
313 | -e'/^[#[:space:]]*ERL_FULLSWEEP_AFTER=/d;/^# uncomment this to limit memory usage/d' \ | |
314 | /etc/sysconfig/ejabberd || : | |
315 | fi | |
316 | cp %{_sysconfdir}/jabber/cookie /var/lib/ejabberd/.erlang.cookie || : | |
317 | chown jabber:jabber /var/lib/ejabberd/.erlang.cookie || : | |
318 | chmod 400 /var/lib/ejabberd/.erlang.cookie || : | |
319 | if [ -e /etc/jabber/ejabberd.cfg -a ! -e /etc/jabber/ejabberd.yml.rpmnew ] ; then | |
320 | mv /etc/jabber/ejabberd.yml /etc/jabber/ejabberd.yml.rpmnew | |
321 | echo 'include_config_file: "/etc/jabber/ejabberd.cfg"' > /etc/jabber/ejabberd.yml || : | |
322 | fi | |
323 | ||
324 | # post action postponed here | |
325 | %service ejabberd restart "ejabberd server" | |
326 | %systemd_post %{name}.service | |
327 | ||
328 | %systemd_trigger %{name}.service | |
329 | ||
330 | %files | |
331 | %defattr(644,root,root,755) | |
332 | %doc sql _doc/* | |
333 | %attr(755,root,root) %{_sbindir}/* | |
334 | %attr(755,root,root) %{_bindir}/elixir | |
335 | %attr(755,root,root) %{_bindir}/iex | |
336 | %attr(755,root,root) %{_bindir}/mix | |
337 | %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd-inetrc | |
338 | %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.yml | |
339 | %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberdctl.cfg | |
340 | # legacy config may still be there | |
341 | %attr(640,root,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.cfg | |
342 | %attr(770,root,jabber) /var/log/%{name} | |
343 | %attr(770,root,jabber) /var/log/archive/%{name} | |
344 | %if %{with logdb} | |
345 | %exclude %{_libdir}/ejabberd-%{version}/ebin/mod_logdb* | |
346 | %endif | |
347 | %{_libdir}/ejabberd-%{version} | |
348 | %{_libdir}/base64url-* | |
349 | %{_libdir}/cache_tab-* | |
350 | %dir %{_libdir}/eimp-* | |
351 | %dir %{_libdir}/eimp-*/priv | |
352 | %dir %{_libdir}/eimp-*/priv/bin | |
353 | %attr(755,root,root) %{_libdir}/eimp-*/priv/bin/eimp | |
354 | %{_libdir}/eimp-*/ebin | |
355 | %{_libdir}/eimp-*/LICENSE.txt | |
356 | %{_libdir}/elixir-* | |
357 | %{_libdir}/ezlib-* | |
358 | %{_libdir}/fast_tls-* | |
359 | %{_libdir}/fast_xml-* | |
360 | %{_libdir}/fast_yaml-* | |
361 | %{_libdir}/goldrush-* | |
362 | %{_libdir}/idna-* | |
363 | %{_libdir}/jiffy-* | |
364 | %{_libdir}/jose-* | |
365 | %{_libdir}/lager-* | |
366 | %dir %{_libdir}/mqtree-* | |
367 | %{_libdir}/mqtree-*/ebin | |
368 | %dir %{_libdir}/mqtree-*/priv | |
369 | %dir %{_libdir}/mqtree-*/priv/lib | |
370 | %attr(755,root,root) %{_libdir}/mqtree-*/priv/lib/mqtree.so | |
371 | %{_libdir}/p1_acme-* | |
372 | %{_libdir}/p1_mysql-* | |
373 | %{_libdir}/p1_oauth2-* | |
374 | %{_libdir}/p1_pgsql-* | |
375 | %{_libdir}/p1_utils-* | |
376 | %dir %{_libdir}/pkix-* | |
377 | %{_libdir}/pkix-*/ebin | |
378 | %{_libdir}/pkix-*/LICENSE | |
379 | %{_libdir}/rebar_elixir_plugin-* | |
380 | %{_libdir}/sqlite3-*/ebin | |
381 | %dir %{_libdir}/sqlite3-* | |
382 | %dir %{_libdir}/sqlite3-*/priv | |
383 | %attr(755,root,root) %{_libdir}/sqlite3-*/priv/sqlite3_drv.so | |
384 | %{_libdir}/stringprep-* | |
385 | %{_libdir}/stun-* | |
386 | %{_libdir}/unicode_util_compat-* | |
387 | %{_libdir}/xmpp-* | |
388 | %{_libdir}/yconf-* | |
389 | %dir %attr(770,root,jabber) /var/lib/ejabberd | |
390 | %ghost %attr(400,jabber,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) /var/lib/ejabberd/.erlang.cookie | |
391 | %attr(754,root,root) /etc/rc.d/init.d/%{name} | |
392 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} | |
393 | %{systemdunitdir}/%{name}.service | |
394 | /etc/logrotate.d/%{name} | |
395 | %{_mandir}/man5/ejabberd.yml.5* | |
396 | ||
397 | %if %{with logdb} | |
398 | %files logdb | |
399 | %defattr(644,root,root,755) | |
400 | %{_libdir}/ejabberd-%{version}/ebin/mod_logdb* | |
401 | %endif |