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