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