]>
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) |
e0a49cef | 7 | %bcond_with new_sql_schema # build with the new SQL schema |
eddf5b64 | 8 | |
fb70a56e | 9 | Summary: Fault-tolerant distributed Jabber/XMPP server |
7abad569 | 10 | Summary(pl.UTF-8): Odporny na awarie rozproszony serwer Jabbera/XMPP |
d798517a | 11 | Name: ejabberd |
a815cc6c AM |
12 | Version: 18.09 |
13 | Release: 1 | |
fb70a56e JK |
14 | License: GPL |
15 | Group: Applications/Communications | |
d798517a | 16 | Source0: http://www.process-one.net/downloads/ejabberd/%{version}/%{name}-%{version}.tgz |
a815cc6c | 17 | # Source0-md5: f9a49230810c94328a0dc01c63a24b22 |
d798517a JK |
18 | Source1: %{name}.init |
19 | Source2: %{name}.sysconfig | |
20 | Source3: %{name}.service | |
f20002e6 | 21 | Source4: %{name}.logrotate |
e2bda3a7 JK |
22 | # |
23 | # Archives created with the ejabberd-pack_deps.sh script (in this repo) | |
a815cc6c AM |
24 | Source10: ejabberd-base64url-20150806.tar.gz |
25 | # Source10-md5: 6173689227956f8a60951a8791facf31 | |
26 | Source11: ejabberd-cache_tab-20180924.tar.gz | |
27 | # Source11-md5: 69965f1816be4f708e259f24a973e502 | |
28 | Source12: ejabberd-eimp-20180924.tar.gz | |
29 | # Source12-md5: c920c320c8512bdbb31a2e834b02ca7d | |
30 | Source13: ejabberd-elixir-20170515.tar.gz | |
31 | # Source13-md5: 4a637973eab83b07e8cc4b24564c0f5c | |
32 | Source14: ejabberd-ezlib-20180322.tar.gz | |
33 | # Source14-md5: e36b09a55a7d972694fcd24882da05c7 | |
34 | Source15: ejabberd-fast_tls-20180924.tar.gz | |
35 | # Source15-md5: d369c70c9ae7e89680d1c909a46e2087 | |
36 | Source16: ejabberd-fast_xml-20180924.tar.gz | |
37 | # Source16-md5: 65c980e9a77f00b8a1a0357f51a3ed38 | |
38 | Source17: ejabberd-fast_yaml-20180924.tar.gz | |
39 | # Source17-md5: 0d419e5b6694ed6410e6258a2f4c9b47 | |
40 | Source18: ejabberd-goldrush-20160531.tar.gz | |
41 | # Source18-md5: 06ec6d9ff4686590716b8b017504a16f | |
42 | Source19: ejabberd-iconv-20180924.tar.gz | |
43 | # Source19-md5: 8b19bcd50a7158b21d8527fe7a757590 | |
44 | Source20: ejabberd-jiffy-20160331.tar.gz | |
45 | # Source20-md5: 5870143655d179e584c66048939d1e90 | |
46 | Source21: ejabberd-jose-20170518.tar.gz | |
47 | # Source21-md5: 5fcabb971cb0aed4cfdd8ffb29da8b2b | |
48 | Source22: ejabberd-lager-20180903.tar.gz | |
49 | # Source22-md5: 2002e520d7b3de16658d0f350e7ebb89 | |
50 | Source23: ejabberd-p1_mysql-20180723.tar.gz | |
51 | # Source23-md5: 2cb927e43c1ce1c2009a69da0aebeff4 | |
52 | Source24: ejabberd-p1_oauth2-20180425.tar.gz | |
53 | # Source24-md5: 16883be155a73786d504a1ed9dcb4d40 | |
54 | Source25: ejabberd-p1_pgsql-20180628.tar.gz | |
55 | # Source25-md5: 9b41c1653f583812a5d22890ac364baa | |
56 | Source26: ejabberd-p1_utils-20180924.tar.gz | |
57 | # Source26-md5: 5f94c266a3fe2ededfaedfbd612d80bf | |
58 | Source27: ejabberd-rebar_elixir_plugin-20160105.tar.gz | |
59 | # Source27-md5: 080553b9e073ca3f3622432ea03ad1c3 | |
60 | Source28: ejabberd-stringprep-20180924.tar.gz | |
61 | # Source28-md5: c12bd4c434e423ef93b87f6b26bd635c | |
62 | Source29: ejabberd-xmpp-20180925.tar.gz | |
63 | # Source29-md5: dd9a94fab67c516bffbcd0845819b8d4 | |
ac7e9a78 | 64 | |
d798517a JK |
65 | Patch0: %{name}-paths.patch |
66 | Patch1: %{name}-config.patch | |
3f23be8e | 67 | # https://paleg.github.io/mod_logdb/ |
a815cc6c | 68 | # https://github.com/paleg/ejabberd/tree/18.06-mod_logdb |
d798517a | 69 | Patch3: %{name}-mod_logdb.patch |
3f2196e7 | 70 | URL: http://www.ejabberd.im/ |
fb70a56e | 71 | BuildRequires: autoconf |
1a2644b6 | 72 | BuildRequires: automake |
a306e2ac | 73 | BuildRequires: erlang >= 1:R16B03 |
6f0d08c1 | 74 | BuildRequires: expat-devel >= 1.95 |
75 | BuildRequires: openssl-devel | |
e9f604ed | 76 | %if %{with pam} |
77 | BuildRequires: pam-devel | |
78 | %endif | |
126fba49 | 79 | BuildRequires: git-core |
67271627 | 80 | BuildRequires: rpmbuild(macros) >= 1.671 |
60c3a68c | 81 | BuildRequires: yaml-devel |
01f61704 | 82 | BuildRequires: zlib-devel |
27b10c8b | 83 | Requires(post): /usr/bin/perl |
b15a901d | 84 | Requires(post): jabber-common |
0d54398f | 85 | Requires(post): sed >= 4.0 |
fb70a56e | 86 | Requires(post): textutils |
fb70a56e | 87 | Requires(post,preun): /sbin/chkconfig |
67271627 | 88 | Requires(post,preun,postun): systemd-units >= 38 |
9a105ba4 | 89 | Requires: erlang >= 1:R15B01 |
bb159536 | 90 | Requires: expat >= 1.95 |
27b10c8b | 91 | Requires: rc-scripts |
67271627 | 92 | Requires: systemd-units >= 38 |
028763ab | 93 | Conflicts: logrotate < 3.8.0 |
fb70a56e JK |
94 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
95 | ||
fcf4c7a2 JK |
96 | %define _noautoprovfiles %{_libdir}/%{name}/priv/lib/ |
97 | ||
fb70a56e | 98 | %description |
472227c5 | 99 | ejabberd is a Free and Open Source fault-tolerant distributed Jabber |
100 | server. It is written mostly in Erlang. | |
fb70a56e | 101 | |
e0166ea5 JR |
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. | |
378431cb | 105 | |
cba58599 | 106 | %package logdb |
1a2644b6 | 107 | Summary: Server-side logging module |
cba58599 | 108 | Group: Applications/Communications |
109 | Requires: %{name} = %{version}-%{release} | |
110 | ||
111 | %description logdb | |
112 | Server-side logging module. | |
113 | ||
fb70a56e | 114 | %prep |
beed1a42 | 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 |
fb70a56e | 116 | %patch0 -p1 |
7f71a53c JK |
117 | %patch1 -p1 |
118 | #%%patch2 -p1 | |
9953f9cb | 119 | %if %{with logdb} |
046546ef | 120 | %patch3 -p1 |
9953f9cb | 121 | %endif |
fb70a56e | 122 | |
8e141538 JK |
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 | |
d798661f JK |
130 | git config user.email "dummy@example.com" |
131 | git config user.name "Dummy" | |
8e141538 JK |
132 | git add configure.ac |
133 | git commit -a -m "dummy commit" | |
134 | git tag "%{version}" | |
fb8f9840 | 135 | |
fb70a56e | 136 | %build |
8e141538 | 137 | unset GIT_DIR GIT_WORK_TREE |
e2bda3a7 | 138 | %{__aclocal} -I m4 |
fb70a56e | 139 | %{__autoconf} |
6b419144 | 140 | %configure \ |
5613d9b6 | 141 | %{?with_pam --enable-pam} \ |
e4f8c955 | 142 | --enable-user=jabber \ |
e0a49cef | 143 | %{__enable_disable new_sql_schema new-sql-schema} \ |
8311848d | 144 | --enable-elixir \ |
e2bda3a7 | 145 | --enable-full-xml \ |
e2bda3a7 JK |
146 | --enable-odbc \ |
147 | --enable-mysql \ | |
148 | --enable-pgsql \ | |
149 | %{?with_pam:--enable-pam} \ | |
150 | --enable-zlib \ | |
beed1a42 | 151 | --enable-iconv |
5e08a6fd | 152 | |
e2bda3a7 JK |
153 | touch deps/.got |
154 | ||
beed1a42 | 155 | cd deps/iconv |
e2bda3a7 JK |
156 | %configure |
157 | cd ../.. | |
beed1a42 | 158 | cd deps/stringprep |
e2bda3a7 JK |
159 | %configure |
160 | cd ../.. | |
beed1a42 | 161 | cd deps/fast_tls |
e2bda3a7 JK |
162 | %configure |
163 | cd ../.. | |
beed1a42 AM |
164 | cd deps/fast_xml |
165 | %configure | |
e2bda3a7 | 166 | cd ../.. |
beed1a42 | 167 | cd deps/fast_yaml |
e2bda3a7 JK |
168 | %configure |
169 | cd ../.. | |
beed1a42 | 170 | cd deps/ezlib |
e2bda3a7 JK |
171 | %configure |
172 | cd ../.. | |
173 | ||
beed1a42 AM |
174 | # for elixir VM |
175 | LC_ALL=en_US.UTF-8; export LC_ALL | |
92a38251 | 176 | %{__make} -j1 |
fb70a56e JK |
177 | |
178 | %install | |
179 | rm -rf $RPM_BUILD_ROOT | |
d798517a | 180 | install -d $RPM_BUILD_ROOT{/var/lib/%{name},/etc/{sysconfig,rc.d/init.d}} \ |
f20002e6 | 181 | $RPM_BUILD_ROOT{%{systemdunitdir},%{_sbindir}} \ |
028763ab | 182 | $RPM_BUILD_ROOT{/etc/logrotate.d,/var/log/archive/%{name}} |
fb70a56e | 183 | |
8e141538 JK |
184 | unset GIT_DIR GIT_WORK_TREE |
185 | ||
e2bda3a7 | 186 | %{__make} install -j1 \ |
e4f8c955 JK |
187 | CHOWN_COMMAND=true \ |
188 | O_USER="" \ | |
189 | G_USER="" \ | |
27b10c8b | 190 | DESTDIR=$RPM_BUILD_ROOT |
fb70a56e | 191 | |
d798517a | 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} |
126fba49 AM |
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} | |
fb70a56e | 196 | |
d798517a | 197 | chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{name}* |
fb70a56e | 198 | |
beed1a42 | 199 | chmod 755 $RPM_BUILD_ROOT%{_libdir}/*/priv/lib/*.so |
5613d9b6 | 200 | |
e2bda3a7 JK |
201 | rm -rf _doc 2>/dev/null || : |
202 | mv $RPM_BUILD_ROOT%{_docdir}/%{name} _doc | |
059c0bab | 203 | |
fcf4c7a2 JK |
204 | touch $RPM_BUILD_ROOT%{_sysconfdir}/jabber/ejabberd.cfg |
205 | touch $RPM_BUILD_ROOT/var/lib/ejabberd/.erlang.cookie | |
206 | ||
fb70a56e JK |
207 | %clean |
208 | rm -rf $RPM_BUILD_ROOT | |
209 | ||
e2bda3a7 JK |
210 | %pre |
211 | if [ -e /etc/jabber/ejabberd.cfg ] ; then | |
fcf4c7a2 JK |
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 | |
27161f77 | 215 | 'ejabberdctl convert_to_yaml' command (ejabberd must be already running). |
fcf4c7a2 | 216 | EOF |
e2bda3a7 JK |
217 | fi |
218 | ||
fb70a56e | 219 | %post |
0d54398f | 220 | if [ -f %{_sysconfdir}/jabber/secret ] ; then |
7f71a53c | 221 | SECRET="$(cat %{_sysconfdir}/jabber/secret)" |
fb70a56e | 222 | if [ -n "$SECRET" ] ; then |
7f71a53c JK |
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 | |
fb70a56e JK |
226 | fi |
227 | fi | |
fb70a56e | 228 | /sbin/chkconfig --add ejabberd |
7102eb90 JK |
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 | |
67271627 | 236 | |
fb70a56e JK |
237 | %preun |
238 | if [ "$1" = "0" ]; then | |
b15a901d | 239 | %service ejabberd stop |
fb70a56e JK |
240 | /sbin/chkconfig --del ejabberd |
241 | fi | |
67271627 JK |
242 | %systemd_preun %{name}.service |
243 | ||
244 | %postun | |
245 | %systemd_reload | |
246 | ||
247 | %triggerprein -- %{name} < 13.10 | |
7102eb90 JK |
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 | |
67271627 JK |
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. | |
7102eb90 | 265 | |
67271627 JK |
266 | EOF |
267 | kill $pids || : | |
268 | fi | |
269 | fi | |
7102eb90 | 270 | touch /var/run/%{name}-upgrade-trigger || : |
fb70a56e | 271 | |
fcf4c7a2 JK |
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}/" | |
7102eb90 JK |
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 | |
fcf4c7a2 JK |
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 || : | |
7102eb90 JK |
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 | ||
67271627 | 313 | %systemd_trigger %{name}.service |
fcf4c7a2 | 314 | |
fb70a56e JK |
315 | %files |
316 | %defattr(644,root,root,755) | |
e2bda3a7 | 317 | %doc sql _doc/* |
fb70a56e | 318 | %attr(755,root,root) %{_sbindir}/* |
4852a36b AM |
319 | %attr(755,root,root) %{_bindir}/elixir |
320 | %attr(755,root,root) %{_bindir}/iex | |
321 | %attr(755,root,root) %{_bindir}/mix | |
fcf4c7a2 JK |
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 | |
028763ab JK |
327 | %attr(770,root,jabber) /var/log/%{name} |
328 | %attr(770,root,jabber) /var/log/archive/%{name} | |
61f3ef21 | 329 | %if %{with logdb} |
beed1a42 | 330 | %exclude %{_libdir}/ejabberd-%{version}/ebin/mod_logdb* |
61f3ef21 | 331 | %endif |
beed1a42 | 332 | %{_libdir}/ejabberd-%{version} |
ac7e9a78 | 333 | %{_libdir}/base64url-* |
beed1a42 | 334 | %{_libdir}/cache_tab-* |
105db1e0 JK |
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 | |
beed1a42 | 341 | %{_libdir}/elixir-* |
beed1a42 AM |
342 | %{_libdir}/ezlib-* |
343 | %{_libdir}/fast_tls-* | |
344 | %{_libdir}/fast_xml-* | |
345 | %{_libdir}/fast_yaml-* | |
346 | %{_libdir}/goldrush-* | |
347 | %{_libdir}/iconv-* | |
348 | %{_libdir}/jiffy-* | |
ac7e9a78 | 349 | %{_libdir}/jose-* |
beed1a42 | 350 | %{_libdir}/lager-* |
beed1a42 AM |
351 | %{_libdir}/p1_mysql-* |
352 | %{_libdir}/p1_oauth2-* | |
353 | %{_libdir}/p1_pgsql-* | |
354 | %{_libdir}/p1_utils-* | |
beed1a42 AM |
355 | %{_libdir}/rebar_elixir_plugin-* |
356 | %{_libdir}/stringprep-* | |
4852a36b | 357 | %{_libdir}/xmpp-* |
fb70a56e | 358 | %dir %attr(770,root,jabber) /var/lib/ejabberd |
fcf4c7a2 | 359 | %ghost %attr(400,jabber,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) /var/lib/ejabberd/.erlang.cookie |
d798517a JK |
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} | |
67271627 | 362 | %{systemdunitdir}/%{name}.service |
f20002e6 | 363 | /etc/logrotate.d/%{name} |
cba58599 | 364 | |
61f3ef21 | 365 | %if %{with logdb} |
cba58599 | 366 | %files logdb |
367 | %defattr(644,root,root,755) | |
beed1a42 | 368 | %{_libdir}/ejabberd-%{version}/ebin/mod_logdb* |
61f3ef21 | 369 | %endif |