]> git.pld-linux.org Git - packages/ejabberd.git/blob - ejabberd.spec
- up to 20.07; logdb unmaintained (so disabled)
[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:        20.07
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:  f44a5fa45a0a27d196dc98335b1474e0
19 Source1:        %{name}.init
20 Source2:        %{name}.sysconfig
21 Source3:        %{name}.service
22 Source4:        %{name}.logrotate
23 #
24 # Archives created with the ejabberd-pack_deps.sh script (in this repo)
25 Source10:       ejabberd-base64url-20150806.tar.gz
26 # Source10-md5: 380365a24cbd8cff33115fd7ae696db4
27 Source11:       ejabberd-cache_tab-20200728.tar.gz
28 # Source11-md5: 79cf7ff08fe61b36b912a4df2e944227
29 Source12:       ejabberd-eimp-20200728.tar.gz
30 # Source12-md5: c34a0151f9acf1c248aa4980e823961b
31 Source13:       ejabberd-elixir-20170515.tar.gz
32 # Source13-md5: 73be42f7d0cda7aeee5c0e6dadc0c451
33 Source14:       ejabberd-ezlib-20200721.tar.gz
34 # Source14-md5: 6e3f98f9a5100f999a2157cb57e3c8fc
35 Source15:       ejabberd-fast_tls-20200728.tar.gz
36 # Source15-md5: 3e15d467f7be6b188d99d2c1db478085
37 Source16:       ejabberd-fast_xml-20200728.tar.gz
38 # Source16-md5: 6c6d9c6a5442f2415b9da925d4d14695
39 Source17:       ejabberd-fast_yaml-20200728.tar.gz
40 # Source17-md5: 89f01b4158df4c56a9cc5797f9d319c8
41 Source18:       ejabberd-goldrush-20160531.tar.gz
42 # Source18-md5: acac73f0fc85d23671f0c49c68f8df8a
43 Source19:       ejabberd-idna-20180830.tar.gz
44 # Source19-md5: e34174d5c5e2e91611d3249c690f6d2d
45 Source20:       ejabberd-jiffy-20200630.tar.gz
46 # Source20-md5: e99a512a9c4395bda77f07990aa9aa97
47 Source21:       ejabberd-jose-20181231.tar.gz
48 # Source21-md5: 406b7ceab1b2d3843440dfbdd85f2e79
49 Source22:       ejabberd-lager-20190430.tar.gz
50 # Source22-md5: 66205d931dd27b496529c19addf6d7d9
51 Source23:       ejabberd-mqtree-20200728.tar.gz
52 # Source23-md5: 6dede60127da20866ab46644cab1cc21
53 Source24:       ejabberd-p1_acme-20200728.tar.gz
54 # Source24-md5: b39f5de636651f3ec868104ac86db0d1
55 Source25:       ejabberd-p1_mysql-20200728.tar.gz
56 # Source25-md5: b482c810f3bb4739ac103fbfcfdcd160
57 Source26:       ejabberd-p1_oauth2-20200728.tar.gz
58 # Source26-md5: 0eb3ac030537202ef16b74d97788a761
59 Source27:       ejabberd-p1_pgsql-20200728.tar.gz
60 # Source27-md5: dbe3ef9681bb622325137d57e8b8bc11
61 Source28:       ejabberd-p1_utils-20200728.tar.gz
62 # Source28-md5: 9ac6040eec0dbea30b277b36ebe33a2c
63 Source29:       ejabberd-pkix-20200728.tar.gz
64 # Source29-md5: 68c8f90ef9083bd75439c6bccfaacb0e
65 Source30:       ejabberd-rebar_elixir_plugin-20160105.tar.gz
66 # Source30-md5: 6a069a566d71c3daa45fc4736364adf0
67 Source31:       ejabberd-sqlite3-20200720.tar.gz
68 # Source31-md5: d786b847d79815478a11ccd012db932f
69 Source32:       ejabberd-stringprep-20200728.tar.gz
70 # Source32-md5: ad94928ad7ddc4479c92cf94cce7740c
71 Source33:       ejabberd-stun-20200728.tar.gz
72 # Source33-md5: 9eda4f4e84dc715969e3e9072d14fbf0
73 Source34:       ejabberd-unicode_util_compat-20170729.tar.gz
74 # Source34-md5: 1b348fdf38dba88ebed2f65125ad8590
75 Source35:       ejabberd-xmpp-20200728.tar.gz
76 # Source35-md5: 4418bb3ba3909c9091d6864fcb1ea922
77 Source36:       ejabberd-yconf-20200728.tar.gz
78 # Source36-md5: 5677b640acce6f0302894398c093c466
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 /etc/jabber/ejabberd.cfg ] ; then
264         if grep -Eq '^[^%]*access_get' /etc/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 /etc/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
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.142645 seconds and 3 git commands to generate.