-#
# TODO:
-# - add systemd unit
-
+# - package all deps (tarballs 10-29) into separate spec files
+# (like in fedora)
# Conditional build:
%bcond_with pam # PAM authentication support
-%bcond_with logdb # enable mod_logdb (server-side message logging)
-#
-
-%define realname ejabberd
+%bcond_without logdb # enable mod_logdb (server-side message logging)
+%bcond_with weaker_crypto # enable SSLv3
Summary: Fault-tolerant distributed Jabber/XMPP server
Summary(pl.UTF-8): Odporny na awarie rozproszony serwer Jabbera/XMPP
-Name: %{realname}
-Version: 13.10
-Release: 0.1
+Name: ejabberd
+Version: 16.08
+Release: 1
License: GPL
Group: Applications/Communications
-Source0: http://www.process-one.net/downloads/ejabberd/%{version}/%{realname}-%{version}.tgz
-# Source0-md5: 94ce4fe244ee72771eeafe27209d6d3c
-Source1: %{realname}.init
-Source2: %{realname}.sysconfig
+Source0: http://www.process-one.net/downloads/ejabberd/%{version}/%{name}-%{version}.tgz
+# Source0-md5: a225e99c50e91464cf8f78bd8d129664
+Source1: %{name}.init
+Source2: %{name}.sysconfig
+Source3: %{name}.service
+Source4: %{name}.logrotate
#
# Archives created with the ejabberd-pack_deps.sh script (in this repo)
-Source10: ejabberd-goldrush-20131108.tar.gz
-# Source10-md5: 3f61708d20fcee2e7d47036cc470f4e9
-Source11: ejabberd-lager-20131111.tar.gz
-# Source11-md5: e0933da9d0462b045f6b9c4bbd320d3e
-Source12: ejabberd-p1_cache_tab-20130515.tar.gz
-# Source12-md5: f2500cffdaff434b354d01eeb24d136d
-Source13: ejabberd-p1_iconv-20130602.tar.gz
-# Source13-md5: ab0118d4097ee756f65fd087265c88ae
-Source14: ejabberd-p1_stringprep-20131113.tar.gz
-# Source14-md5: 282d70c792a78ea9a7415b0b4e65e157
-Source15: ejabberd-p1_tls-20130717.tar.gz
-# Source15-md5: 1211c5d8f0a95b58dfc5fb5bf4e13ded
-Source16: ejabberd-p1_xml-20131017.tar.gz
-# Source16-md5: dc7ebd7ed1ed6340ff0e7739173d4438
-Source17: ejabberd-p1_yaml-20131031.tar.gz
-# Source17-md5: 82d4bb5c5d56ab93a60f5d1c6e583dc1
-Source18: ejabberd-p1_zlib-20130515.tar.gz
-# Source18-md5: a203d9359122ead64966eeb0bd1c8cf7
-Source19: ejabberd-xmlrpc-20130116.tar.gz
-# Source19-md5: 22e02ff7ca174b4ac225005f63da10ad
-Source20: ejabberd-jiffy-20130702.tar.gz
-# Source20-md5: 01b156e97005f07ce8bb46ecf27471ff
-Source21: ejabberd-p1_mysql-20131024.tar.gz
-# Source21-md5: c02921f21ba030357d2cbbbf182af54a
-Source22: ejabberd-p1_pam-20130515.tar.gz
-# Source22-md5: 0ca31094d93dfb047f05c7539136433a
-Source23: ejabberd-p1_pgsql-20130515.tar.gz
-# Source23-md5: 1958be8e59d1b472499ef1bdf8edc1db
-Source24: ejabberd-p1_stun-20130624.tar.gz
-# Source24-md5: 9a1c5ad9b3b95364d3f76446fcf58dc3
+Source10: ejabberd-cache_tab-20160630.tar.gz
+# Source10-md5: 28c7b761c5bdc70bbfa3c1d85fff9825
+Source11: ejabberd-elixir-20150928.tar.gz
+# Source11-md5: 1a0cba08de1687affe590e5abbc993cc
+Source12: ejabberd-esip-20160708.tar.gz
+# Source12-md5: 759e70d30fc1c5adbae3976e28c8c659
+Source13: ejabberd-ezlib-20160122.tar.gz
+# Source13-md5: 41907afdd7195014b1e4cf4764564a37
+Source14: ejabberd-fast_tls-20160708.tar.gz
+# Source14-md5: e4f56b9dce6fc68f9eb58417554fe24a
+Source15: ejabberd-fast_xml-20160708.tar.gz
+# Source15-md5: f26c98665fe7370262412084d802a310
+Source16: ejabberd-fast_yaml-20160708.tar.gz
+# Source16-md5: 815111ff387608a9c0a41898d8fe0ad6
+Source17: ejabberd-goldrush-20151116.tar.gz
+# Source17-md5: 61324bdee5d304a7189c305a6b4fe39e
+Source18: ejabberd-iconv-20160708.tar.gz
+# Source18-md5: 5b8ad7ada3f46b766e4be985322225f9
+Source19: ejabberd-jiffy-20160106.tar.gz
+# Source19-md5: 50a03a4289ab5c37c3263e73c15873ef
+Source20: ejabberd-lager-20160610.tar.gz
+# Source20-md5: 395b1fd4d056684c8b92d50d9916b7ed
+Source21: ejabberd-luerl-20151210.tar.gz
+# Source21-md5: 180f8ff3f24d00cbdabbf28c7e415f85
+Source22: ejabberd-p1_mysql-20160122.tar.gz
+# Source22-md5: 40b984a50b7d3a7bd00dd15aafd7a44a
+Source23: ejabberd-p1_oauth2-20160123.tar.gz
+# Source23-md5: 8dda6e87a6551724b0bc7d21b7a59357
+Source24: ejabberd-p1_pgsql-20160223.tar.gz
+# Source24-md5: 739c03ac9089f7f86d55cea3ee5bee25
+Source25: ejabberd-p1_utils-20160701.tar.gz
+# Source25-md5: 8a8734d8dd773ec0cf808e1a8bbdbde3
+Source26: ejabberd-p1_xmlrpc-20160123.tar.gz
+# Source26-md5: 8ec9db8add5754738f2272d690adb75c
+Source27: ejabberd-rebar_elixir_plugin-20160105.tar.gz
+# Source27-md5: 40f41b936c8c774174c953895f132f98
+Source28: ejabberd-stringprep-20160708.tar.gz
+# Source28-md5: e9432b08b37602e54e8716c2b9e2edab
+Source29: ejabberd-stun-20160708.tar.gz
+# Source29-md5: fea7f6b75606d51478a468ae664f0d64
#
-Patch0: %{realname}-makefile.patch
+Patch0: %{name}-paths.patch
+Patch1: %{name}-config.patch
# not available for 13.10
-#Patch1: %{realname}-vcard-access-get.patch
-# http://www.dp.uz.gov.ua/o.palij/mod_logdb/patch-mod_logdb-2.1.12.diff
-Patch2: %{realname}-mod_logdb.patch
-Patch3: %{realname}-inetrc_path.patch
+#Patch2: %{name}-vcard-access-get.patch
+# http://www.dp.uz.gov.ua/o.palij/mod_logdb/patch-mod_logdb-13.12.diff
+Patch3: %{name}-mod_logdb.patch
+Patch4: %{name}-no_sslv3_or_3des.patch
URL: http://www.ejabberd.im/
BuildRequires: autoconf
BuildRequires: automake
-BuildRequires: erlang >= 1:R15B01
+BuildRequires: erlang >= 1:R16B03
BuildRequires: expat-devel >= 1.95
BuildRequires: openssl-devel
%if %{with pam}
BuildRequires: pam-devel
%endif
-BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: rpmbuild(macros) >= 1.671
BuildRequires: yaml-devel
BuildRequires: zlib-devel
+BuildRequires: git-core
Requires(post): /usr/bin/perl
Requires(post): jabber-common
Requires(post): sed >= 4.0
Requires(post): textutils
Requires(post,preun): /sbin/chkconfig
-Requires: erlang
+Requires(post,preun,postun): systemd-units >= 38
+Requires: erlang >= 1:R15B01
Requires: expat >= 1.95
Requires: rc-scripts
+Requires: systemd-units >= 38
+Conflicts: logrotate < 3.8.0
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _noautoprovfiles %{_libdir}/%{name}/priv/lib/
Server-side logging module.
%prep
-%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
+%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
%patch0 -p1
-#%%patch1 -p1
+%patch1 -p1
+#%%patch2 -p1
%if %{with logdb}
-%patch2 -p0
-%endif
%patch3 -p1
+%endif
+%if %{without weaker_crypto}
+%patch4 -p1
+%endif
-# do not let it use 'git describe' to fetch version
-# it uses nonsense during manual builds and fails on the builder
-sed -i -e"s/AC_INIT(ejabberd,[^,]*,/AC_INIT(ejabberd,community %{version},/" configure.ac
-! grep -q "git describe" configure.ac
+# Various parts of the build system use 'git describe'
+# which returns nonsense on manual builds using the builder script
+# and which fails on the PLD builders
+# I was not able to locate all 'git describe' invocation, sot let's
+# fool them with this dummy repository
+unset GIT_DIR GIT_WORK_TREE
+git init
+git config user.email "dummy@example.com"
+git config user.name "Dummy"
+git add configure.ac
+git commit -a -m "dummy commit"
+git tag "%{version}"
%build
+unset GIT_DIR GIT_WORK_TREE
%{__aclocal} -I m4
%{__autoconf}
%configure \
%{?with_pam --enable-pam} \
- --with-openssl=%{_prefix} \
--enable-user=jabber \
+ --enable-elixir \
--enable-full-xml \
- --enable-nif \
--enable-odbc \
--enable-mysql \
--enable-pgsql \
%{?with_pam:--enable-pam} \
--enable-zlib \
- --enable-stun \
- --enable-json \
- --enable-iconv \
- --enable-lager
+ --enable-iconv
+
touch deps/.got
-cd deps/p1_iconv
+cd deps/iconv
%configure
cd ../..
-cd deps/p1_stringprep
+cd deps/stringprep
%configure
cd ../..
-cd deps/p1_tls
+cd deps/fast_tls
%configure
cd ../..
-cd deps/p1_xml
-%configure \
- --enable-nif \
- --enable-full-xml
+cd deps/fast_xml
+%configure
cd ../..
-cd deps/p1_yaml
+cd deps/fast_yaml
%configure
cd ../..
-cd deps/p1_zlib
+cd deps/ezlib
+%configure
+cd ../..
+cd deps/esip
%configure
cd ../..
+# for elixir VM
+LC_ALL=en_US.UTF-8; export LC_ALL
%{__make} -j1
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/var/lib/%{realname},/etc/{sysconfig,rc.d/init.d},%{_sbindir}}
+install -d $RPM_BUILD_ROOT{/var/lib/%{name},/etc/{sysconfig,rc.d/init.d}} \
+ $RPM_BUILD_ROOT{%{systemdunitdir},%{_sbindir}} \
+ $RPM_BUILD_ROOT{/etc/logrotate.d,/var/log/archive/%{name}}
+
+unset GIT_DIR GIT_WORK_TREE
%{__make} install -j1 \
CHOWN_COMMAND=true \
G_USER="" \
DESTDIR=$RPM_BUILD_ROOT
-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/%{realname}
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{realname}
+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}
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
+install %{SOURCE4} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
-chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{realname}*
+chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{name}*
-chmod 755 $RPM_BUILD_ROOT%{_libdir}/ejabberd/priv/lib/*.so
+chmod 755 $RPM_BUILD_ROOT%{_libdir}/*/priv/lib/*.so
rm -rf _doc 2>/dev/null || :
mv $RPM_BUILD_ROOT%{_docdir}/%{name} _doc
%pre
if [ -e /etc/jabber/ejabberd.cfg ] ; then
- if grep -Eq '^[^#]*access_get' ; then
- echo "Your 'ejabberd.cfg' config file seems to use 'access_get' option of mod_vcard" >&2
- echo "this is not supported by this ejabberd version in PLD" >&2
- exit 1
- fi
%banner -e %{name} <<'EOF'
Old-style /etc/jabber/ejabberd.cfg configuration file exists. You should
consider converting it to the new YAML format. You can do this with the
-ejabberctl command.
+'ejabberdctl convert_to_yaml' command (ejabberd must be already running).
EOF
fi
%post
if [ -f %{_sysconfdir}/jabber/secret ] ; then
- SECRET=`cat %{_sysconfdir}/jabber/secret`
+ SECRET="$(cat %{_sysconfdir}/jabber/secret)"
if [ -n "$SECRET" ] ; then
- echo "Updating component authentication secret in ejabberd config file..."
- %{__sed} -i -e "s/>secret</>$SECRET</" /etc/jabber/ejabberd.yml
+ echo -n "Updating component authentication secret in ejabberd config file..." >&2
+ %{__sed} -i -e "s/@service_secret@/$SECRET/" /etc/jabber/ejabberd.yml
+ echo "done" >&2
fi
fi
-
/sbin/chkconfig --add ejabberd
-%service ejabberd restart "ejabberd server"
+if [ -e /var/run/%{name}-upgrade-trigger ] ; then
+ # service will be restarted in the postun trigger
+ rm -f /var/run/%{name}-upgrade-trigger || :
+else
+ %service ejabberd restart "ejabberd server"
+ %systemd_post %{name}.service
+fi
%preun
if [ "$1" = "0" ]; then
%service ejabberd stop
/sbin/chkconfig --del ejabberd
fi
+%systemd_preun %{name}.service
+
+%postun
+%systemd_reload
+
+%triggerprein -- %{name} < 13.10
+if [ -e /etc/jabber/ejabberd.cfg ] ; then
+ if grep -Eq '^[^%]*access_get' /etc/jabber/ejabberd.cfg ; then
+ echo "Your 'ejabberd.cfg' config file seems to use 'access_get' option of mod_vcard" >&2
+ echo "this is not supported by this ejabberd version in PLD" >&2
+ exit 1
+ fi
+ rm -f /etc/jabber/ejabberd.yml.rpmnew 2>/dev/null || :
+fi
+if [ -e /var/lock/subsys/ejabberd ] ; then
+ # old init script won't stop ejabberd correctly
+ # stop it's all processes here
+ # we assume any 'epmd', 'beam', 'beam.smp' or 'heart' process
+ # running with uid of jabber is ejabberd process
+ pids="$(ps -C "epmd beam beam.smp heart" -o pid=,user= | awk '/jabber/ { print $1 }')" || :
+ if [ -n "$pids" ] ; then
+ %banner -e %{name} <<'EOF'
+Killing all 'epmd, beam, beam.smp, heart' processed owned by the 'jabber' user to make sure old ejabberd is down.
+
+EOF
+ kill $pids || :
+ fi
+fi
+touch /var/run/%{name}-upgrade-trigger || :
%triggerpostun -- %{name} < 13.10
# convert old 'NODENAME' in /etc/sysconfig/ejabberd
. /etc/sysconfig/ejabberd || :
fi
subst="s/^#ERLANG_NODE=.*/ERLANG_NODE=ejabberd@${NODENAME}/"
+if [ "$NODENAME" != "localhost" ] ; then
+ %banner -e %{name} <<'EOF'
+Configured node name (ejabberd@${NODENAME}) is not at 'localhost'.
+– setting INET_DIST_INTERFACE=0.0.0.0 in /etc/jabber/ejabberdctl.cfg.
+You should consider tuning that or your firewall configuration.
+
+EOF
+ subst="$subst;s/^#INET_DIST_INTERFACE=.*/INET_DIST_INTERFACE=0.0.0.0/"
+fi
if [ -n "$ERL_MAX_PORTS" ] ; then
subst="$subst;s/^#ERL_MAX_PORTS=.*/ERL_MAX_PORTS=${ERL_MAX_PORTS}/"
fi
/etc/sysconfig/ejabberd || :
fi
cp %{_sysconfdir}/jabber/cookie /var/lib/ejabberd/.erlang.cookie || :
+chown jabber:jabber /var/lib/ejabberd/.erlang.cookie || :
+chmod 400 /var/lib/ejabberd/.erlang.cookie || :
+if [ -e /etc/jabber/ejabberd.cfg -a ! -e /etc/jabber/ejabberd.yml.rpmnew ] ; then
+ mv /etc/jabber/ejabberd.yml /etc/jabber/ejabberd.yml.rpmnew
+ echo 'include_config_file: "/etc/jabber/ejabberd.cfg"' > /etc/jabber/ejabberd.yml || :
+fi
+
+# post action postponed here
+%service ejabberd restart "ejabberd server"
+%systemd_post %{name}.service
+
+%systemd_trigger %{name}.service
%files
%defattr(644,root,root,755)
%attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberdctl.cfg
# legacy config may still be there
%attr(640,root,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.cfg
-%attr(770,root,jabber) /var/log/ejabberd
+%attr(770,root,jabber) /var/log/%{name}
+%attr(770,root,jabber) /var/log/archive/%{name}
%if %{with logdb}
-%exclude %{_libdir}/ejabberd/ebin/mod_logdb*
+%exclude %{_libdir}/ejabberd-%{version}/ebin/mod_logdb*
%endif
-%{_libdir}/ejabberd
+%{_libdir}/ejabberd-%{version}
+%{_libdir}/cache_tab-*
+%{_libdir}/elixir-*
+%{_libdir}/esip-*
+%{_libdir}/ezlib-*
+%{_libdir}/fast_tls-*
+%{_libdir}/fast_xml-*
+%{_libdir}/fast_yaml-*
+%{_libdir}/goldrush-*
+%{_libdir}/iconv-*
+%{_libdir}/jiffy-*
+%{_libdir}/lager-*
+%{_libdir}/luerl-*
+%{_libdir}/p1_mysql-*
+%{_libdir}/p1_oauth2-*
+%{_libdir}/p1_pgsql-*
+%{_libdir}/p1_utils-*
+%{_libdir}/p1_xmlrpc-*
+%{_libdir}/rebar_elixir_plugin-*
+%{_libdir}/stringprep-*
+%{_libdir}/stun-*
%dir %attr(770,root,jabber) /var/lib/ejabberd
%ghost %attr(400,jabber,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) /var/lib/ejabberd/.erlang.cookie
-%attr(754,root,root) /etc/rc.d/init.d/%{realname}
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{realname}
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%{systemdunitdir}/%{name}.service
+/etc/logrotate.d/%{name}
%if %{with logdb}
%files logdb
%defattr(644,root,root,755)
-%{_libdir}/ejabberd/ebin/mod_logdb*
+%{_libdir}/ejabberd-%{version}/ebin/mod_logdb*
%endif