]> git.pld-linux.org Git - packages/ejabberd.git/blob - ejabberd.spec
b3455baf6a6c67a85fff135e00fe26f7429ef22f
[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     weaker_crypto   # enable SSLv3
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:        16.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:  fc571f0c0459860e876100ef1e1d225e
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-cache_tab-20161125.tar.gz
25 # Source10-md5: 2e249c108a599ba853e86ab1a7ad6425
26 Source11: ejabberd-elixir-20160606.tar.gz
27 # Source11-md5: 982db37dc8c8646a3053044dbdc7c030
28 Source12: ejabberd-esip-20161222.tar.gz
29 # Source12-md5: 5f1c5d6e87031f78cf5b901fbe012c50
30 Source13: ejabberd-ezlib-20160122.tar.gz
31 # Source13-md5: 295896d09211eba4d2c23f7f80c8ae7e
32 Source14: ejabberd-fast_tls-20161222.tar.gz
33 # Source14-md5: 1cfa0d5501c73d3e68849a0c87217cbc
34 Source15: ejabberd-fast_xml-20161125.tar.gz
35 # Source15-md5: c56bbbf355bf6c9c0fb7a2f1df7dbd07
36 Source16: ejabberd-fast_yaml-20161125.tar.gz
37 # Source16-md5: 41771c5f3e45e2e2e91f426a89a53f47
38 Source17: ejabberd-goldrush-20151116.tar.gz
39 # Source17-md5: 5313eb34d8f4ab935307510c9c1c928d
40 Source18: ejabberd-iconv-20161125.tar.gz
41 # Source18-md5: 7e124d4f51703f994da6b7c5ae147213
42 Source19: ejabberd-jiffy-20160331.tar.gz
43 # Source19-md5: 96c2d7ef60375cf9c967d077be27678d
44 Source20: ejabberd-lager-20160610.tar.gz
45 # Source20-md5: 501e65b999507b3043741fbb31512fce
46 Source21: ejabberd-luerl-20151210.tar.gz
47 # Source21-md5: 22bd7e897cd41dd49623b0be698b9c5b
48 Source22: ejabberd-p1_mysql-20161125.tar.gz
49 # Source22-md5: 41ad1bf928ff160df1d9112da19de59f
50 Source23: ejabberd-p1_oauth2-20160123.tar.gz
51 # Source23-md5: d16a2368fad6859e2fc4d93a15d4cd43
52 Source24: ejabberd-p1_pgsql-20161125.tar.gz
53 # Source24-md5: 446809132277766ba515deb24e0d547c
54 Source25: ejabberd-p1_utils-20161125.tar.gz
55 # Source25-md5: 1df40d68faecf5b546bc49b046ffde67
56 Source26: ejabberd-rebar_elixir_plugin-20160105.tar.gz
57 # Source26-md5: 3e9fcc00865d05472934d6eb414a2a1e
58 Source27: ejabberd-stringprep-20161125.tar.gz
59 # Source27-md5: ec50b6b2b36f3db4d8fb8257e66309f8
60 Source28: ejabberd-stun-20161222.tar.gz
61 # Source28-md5: 116eeb16312cd788d6901b0e5fdc1509
62 Source29: ejabberd-xmpp-20161206.tar.gz
63 # Source29-md5: 7281f2bec8b4ec9bc9a21ee9a415ca2c
64 #
65 Patch0:         %{name}-paths.patch
66 Patch1:         %{name}-config.patch
67 # not available for 13.10
68 #Patch2:                %{name}-vcard-access-get.patch
69 # http://www.dp.uz.gov.ua/o.palij/mod_logdb/patch-mod_logdb-13.12.diff
70 Patch3:         %{name}-mod_logdb.patch
71 Patch4:         %{name}-no_sslv3_or_3des.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:  rpmbuild(macros) >= 1.671
82 BuildRequires:  yaml-devel
83 BuildRequires:  zlib-devel
84 BuildRequires:  git-core
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
118 %patch0 -p1
119 %patch1 -p1
120 #%%patch2 -p1
121 %if %{with logdb}
122 %patch3 -p1
123 %endif
124 %if %{without weaker_crypto}
125 %patch4 -p1
126 %endif
127
128 # Various parts of the build system use 'git describe'
129 # which returns nonsense on manual builds using the builder script
130 # and which fails on the PLD builders
131 # I was not able to locate all 'git describe' invocation, sot let's
132 # fool them with this dummy repository
133 unset GIT_DIR GIT_WORK_TREE
134 git init
135 git config user.email "dummy@example.com"
136 git config user.name "Dummy"
137 git add configure.ac
138 git commit -a -m "dummy commit"
139 git tag "%{version}"
140
141 %build
142 unset GIT_DIR GIT_WORK_TREE
143 %{__aclocal} -I m4
144 %{__autoconf}
145 %configure \
146         %{?with_pam --enable-pam} \
147         --enable-user=jabber \
148         --enable-elixir \
149         --enable-full-xml \
150         --enable-odbc \
151         --enable-mysql \
152         --enable-pgsql \
153         %{?with_pam:--enable-pam} \
154         --enable-zlib \
155         --enable-iconv
156
157 touch deps/.got
158
159 cd deps/iconv
160 %configure
161 cd ../..
162 cd deps/stringprep
163 %configure
164 cd ../..
165 cd deps/fast_tls
166 %configure
167 cd ../..
168 cd deps/fast_xml
169 %configure
170 cd ../..
171 cd deps/fast_yaml
172 %configure
173 cd ../..
174 cd deps/ezlib
175 %configure
176 cd ../..
177 cd deps/esip
178 %configure
179 cd ../..
180
181 # for elixir VM
182 LC_ALL=en_US.UTF-8; export LC_ALL
183 %{__make} -j1
184
185 %install
186 rm -rf $RPM_BUILD_ROOT
187 install -d $RPM_BUILD_ROOT{/var/lib/%{name},/etc/{sysconfig,rc.d/init.d}} \
188                 $RPM_BUILD_ROOT{%{systemdunitdir},%{_sbindir}} \
189                 $RPM_BUILD_ROOT{/etc/logrotate.d,/var/log/archive/%{name}}
190
191 unset GIT_DIR GIT_WORK_TREE
192
193 %{__make} install -j1 \
194         CHOWN_COMMAND=true \
195         O_USER="" \
196         G_USER="" \
197         DESTDIR=$RPM_BUILD_ROOT
198
199 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}
200 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
201 install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
202 install %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
203
204 chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{name}*
205
206 chmod 755 $RPM_BUILD_ROOT%{_libdir}/*/priv/lib/*.so
207
208 rm -rf _doc 2>/dev/null || :
209 mv $RPM_BUILD_ROOT%{_docdir}/%{name} _doc
210
211 touch $RPM_BUILD_ROOT%{_sysconfdir}/jabber/ejabberd.cfg
212 touch $RPM_BUILD_ROOT/var/lib/ejabberd/.erlang.cookie
213
214 %clean
215 rm -rf $RPM_BUILD_ROOT
216
217 %pre
218 if [ -e /etc/jabber/ejabberd.cfg ] ; then
219         %banner -e %{name} <<'EOF'
220 Old-style /etc/jabber/ejabberd.cfg configuration file exists. You should
221 consider converting it to the new YAML format. You can do this with the
222 'ejabberdctl convert_to_yaml' command (ejabberd must be already running).
223 EOF
224 fi
225
226 %post
227 if [ -f %{_sysconfdir}/jabber/secret ] ; then
228         SECRET="$(cat %{_sysconfdir}/jabber/secret)"
229         if [ -n "$SECRET" ] ; then
230                 echo -n "Updating component authentication secret in ejabberd config file..." >&2
231                 %{__sed} -i -e "s/@service_secret@/$SECRET/" /etc/jabber/ejabberd.yml
232                 echo "done" >&2
233         fi
234 fi
235 /sbin/chkconfig --add ejabberd
236 if [ -e /var/run/%{name}-upgrade-trigger ] ; then
237         # service will be restarted in the postun trigger
238         rm -f /var/run/%{name}-upgrade-trigger || :
239 else
240         %service ejabberd restart "ejabberd server"
241         %systemd_post %{name}.service
242 fi
243
244 %preun
245 if [ "$1" = "0" ]; then
246         %service ejabberd stop
247         /sbin/chkconfig --del ejabberd
248 fi
249 %systemd_preun %{name}.service
250
251 %postun
252 %systemd_reload
253
254 %triggerprein -- %{name} < 13.10
255 if [ -e /etc/jabber/ejabberd.cfg ] ; then
256         if grep -Eq '^[^%]*access_get' /etc/jabber/ejabberd.cfg ; then
257                 echo "Your 'ejabberd.cfg' config file seems to use 'access_get' option of mod_vcard" >&2
258                 echo "this is not supported by this ejabberd version in PLD" >&2
259                 exit 1
260         fi
261         rm -f /etc/jabber/ejabberd.yml.rpmnew 2>/dev/null || :
262 fi
263 if [ -e /var/lock/subsys/ejabberd ] ; then
264         # old init script won't stop ejabberd correctly
265         # stop it's all processes here
266         # we assume any 'epmd', 'beam', 'beam.smp' or 'heart' process
267         # running with uid of jabber is ejabberd process
268         pids="$(ps -C "epmd beam beam.smp heart" -o pid=,user= | awk '/jabber/ { print $1 }')" || :
269         if [ -n "$pids" ] ; then
270                 %banner -e %{name} <<'EOF'
271 Killing all 'epmd, beam, beam.smp, heart' processed owned by the 'jabber' user to make sure old ejabberd is down.
272
273 EOF
274                 kill $pids || :
275         fi
276 fi
277 touch /var/run/%{name}-upgrade-trigger || :
278
279 %triggerpostun -- %{name} < 13.10
280 # convert old 'NODENAME' in /etc/sysconfig/ejabberd
281 # to 'ERLANG_NODE' in /etc/jabber/ejabberdctl.cfg
282 # and move other settings
283 NODENAME="$(hostname)"
284 if [ -e /etc/sysconfig/ejabberd ] ; then
285         . /etc/sysconfig/ejabberd || :
286 fi
287 subst="s/^#ERLANG_NODE=.*/ERLANG_NODE=ejabberd@${NODENAME}/"
288 if [ "$NODENAME" != "localhost" ] ; then
289         %banner -e %{name} <<'EOF'
290 Configured node name (ejabberd@${NODENAME}) is not at 'localhost'.
291 – setting INET_DIST_INTERFACE=0.0.0.0 in /etc/jabber/ejabberdctl.cfg.
292 You should consider tuning that or your firewall configuration.
293
294 EOF
295         subst="$subst;s/^#INET_DIST_INTERFACE=.*/INET_DIST_INTERFACE=0.0.0.0/"
296 fi
297 if [ -n "$ERL_MAX_PORTS" ] ; then
298         subst="$subst;s/^#ERL_MAX_PORTS=.*/ERL_MAX_PORTS=${ERL_MAX_PORTS}/"
299 fi
300 sed -i -e"$subst" /etc/jabber/ejabberdctl.cfg || :
301 if [ -e /etc/sysconfig/ejabberd ] ; then
302         sed -i.rpmsave \
303                 -e'/^[#[:space:]]*NODENAME=/d;/^# Node name/d' \
304                 -e'/^[#[:space:]]*ERL_MAX_PORTS=/d;/^# uncomment this to allow more then 1024 connections/d' \
305                 -e'/^[#[:space:]]*ERL_FULLSWEEP_AFTER=/d;/^# uncomment this to limit memory usage/d' \
306                 /etc/sysconfig/ejabberd || :
307 fi
308 cp %{_sysconfdir}/jabber/cookie /var/lib/ejabberd/.erlang.cookie || :
309 chown jabber:jabber /var/lib/ejabberd/.erlang.cookie || :
310 chmod 400 /var/lib/ejabberd/.erlang.cookie || :
311 if [ -e /etc/jabber/ejabberd.cfg -a ! -e /etc/jabber/ejabberd.yml.rpmnew ] ; then
312         mv /etc/jabber/ejabberd.yml /etc/jabber/ejabberd.yml.rpmnew
313         echo 'include_config_file: "/etc/jabber/ejabberd.cfg"' > /etc/jabber/ejabberd.yml || :
314 fi
315
316 # post action postponed here
317 %service ejabberd restart "ejabberd server"
318 %systemd_post %{name}.service
319
320 %systemd_trigger %{name}.service
321
322 %files
323 %defattr(644,root,root,755)
324 %doc sql _doc/*
325 %attr(755,root,root) %{_sbindir}/*
326 %attr(755,root,root) %{_bindir}/elixir
327 %attr(755,root,root) %{_bindir}/iex
328 %attr(755,root,root) %{_bindir}/mix
329 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd-inetrc
330 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.yml
331 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberdctl.cfg
332 # legacy config may still be there
333 %attr(640,root,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.cfg
334 %attr(770,root,jabber) /var/log/%{name}
335 %attr(770,root,jabber) /var/log/archive/%{name}
336 %if %{with logdb}
337 %exclude %{_libdir}/ejabberd-%{version}/ebin/mod_logdb*
338 %endif
339 %{_libdir}/ejabberd-%{version}
340 %{_libdir}/cache_tab-*
341 %{_libdir}/elixir-*
342 %{_libdir}/esip-*
343 %{_libdir}/ezlib-*
344 %{_libdir}/fast_tls-*
345 %{_libdir}/fast_xml-*
346 %{_libdir}/fast_yaml-*
347 %{_libdir}/goldrush-*
348 %{_libdir}/iconv-*
349 %{_libdir}/jiffy-*
350 %{_libdir}/lager-*
351 %{_libdir}/luerl-*
352 %{_libdir}/p1_mysql-*
353 %{_libdir}/p1_oauth2-*
354 %{_libdir}/p1_pgsql-*
355 %{_libdir}/p1_utils-*
356 %{_libdir}/rebar_elixir_plugin-*
357 %{_libdir}/stringprep-*
358 %{_libdir}/stun-*
359 %{_libdir}/xmpp-*
360 %dir %attr(770,root,jabber) /var/lib/ejabberd
361 %ghost %attr(400,jabber,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) /var/lib/ejabberd/.erlang.cookie
362 %attr(754,root,root) /etc/rc.d/init.d/%{name}
363 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
364 %{systemdunitdir}/%{name}.service
365 /etc/logrotate.d/%{name}
366
367 %if %{with logdb}
368 %files logdb
369 %defattr(644,root,root,755)
370 %{_libdir}/ejabberd-%{version}/ebin/mod_logdb*
371 %endif
This page took 0.152129 seconds and 2 git commands to generate.