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