File ejabberd.spec of Package ejabberd
%define bname ejabberd
Name: %bname
Version: 17.09
Release: 2
Summary: Instant messaging server
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/processone/%bname
Source: %bname-%version.tar.xz
#Patch0: %bname-%version-git.patch
Patch1: %bname-17.07-fix-include.patch
BuildArch: noarch
Requires: erlang-xmpp >= 1.1.13
BuildRequires: autoconf automake
BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
BuildRequires: erlang-parsetools-devel
BuildRequires: erlang-p1_utils-devel >= 1.0.10
BuildRequires: erlang-fast_xml-devel >= 1.1.24
BuildRequires: erlang-xmpp-devel >= 1.1.15
BuildRequires: erlang-esip-devel >= 1.0.16
BuildRequires: erlang-lager-devel >= 3.2.1
%description
Ejabberd is a distributed, fault-tolerant technology that allows the creation of
large-scale instant messaging applications. The server can reliably support
thousands of simultaneous users on a single node and has been designed to provide
exceptional standards of fault tolerance.
%package mnesia
Summary: Ejabberd Mnesia support
Group: Development/Tools/Other
Requires: %name = %version-%release
%description mnesia
Ejabberd is a distributed, fault-tolerant technology that allows the creation of
large-scale instant messaging applications. The server can reliably support
thousands of simultaneous users on a single node and has been designed to provide
exceptional standards of fault tolerance.
This package contains Ejabberd Mnesia support.
%package sql
Summary: Ejabberd SQL RDBMS support
Group: Development/Tools/Other
Requires: %name = %version-%release
%description sql
Ejabberd is a distributed, fault-tolerant technology that allows the creation of
large-scale instant messaging applications. The server can reliably support
thousands of simultaneous users on a single node and has been designed to provide
exceptional standards of fault tolerance.
This package contains Ejabberd SQL RDBMS support.
%package riak
Summary: Ejabberd Riak support
Group: Development/Tools/Other
Requires: %name = %version-%release
%description riak
Ejabberd is a distributed, fault-tolerant technology that allows the creation of
large-scale instant messaging applications. The server can reliably support
thousands of simultaneous users on a single node and has been designed to provide
exceptional standards of fault tolerance.
This package contains Ejabberd Riak support.
%package redis
Summary: Ejabberd Redis support
Group: Development/Tools/Other
Requires: %name = %version-%release
%description redis
Ejabberd is a distributed, fault-tolerant technology that allows the creation of
large-scale instant messaging applications. The server can reliably support
thousands of simultaneous users on a single node and has been designed to provide
exceptional standards of fault tolerance.
This package contains Ejabberd Redis support.
%package devel
Summary: Headers of Ejabberd
Group: Development/Tools/Other
%description devel
Ejabberd is a distributed, fault-tolerant technology that allows the creation of
large-scale instant messaging applications. The server can reliably support
thousands of simultaneous users on a single node and has been designed to provide
exceptional standards of fault tolerance.
This package contains headers of Ejabberd.
%prep
%setup -q -n %bname-%version
#patch0 -p1
%patch1 -p1
i="$(ls /usr/lib/erlang/lib/xmpp-*/include/*.hrl | sed -r 's|^.*/([^/]*)\.hrl$|\1|' | sort -u | tr \\n '|')"
sed -i -r '/^-include\(/s,^-include\("('"${i%|}"')(\.hrl".*)$,-include_lib\("xmpp/include/\1\2,' src/* include/*.hrl
%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config",
lists:map(fun(E) -> [io_lib:print(E), ".\n"] end,
lists:foldl(fun proplists:delete/2, L, [deps, post_hook_configure])),
[raw]),
init:stop().'
ln -s rebar.config.script %bname.rebar.config.script
./autogen.sh
%configure
ERL_COMPILER_OPTIONS="[inline,verbose]" rebar %{?_smp_mflags} -C %bname.rebar.config compile -v
#rebar %{?_smp_mflags} -C %bname.rebar.config doc -v
sed -e 's|{{installuser}}||g' \
-e 's|{{bindir}}|%_bindir|g' \
-e 's|{{libdir}}|%_libdir|g' \
-e 's|{{sysconfdir}}|%_sysconfdir|g' \
-e 's|{{localstatedir}}|%_localstatedir|g' \
-e 's|{{docdir}}|%_docdir/%name|g' \
-e 's|{{erl}}|%__erlang|g' \
-e 's|{{epmd}}|%_bindir/epmd|g' \
%{bname}ctl.template > %{bname}ctl.sh
sed -e "s|@ctlscriptpath@|%_sbindir|g" %bname.service.template > %bname.service
cat >> %bname.tmpfiles.conf <<__EOF__
d /run/lock/%{bname}ctl 0700 root root -
__EOF__
%install
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/ebin
install -p -m 0644 ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/include
install -p -m 0644 include/* %buildroot%_otplibdir/%bname-%version/include/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/priv/msgs
install -p priv/msgs/* -m 0644 %buildroot%_otplibdir/%bname-%version/priv/msgs/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/tools
for i in tools/*; do
case "$i" in
*.sh|*.pl) m="0755" ;;
*) m="0644" ;;
esac
install -p "$i" -m $m %buildroot%_otplibdir/%bname-%version/tools/
done
#rm -f %buildroot%_otplibdir/%bname-%version/ebin/win32_dns.beam
install -d -m 0755 %buildroot%_docdir/%name
%if 0
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/doc
install -p -m 0644 doc/*.{css,html,png} %buildroot%_otplibdir/%bname-%version/doc/
ln -sf %_otplibdir/%name-%version/doc %buildroot%_docdir/%name/html
%endif
install -p -m 0644 *.md %buildroot%_docdir/%name/
cp -r examples %buildroot%_docdir/%name/
install -pD -m 0755 %{bname}ctl.sh %buildroot%_sbindir/%{bname}ctl
install -d -m 0755 %buildroot%_unitdir
install -p -m 0644 %bname.service %buildroot%_unitdir/
install -d -m 0755 %buildroot%_sysconfdir/%bname
install -p -m 0644 inetrc %buildroot%_sysconfdir/%bname/
install -p -m 0644 %bname.yml.example %buildroot%_sysconfdir/%bname/%bname.yml
install -p -m 0644 %{bname}ctl.cfg.example %buildroot%_sysconfdir/%bname/%{bname}ctl.cfg
install -pD -m 0644 %bname.tmpfiles.conf %buildroot%_tmpfilesdir/%name.conf
install -d -m 0755 %buildroot%_localstatedir/lib/%bname
install -d -m 0755 %buildroot%_localstatedir/log/%bname
install -d -m 0755 %buildroot/run/lock/%{bname}ctl
%add_erlang_req_beam_skiplist win32_dns win32reg
%add_erlang_req_beam_skiplist Elixir.Kernel.ParallelCompiler
%add_erlang_req_beam_skiplist Elixir.Logger Elixir.Logger.Config Elixir.Logger.Utils
%add_erlang_req_beam_skiplist Elixir.Ejabberd.Config Elixir.Ejabberd.Config.Store Elixir.Ejabberd.ConfigUtil
%add_erlang_req_beam_skiplist epam
%add_erlang_req_beam_skiplist ejabberd_redis
%add_erlang_req_beam_skiplist ejabberd_riak ejabberd_auth_riak
%add_erlang_req_beam_skiplist ejabberd_rdbms ejabberd_sql mod_privacy_sql mod_roster_sql
%add_erlang_req_beam_skiplist ejabberd_mnesia ejabberd_auth_mnesia
%add_erlang_req_beam_skiplist riak_object riakc_obj riakc_pb_socket
%add_erlang_req_beam_skiplist p1_mysql p1_mysql_conn
%add_erlang_req_beam_skiplist pgsql
#add_erlang_req_beam_skiplist sqlite3
%if 0
%check
rebar -C %bname.rebar.config eunit -v
%endif
%pre
%service_add_pre %bname.service
%post
%tmpfiles_create %_tmpfilesdir/%name.conf
%service_add_post %bname.service
%preun
%service_del_preun %bname.service
%postun
%service_del_postun %bname.service
%files
%defattr(-,root,root)
%doc %_docdir/%name
%_otplibdir/*
%exclude %_otplibdir/%bname-*/ebin/%{bname}_rdbms.beam
%exclude %_otplibdir/%bname-*/ebin/%{bname}_sql_sup.beam
%exclude %_otplibdir/%bname-*/ebin/*_sql.beam
%exclude %_otplibdir/%bname-*/ebin/*_riak.beam
%exclude %_otplibdir/%bname-*/ebin/*_mnesia.beam
%exclude %_otplibdir/%bname-*/ebin/*_redis.beam
%exclude %_otplibdir/%bname-*/include
%_sbindir/*
%_unitdir/*
%config(noreplace) %_sysconfdir/*
%_tmpfilesdir/*
%dir %_localstatedir/lib/%bname
%dir %_localstatedir/log/%bname
%ghost %dir /run/lock
%ghost /run/lock/%{bname}ctl
%files mnesia
%defattr(-,root,root)
%_otplibdir/%bname-*/ebin/*_mnesia.beam
%files sql
%defattr(-,root,root)
%_otplibdir/%bname-*/ebin/%{bname}_rdbms.beam
%_otplibdir/%bname-*/ebin/%{bname}_sql_sup.beam
%_otplibdir/%bname-*/ebin/*_sql.beam
%files riak
%defattr(-,root,root)
%_otplibdir/%bname-*/ebin/*_riak.beam
%files redis
%defattr(-,root,root)
%_otplibdir/%bname-*/ebin/*_redis.beam
%files devel
%defattr(-,root,root)
%dir %_otplibdir/%bname-*
%_otplibdir/%bname-*/include
%changelog
* Sat Aug 31 2019 Led <ledest@gmail.com> 17.09-2
- fix %%files
- improve descriptions
* Sun Nov 26 2017 Led <ledest@gmail.com> 17.09-1
- 17.09
* Sun Nov 26 2017 Led <ledest@gmail.com> 17.11-1
- 17.11
* Sun Jul 16 2017 Led <ledest@gmail.com> 17.07-3
- mark /run/lock dir as %%ghost
* Sun Jul 16 2017 Led <ledest@gmail.com> 17.07-2
- add /run/lock dir to %%files
* Sun Jul 16 2017 Led <ledest@gmail.com> 17.07-1
- 17.07
- update BuildRequires
- update patches:
+ ejabberd-17.07-fix-include.patch
* Sat Feb 11 2017 Led <ledest@gmail.com> 17.01-1
- initial build
- add devel subpackage