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