]> git.pld-linux.org Git - packages/ejabberd.git/blob - ejabberd.spec
- up to 17.01
[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:        17.01
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:  c5fd21834cdd09bea60695d3b4863861
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}-cache_tab-20161226.tar.gz
25 # Source10-md5: d8b03d60176cfe6c31637b4f723b5244
26 Source11:       %{name}-elixir-20160606.tar.gz
27 # Source11-md5: ebbd16c764c46f21e10b61ead087a502
28 Source12:       %{name}-esip-20161222.tar.gz
29 # Source12-md5: 235094d03e8f835832484d077a9dcc2d
30 Source13:       %{name}-ezlib-20170110.tar.gz
31 # Source13-md5: faaa2adfdf2ce8d6cfa010efab73e45a
32 Source14:       %{name}-fast_tls-20170110.tar.gz
33 # Source14-md5: 8b7c12e3fd19d19b3103c48f6c8d8695
34 Source15:       %{name}-fast_xml-20170110.tar.gz
35 # Source15-md5: e496fb29f6d27bf35b5d94ea2b28f52d
36 Source16:       %{name}-fast_yaml-20170110.tar.gz
37 # Source16-md5: ca19fcfa88a1bbf4f5ac6a012c9653dd
38 Source17:       %{name}-goldrush-20151116.tar.gz
39 # Source17-md5: 087e50158cb8ed98381febf08943acaf
40 Source18:       %{name}-iconv-20161125.tar.gz
41 # Source18-md5: f4acc0c7263a650cb9fdf53a72513dab
42 Source19:       %{name}-jiffy-20160331.tar.gz
43 # Source19-md5: db0777025a5b6170b1af5b64b0cae520
44 Source20:       %{name}-lager-20160610.tar.gz
45 # Source20-md5: d2488fc6e32610ba4dda254f27360068
46 Source21:       %{name}-luerl-20151210.tar.gz
47 # Source21-md5: 753d00ef2729b332e835b2134e637726
48 Source22:       %{name}-p1_mysql-20161125.tar.gz
49 # Source22-md5: bde35c80527fa0d1a429258670479a24
50 Source23:       %{name}-p1_oauth2-20160123.tar.gz
51 # Source23-md5: 01cb28e412b29a645845a37c407c4fd8
52 Source24:       %{name}-p1_pgsql-20170110.tar.gz
53 # Source24-md5: 1edb7f7f8bdae9aba69abc1583ab60f6
54 Source25:       %{name}-p1_utils-20161125.tar.gz
55 # Source25-md5: 5c5f6e91adb16898ef575ac97be122dc
56 Source26:       %{name}-rebar_elixir_plugin-20160105.tar.gz
57 # Source26-md5: 36665a52941f09c27d6dcec22fc4a584
58 Source27:       %{name}-stringprep-20161125.tar.gz
59 # Source27-md5: 0bb04621b4203d85de78b99a9ab1fe93
60 Source28:       %{name}-stun-20161222.tar.gz
61 # Source28-md5: 7995d220358131e022da2d1a7e14cec5
62 Source29:       %{name}-xmpp-20170120.tar.gz
63 # Source29-md5: c616d8870077284c04db84ad13ff9879
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:  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
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 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
201 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
202 cp -p %{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.359514 seconds and 3 git commands to generate.