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