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