]> git.pld-linux.org Git - packages/ejabberd.git/blame - ejabberd.spec
Up to 21.07.
[packages/ejabberd.git] / ejabberd.spec
CommitLineData
beed1a42
AM
1# TODO:
2# - package all deps (tarballs 10-29) into separate spec files
3# (like in fedora)
e9f604ed 4# Conditional build:
5%bcond_with pam # PAM authentication support
79e489a1 6%bcond_with logdb # enable mod_logdb (server-side message logging)
e0a49cef 7%bcond_with new_sql_schema # build with the new SQL schema
eddf5b64 8
fb70a56e 9Summary: Fault-tolerant distributed Jabber/XMPP server
7abad569 10Summary(pl.UTF-8): Odporny na awarie rozproszony serwer Jabbera/XMPP
d798517a 11Name: ejabberd
1f6376e0 12Version: 21.07
89e7e566 13Release: 1
fb70a56e
JK
14License: GPL
15Group: Applications/Communications
79e489a1
AM
16# Source0: http://www.process-one.net/downloads/ejabberd/%{version}/%{name}-%{version}.tgz
17Source0: https://www.process-one.net/downloads/downloads-action.php?file=/%{version}/%{name}-%{version}.tgz
1f6376e0 18# Source0-md5: e37000934aea83e3465a7bbbef903193
d798517a
JK
19Source1: %{name}.init
20Source2: %{name}.sysconfig
21Source3: %{name}.service
f20002e6 22Source4: %{name}.logrotate
59e0d76f 23
4f4f623a 24Source10: ejabberd-base64url-20190617.tar.gz
59e0d76f 25# Source10-md5: 5a12fd2fb1f992c850aba5115aab3dd4
1f6376e0
AM
26Source11: ejabberd-cache_tab-20210721.tar.gz
27# Source11-md5: 7cc70bf8d4b6df65a34fe43fd1983abb
28Source12: ejabberd-eimp-20210721.tar.gz
29# Source12-md5: 8f7b7788e612ca6c03db09866b891940
4f4f623a 30Source13: ejabberd-elixir-20170515.tar.gz
59e0d76f 31# Source13-md5: 73be42f7d0cda7aeee5c0e6dadc0c451
1f6376e0
AM
32Source14: ejabberd-ezlib-20210721.tar.gz
33# Source14-md5: 8d0382c3ff95f82072b6aa4a3b147b51
34Source15: ejabberd-fast_tls-20210721.tar.gz
35# Source15-md5: af03ff816797aa276a4ceff975faaaf8
36Source16: ejabberd-fast_xml-20210721.tar.gz
37# Source16-md5: 5a9585ae9dc202a24371baefe815b298
38Source17: ejabberd-fast_yaml-20210721.tar.gz
39# Source17-md5: 074d2700df42b61bbe7ec7f8c9d47012
4f4f623a 40Source18: ejabberd-goldrush-20160531.tar.gz
59e0d76f 41# Source18-md5: acac73f0fc85d23671f0c49c68f8df8a
4f4f623a 42Source19: ejabberd-idna-20180830.tar.gz
59e0d76f 43# Source19-md5: e34174d5c5e2e91611d3249c690f6d2d
4f4f623a 44Source20: ejabberd-jiffy-20200630.tar.gz
59e0d76f 45# Source20-md5: e99a512a9c4395bda77f07990aa9aa97
4f4f623a 46Source21: ejabberd-jose-20181231.tar.gz
59e0d76f 47# Source21-md5: 406b7ceab1b2d3843440dfbdd85f2e79
1f6376e0
AM
48Source22: ejabberd-lager-20210302.tar.gz
49# Source22-md5: 771b8fd52dac39ebf8df03d7b3f7ce3c
50Source23: ejabberd-mqtree-20210721.tar.gz
51# Source23-md5: d19e24ec9e57509cc49ef52adb004950
52Source24: ejabberd-p1_acme-20210721.tar.gz
53# Source24-md5: 5bf94654bb2969c9adf8b912d5d7c8b4
54Source25: ejabberd-p1_mysql-20210721.tar.gz
55# Source25-md5: 346f98e9eb7e098d91aef99af47ad3e3
56Source26: ejabberd-p1_oauth2-20210721.tar.gz
57# Source26-md5: 02f200cda69fbba041d73239c6720e3a
58Source27: ejabberd-p1_pgsql-20210721.tar.gz
59# Source27-md5: 5995b0e59cae21b94e0007b8c74343e5
60Source28: ejabberd-p1_utils-20210721.tar.gz
61# Source28-md5: 75349258408c43c4a5c87e05129d277c
62Source29: ejabberd-pkix-20210721.tar.gz
63# Source29-md5: 253920e7a3307b3941f2ff21cec8768c
4f4f623a 64Source30: ejabberd-rebar_elixir_plugin-20160105.tar.gz
59e0d76f 65# Source30-md5: 6a069a566d71c3daa45fc4736364adf0
1f6376e0
AM
66Source31: ejabberd-sqlite3-20210721.tar.gz
67# Source31-md5: a81afbe7543f58fbb2cef732d73b3d3c
68Source32: ejabberd-stringprep-20210721.tar.gz
69# Source32-md5: 88e1f8eff6f0e7a8b7707ef263cfa623
70Source33: ejabberd-stun-20210721.tar.gz
71# Source33-md5: 1e588bcdfc7f73cfd357af0d24273cb1
4f4f623a 72Source34: ejabberd-unicode_util_compat-20170729.tar.gz
59e0d76f 73# Source34-md5: 1b348fdf38dba88ebed2f65125ad8590
1f6376e0
AM
74Source35: ejabberd-xmpp-20210721.tar.gz
75# Source35-md5: f88de1455f5211783a8ae9315512c0e2
76Source36: ejabberd-yconf-20210721.tar.gz
77# Source36-md5: befea2c20d4cc672c78b2b5caa8cf75d
ac7e9a78 78
d798517a
JK
79Patch0: %{name}-paths.patch
80Patch1: %{name}-config.patch
3f23be8e 81# https://paleg.github.io/mod_logdb/
dd02533f 82# https://github.com/paleg/ejabberd/compare/paleg:19.08...paleg:19.08-mod_logdb.patch
d798517a 83Patch3: %{name}-mod_logdb.patch
3f2196e7 84URL: http://www.ejabberd.im/
fb70a56e 85BuildRequires: autoconf
1a2644b6 86BuildRequires: automake
de2dcb11 87BuildRequires: erlang >= 2:22.2
6f0d08c1 88BuildRequires: expat-devel >= 1.95
89BuildRequires: openssl-devel
e9f604ed 90%if %{with pam}
91BuildRequires: pam-devel
92%endif
126fba49 93BuildRequires: git-core
67271627 94BuildRequires: rpmbuild(macros) >= 1.671
f0222aaa 95BuildRequires: sqlite3-devel
60c3a68c 96BuildRequires: yaml-devel
01f61704 97BuildRequires: zlib-devel
27b10c8b 98Requires(post): /usr/bin/perl
b15a901d 99Requires(post): jabber-common
0d54398f 100Requires(post): sed >= 4.0
fb70a56e 101Requires(post): textutils
fb70a56e 102Requires(post,preun): /sbin/chkconfig
67271627 103Requires(post,preun,postun): systemd-units >= 38
de2dcb11 104Requires: erlang >= 2:22.2
bb159536 105Requires: expat >= 1.95
27b10c8b 106Requires: rc-scripts
67271627 107Requires: systemd-units >= 38
028763ab 108Conflicts: logrotate < 3.8.0
fb70a56e
JK
109BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
110
fcf4c7a2
JK
111%define _noautoprovfiles %{_libdir}/%{name}/priv/lib/
112
fb70a56e 113%description
472227c5 114ejabberd is a Free and Open Source fault-tolerant distributed Jabber
115server. It is written mostly in Erlang.
fb70a56e 116
e0166ea5
JR
117%description -l pl.UTF-8
118ejabberd to darmowy, z otwartymi źródłami, odporny na awarie
119rozproszony serwer Jabbera. Jest napisany w większości w Erlangu.
378431cb 120
cba58599 121%package logdb
1a2644b6 122Summary: Server-side logging module
cba58599 123Group: Applications/Communications
124Requires: %{name} = %{version}-%{release}
125
126%description logdb
127Server-side logging module.
128
fb70a56e 129%prep
79e489a1 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
fb70a56e 131%patch0 -p1
7f71a53c
JK
132%patch1 -p1
133#%%patch2 -p1
9953f9cb 134%if %{with logdb}
046546ef 135%patch3 -p1
9953f9cb 136%endif
fb70a56e 137
8e141538
JK
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
143unset GIT_DIR GIT_WORK_TREE
144git init
d798661f
JK
145git config user.email "dummy@example.com"
146git config user.name "Dummy"
8e141538
JK
147git add configure.ac
148git commit -a -m "dummy commit"
149git tag "%{version}"
fb8f9840 150
de2dcb11
AM
151sed -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
fb70a56e 153%build
8e141538 154unset GIT_DIR GIT_WORK_TREE
e2bda3a7 155%{__aclocal} -I m4
fb70a56e 156%{__autoconf}
6b419144 157%configure \
5613d9b6 158 %{?with_pam --enable-pam} \
e4f8c955 159 --enable-user=jabber \
e0a49cef 160 %{__enable_disable new_sql_schema new-sql-schema} \
8311848d 161 --enable-elixir \
e2bda3a7 162 --enable-full-xml \
e2bda3a7
JK
163 --enable-odbc \
164 --enable-mysql \
165 --enable-pgsql \
f0222aaa 166 --enable-sqlite --with-sqlite3 \
e2bda3a7 167 %{?with_pam:--enable-pam} \
9682d4d5 168 --enable-zlib
5e08a6fd 169
e2bda3a7
JK
170touch deps/.got
171
beed1a42 172cd deps/stringprep
e2bda3a7
JK
173%configure
174cd ../..
beed1a42 175cd deps/fast_tls
e2bda3a7
JK
176%configure
177cd ../..
beed1a42
AM
178cd deps/fast_xml
179%configure
e2bda3a7 180cd ../..
beed1a42 181cd deps/fast_yaml
e2bda3a7
JK
182%configure
183cd ../..
beed1a42 184cd deps/ezlib
e2bda3a7
JK
185%configure
186cd ../..
187
beed1a42
AM
188# for elixir VM
189LC_ALL=en_US.UTF-8; export LC_ALL
92a38251 190%{__make} -j1
fb70a56e
JK
191
192%install
193rm -rf $RPM_BUILD_ROOT
d798517a 194install -d $RPM_BUILD_ROOT{/var/lib/%{name},/etc/{sysconfig,rc.d/init.d}} \
f20002e6 195 $RPM_BUILD_ROOT{%{systemdunitdir},%{_sbindir}} \
028763ab 196 $RPM_BUILD_ROOT{/etc/logrotate.d,/var/log/archive/%{name}}
fb70a56e 197
8e141538
JK
198unset GIT_DIR GIT_WORK_TREE
199
e2bda3a7 200%{__make} install -j1 \
e4f8c955
JK
201 CHOWN_COMMAND=true \
202 O_USER="" \
203 G_USER="" \
27b10c8b 204 DESTDIR=$RPM_BUILD_ROOT
fb70a56e 205
d798517a 206sed -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}
126fba49
AM
207cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
208cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
209cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
fb70a56e 210
d798517a 211chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{name}*
fb70a56e 212
beed1a42 213chmod 755 $RPM_BUILD_ROOT%{_libdir}/*/priv/lib/*.so
5613d9b6 214
e2bda3a7
JK
215rm -rf _doc 2>/dev/null || :
216mv $RPM_BUILD_ROOT%{_docdir}/%{name} _doc
059c0bab 217
fcf4c7a2
JK
218touch $RPM_BUILD_ROOT%{_sysconfdir}/jabber/ejabberd.cfg
219touch $RPM_BUILD_ROOT/var/lib/ejabberd/.erlang.cookie
220
fb70a56e
JK
221%clean
222rm -rf $RPM_BUILD_ROOT
223
e2bda3a7
JK
224%pre
225if [ -e /etc/jabber/ejabberd.cfg ] ; then
fcf4c7a2
JK
226 %banner -e %{name} <<'EOF'
227Old-style /etc/jabber/ejabberd.cfg configuration file exists. You should
228consider converting it to the new YAML format. You can do this with the
27161f77 229'ejabberdctl convert_to_yaml' command (ejabberd must be already running).
fcf4c7a2 230EOF
e2bda3a7
JK
231fi
232
fb70a56e 233%post
0d54398f 234if [ -f %{_sysconfdir}/jabber/secret ] ; then
7f71a53c 235 SECRET="$(cat %{_sysconfdir}/jabber/secret)"
fb70a56e 236 if [ -n "$SECRET" ] ; then
7f71a53c
JK
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
fb70a56e
JK
240 fi
241fi
fb70a56e 242/sbin/chkconfig --add ejabberd
7102eb90
JK
243if [ -e /var/run/%{name}-upgrade-trigger ] ; then
244 # service will be restarted in the postun trigger
245 rm -f /var/run/%{name}-upgrade-trigger || :
246else
247 %service ejabberd restart "ejabberd server"
248 %systemd_post %{name}.service
249fi
67271627 250
fb70a56e
JK
251%preun
252if [ "$1" = "0" ]; then
b15a901d 253 %service ejabberd stop
fb70a56e
JK
254 /sbin/chkconfig --del ejabberd
255fi
67271627
JK
256%systemd_preun %{name}.service
257
258%postun
259%systemd_reload
260
261%triggerprein -- %{name} < 13.10
7102eb90
JK
262if [ -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 || :
269fi
270if [ -e /var/lock/subsys/ejabberd ] ; then
67271627
JK
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'
278Killing all 'epmd, beam, beam.smp, heart' processed owned by the 'jabber' user to make sure old ejabberd is down.
7102eb90 279
67271627
JK
280EOF
281 kill $pids || :
282 fi
283fi
7102eb90 284touch /var/run/%{name}-upgrade-trigger || :
fb70a56e 285
fcf4c7a2
JK
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
290NODENAME="$(hostname)"
291if [ -e /etc/sysconfig/ejabberd ] ; then
292 . /etc/sysconfig/ejabberd || :
293fi
294subst="s/^#ERLANG_NODE=.*/ERLANG_NODE=ejabberd@${NODENAME}/"
7102eb90
JK
295if [ "$NODENAME" != "localhost" ] ; then
296 %banner -e %{name} <<'EOF'
297Configured node name (ejabberd@${NODENAME}) is not at 'localhost'.
298– setting INET_DIST_INTERFACE=0.0.0.0 in /etc/jabber/ejabberdctl.cfg.
299You should consider tuning that or your firewall configuration.
300
301EOF
302 subst="$subst;s/^#INET_DIST_INTERFACE=.*/INET_DIST_INTERFACE=0.0.0.0/"
303fi
fcf4c7a2
JK
304if [ -n "$ERL_MAX_PORTS" ] ; then
305 subst="$subst;s/^#ERL_MAX_PORTS=.*/ERL_MAX_PORTS=${ERL_MAX_PORTS}/"
306fi
307sed -i -e"$subst" /etc/jabber/ejabberdctl.cfg || :
308if [ -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 || :
314fi
315cp %{_sysconfdir}/jabber/cookie /var/lib/ejabberd/.erlang.cookie || :
7102eb90
JK
316chown jabber:jabber /var/lib/ejabberd/.erlang.cookie || :
317chmod 400 /var/lib/ejabberd/.erlang.cookie || :
318if [ -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 || :
321fi
322
323# post action postponed here
324%service ejabberd restart "ejabberd server"
325%systemd_post %{name}.service
326
67271627 327%systemd_trigger %{name}.service
fcf4c7a2 328
fb70a56e
JK
329%files
330%defattr(644,root,root,755)
e2bda3a7 331%doc sql _doc/*
fb70a56e 332%attr(755,root,root) %{_sbindir}/*
4852a36b
AM
333%attr(755,root,root) %{_bindir}/elixir
334%attr(755,root,root) %{_bindir}/iex
335%attr(755,root,root) %{_bindir}/mix
fcf4c7a2
JK
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
028763ab
JK
341%attr(770,root,jabber) /var/log/%{name}
342%attr(770,root,jabber) /var/log/archive/%{name}
61f3ef21 343%if %{with logdb}
beed1a42 344%exclude %{_libdir}/ejabberd-%{version}/ebin/mod_logdb*
61f3ef21 345%endif
beed1a42 346%{_libdir}/ejabberd-%{version}
ac7e9a78 347%{_libdir}/base64url-*
beed1a42 348%{_libdir}/cache_tab-*
105db1e0
JK
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
beed1a42 355%{_libdir}/elixir-*
beed1a42
AM
356%{_libdir}/ezlib-*
357%{_libdir}/fast_tls-*
358%{_libdir}/fast_xml-*
359%{_libdir}/fast_yaml-*
360%{_libdir}/goldrush-*
89e7e566 361%{_libdir}/idna-*
beed1a42 362%{_libdir}/jiffy-*
ac7e9a78 363%{_libdir}/jose-*
beed1a42 364%{_libdir}/lager-*
9682d4d5
AM
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
89e7e566 370%{_libdir}/p1_acme-*
beed1a42
AM
371%{_libdir}/p1_mysql-*
372%{_libdir}/p1_oauth2-*
373%{_libdir}/p1_pgsql-*
374%{_libdir}/p1_utils-*
418fc4bb 375%dir %{_libdir}/pkix-*
f55bab44
AM
376%{_libdir}/pkix-*/ebin
377%{_libdir}/pkix-*/LICENSE
beed1a42 378%{_libdir}/rebar_elixir_plugin-*
f0222aaa
AM
379%{_libdir}/sqlite3-*/ebin
380%dir %{_libdir}/sqlite3-*
381%dir %{_libdir}/sqlite3-*/priv
382%attr(755,root,root) %{_libdir}/sqlite3-*/priv/sqlite3_drv.so
beed1a42 383%{_libdir}/stringprep-*
79e489a1 384%{_libdir}/stun-*
89e7e566 385%{_libdir}/unicode_util_compat-*
4852a36b 386%{_libdir}/xmpp-*
08278fc0 387%{_libdir}/yconf-*
fb70a56e 388%dir %attr(770,root,jabber) /var/lib/ejabberd
fcf4c7a2 389%ghost %attr(400,jabber,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) /var/lib/ejabberd/.erlang.cookie
d798517a
JK
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}
67271627 392%{systemdunitdir}/%{name}.service
f20002e6 393/etc/logrotate.d/%{name}
cc994b3c 394%{_mandir}/man5/ejabberd.yml.5*
cba58599 395
61f3ef21 396%if %{with logdb}
cba58599 397%files logdb
398%defattr(644,root,root,755)
beed1a42 399%{_libdir}/ejabberd-%{version}/ebin/mod_logdb*
61f3ef21 400%endif
This page took 0.122972 seconds and 4 git commands to generate.