]> git.pld-linux.org Git - packages/ejabberd.git/blob - ejabberd.spec
R: erlang >= 1:R15B01
[packages/ejabberd.git] / ejabberd.spec
1
2 # Conditional build:
3 %bcond_with     pam             # PAM authentication support
4 %bcond_with     logdb           # enable mod_logdb (server-side message logging)
5
6 Summary:        Fault-tolerant distributed Jabber/XMPP server
7 Summary(pl.UTF-8):      Odporny na awarie rozproszony serwer Jabbera/XMPP
8 Name:           ejabberd
9 Version:        13.10
10 Release:        0.1
11 License:        GPL
12 Group:          Applications/Communications
13 Source0:        http://www.process-one.net/downloads/ejabberd/%{version}/%{name}-%{version}.tgz
14 # Source0-md5:  94ce4fe244ee72771eeafe27209d6d3c
15 Source1:        %{name}.init
16 Source2:        %{name}.sysconfig
17 Source3:        %{name}.service
18 #
19 # Archives created with the ejabberd-pack_deps.sh script (in this repo)
20 Source10:       ejabberd-goldrush-20131108.tar.gz
21 # Source10-md5: 3f61708d20fcee2e7d47036cc470f4e9
22 Source11:       ejabberd-lager-20131111.tar.gz
23 # Source11-md5: e0933da9d0462b045f6b9c4bbd320d3e
24 Source12:       ejabberd-p1_cache_tab-20130515.tar.gz
25 # Source12-md5: f2500cffdaff434b354d01eeb24d136d
26 Source13:       ejabberd-p1_iconv-20130602.tar.gz
27 # Source13-md5: ab0118d4097ee756f65fd087265c88ae
28 Source14:       ejabberd-p1_stringprep-20131113.tar.gz
29 # Source14-md5: 282d70c792a78ea9a7415b0b4e65e157
30 Source15:       ejabberd-p1_tls-20130717.tar.gz
31 # Source15-md5: 1211c5d8f0a95b58dfc5fb5bf4e13ded
32 Source16:       ejabberd-p1_xml-20131017.tar.gz
33 # Source16-md5: dc7ebd7ed1ed6340ff0e7739173d4438
34 Source17:       ejabberd-p1_yaml-20131031.tar.gz
35 # Source17-md5: 82d4bb5c5d56ab93a60f5d1c6e583dc1
36 Source18:       ejabberd-p1_zlib-20130515.tar.gz
37 # Source18-md5: a203d9359122ead64966eeb0bd1c8cf7
38 Source19:       ejabberd-xmlrpc-20130116.tar.gz
39 # Source19-md5: 22e02ff7ca174b4ac225005f63da10ad
40 Source20:       ejabberd-jiffy-20130702.tar.gz
41 # Source20-md5: 01b156e97005f07ce8bb46ecf27471ff
42 Source21:       ejabberd-p1_mysql-20131024.tar.gz
43 # Source21-md5: c02921f21ba030357d2cbbbf182af54a
44 Source22:       ejabberd-p1_pam-20130515.tar.gz
45 # Source22-md5: 0ca31094d93dfb047f05c7539136433a
46 Source23:       ejabberd-p1_pgsql-20130515.tar.gz
47 # Source23-md5: 1958be8e59d1b472499ef1bdf8edc1db
48 Source24:       ejabberd-p1_stun-20130624.tar.gz
49 # Source24-md5: 9a1c5ad9b3b95364d3f76446fcf58dc3
50 #
51 Patch0:         %{name}-paths.patch
52 Patch1:         %{name}-config.patch
53 # not available for 13.10
54 #Patch2:                %{name}-vcard-access-get.patch
55 # http://www.dp.uz.gov.ua/o.palij/mod_logdb/patch-mod_logdb-2.1.12.diff
56 Patch3:         %{name}-mod_logdb.patch
57 URL:            http://www.ejabberd.im/
58 BuildRequires:  autoconf
59 BuildRequires:  automake
60 BuildRequires:  erlang >= 1:R15B01
61 BuildRequires:  expat-devel >= 1.95
62 BuildRequires:  openssl-devel
63 %if %{with pam}
64 BuildRequires:  pam-devel
65 %endif
66 BuildRequires:  rpmbuild(macros) >= 1.671
67 BuildRequires:  yaml-devel
68 BuildRequires:  zlib-devel
69 BuildRequires:  git-core
70 Requires(post): /usr/bin/perl
71 Requires(post): jabber-common
72 Requires(post): sed >= 4.0
73 Requires(post): textutils
74 Requires(post,preun):   /sbin/chkconfig
75 Requires(post,preun,postun):    systemd-units >= 38
76 Requires:       erlang >= 1:R15B01
77 Requires:       expat >= 1.95
78 Requires:       rc-scripts
79 Requires:       systemd-units >= 38
80 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
81
82 %define         _noautoprovfiles        %{_libdir}/%{name}/priv/lib/
83
84 %description
85 ejabberd is a Free and Open Source fault-tolerant distributed Jabber
86 server. It is written mostly in Erlang.
87
88 %description -l pl.UTF-8
89 ejabberd to darmowy, z otwartymi źródłami, odporny na awarie
90 rozproszony serwer Jabbera. Jest napisany w większości w Erlangu.
91
92 %package logdb
93 Summary:        Server-side logging module
94 Group:          Applications/Communications
95 Requires:       %{name} = %{version}-%{release}
96
97 %description logdb
98 Server-side logging module.
99
100 %prep
101 %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
102 %patch0 -p1
103 %patch1 -p1
104 #%%patch2 -p1
105 %if %{with logdb}
106 %patch3 -p0
107 %endif
108
109 # Various parts of the build system use 'git describe'
110 # which returns nonsense on manual builds using the builder script
111 # and which fails on the PLD builders
112 # I was not able to locate all 'git describe' invocation, sot let's
113 # fool them with this dummy repository
114 unset GIT_DIR GIT_WORK_TREE
115 git init
116 git config user.email "dummy@example.com"
117 git config user.name "Dummy"
118 git add configure.ac
119 git commit -a -m "dummy commit"
120 git tag "%{version}"
121
122 %build
123 unset GIT_DIR GIT_WORK_TREE
124 %{__aclocal} -I m4
125 %{__autoconf}
126 %configure \
127         %{?with_pam --enable-pam} \
128         --with-openssl=%{_prefix} \
129         --enable-user=jabber \
130         --enable-full-xml \
131         --enable-nif \
132         --enable-odbc \
133         --enable-mysql \
134         --enable-pgsql \
135         %{?with_pam:--enable-pam} \
136         --enable-zlib \
137         --enable-stun \
138         --enable-json \
139         --enable-iconv \
140         --enable-lager
141 touch deps/.got
142
143 cd deps/p1_iconv
144 %configure
145 cd ../..
146 cd deps/p1_stringprep
147 %configure
148 cd ../..
149 cd deps/p1_tls
150 %configure
151 cd ../..
152 cd deps/p1_xml
153 %configure \
154         --enable-nif \
155         --enable-full-xml
156 cd ../..
157 cd deps/p1_yaml
158 %configure
159 cd ../..
160 cd deps/p1_zlib
161 %configure
162 cd ../..
163
164 %{__make} -j1
165
166 %install
167 rm -rf $RPM_BUILD_ROOT
168 install -d $RPM_BUILD_ROOT{/var/lib/%{name},/etc/{sysconfig,rc.d/init.d}} \
169                 $RPM_BUILD_ROOT{%{systemdunitdir},%{_sbindir}}
170
171 unset GIT_DIR GIT_WORK_TREE
172
173 %{__make} install -j1 \
174         CHOWN_COMMAND=true \
175         O_USER="" \
176         G_USER="" \
177         DESTDIR=$RPM_BUILD_ROOT
178
179 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}
180 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
181 install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
182
183 chmod u+rw $RPM_BUILD_ROOT%{_sbindir}/%{name}*
184
185 chmod 755 $RPM_BUILD_ROOT%{_libdir}/ejabberd/priv/lib/*.so
186
187 rm -rf _doc 2>/dev/null || :
188 mv $RPM_BUILD_ROOT%{_docdir}/%{name} _doc
189
190 touch $RPM_BUILD_ROOT%{_sysconfdir}/jabber/ejabberd.cfg
191 touch $RPM_BUILD_ROOT/var/lib/ejabberd/.erlang.cookie
192
193 %clean
194 rm -rf $RPM_BUILD_ROOT
195
196 %pre
197 if [ -e /etc/jabber/ejabberd.cfg ] ; then
198         if grep -Eq '^[^#]*access_get' /etc/jabber/ejabberd.cfg ; then
199                 echo "Your 'ejabberd.cfg' config file seems to use 'access_get' option of mod_vcard" >&2
200                 echo "this is not supported by this ejabberd version in PLD" >&2
201                 exit 1
202         fi
203         %banner -e %{name} <<'EOF'
204 Old-style /etc/jabber/ejabberd.cfg configuration file exists. You should
205 consider converting it to the new YAML format. You can do this with the
206 ejabberctl command.
207 EOF
208 fi
209
210 %post
211 if [ -f %{_sysconfdir}/jabber/secret ] ; then
212         SECRET="$(cat %{_sysconfdir}/jabber/secret)"
213         if [ -n "$SECRET" ] ; then
214                 echo -n "Updating component authentication secret in ejabberd config file..." >&2
215                 %{__sed} -i -e "s/@service_secret@/$SECRET/" /etc/jabber/ejabberd.yml
216                 echo "done" >&2
217         fi
218 fi
219
220 /sbin/chkconfig --add ejabberd
221 %service ejabberd restart "ejabberd server"
222
223 %systemd_post %{name}.service
224
225 %preun
226 if [ "$1" = "0" ]; then
227         %service ejabberd stop
228         /sbin/chkconfig --del ejabberd
229 fi
230 %systemd_preun %{name}.service
231
232 %postun
233 %systemd_reload
234
235 %triggerprein -- %{name} < 13.10
236 # only if started and we know upgrade won't be aborted in %%pre
237 if [ -e /var/lock/subsys/ejabberd ] && ! grep -Eq '^[^#]*access_get' /etc/jabber/ejabberd.cfg 2>/dev/null ; then
238         # old init script won't stop ejabberd correctly
239         # stop it's all processes here
240         # we assume any 'epmd', 'beam', 'beam.smp' or 'heart' process
241         # running with uid of jabber is ejabberd process
242         pids="$(ps -C "epmd beam beam.smp heart" -o pid=,user= | awk '/jabber/ { print $1 }')" || :
243         if [ -n "$pids" ] ; then
244                 %banner -e %{name} <<'EOF'
245 Killing all 'epmd, beam, beam.smp, heart' processed owned by the 'jabber' user to make sure old ejabberd is down.
246 EOF
247                 kill $pids || :
248         fi
249 fi
250
251 %triggerpostun -- %{name} < 13.10
252 # convert old 'NODENAME' in /etc/sysconfig/ejabberd
253 # to 'ERLANG_NODE' in /etc/jabber/ejabberdctl.cfg
254 # and move other settings
255 NODENAME="$(hostname)"
256 if [ -e /etc/sysconfig/ejabberd ] ; then
257         . /etc/sysconfig/ejabberd || :
258 fi
259 subst="s/^#ERLANG_NODE=.*/ERLANG_NODE=ejabberd@${NODENAME}/"
260 if [ -n "$ERL_MAX_PORTS" ] ; then
261         subst="$subst;s/^#ERL_MAX_PORTS=.*/ERL_MAX_PORTS=${ERL_MAX_PORTS}/"
262 fi
263 sed -i -e"$subst" /etc/jabber/ejabberdctl.cfg || :
264 if [ -e /etc/sysconfig/ejabberd ] ; then
265         sed -i.rpmsave \
266                 -e'/^[#[:space:]]*NODENAME=/d;/^# Node name/d' \
267                 -e'/^[#[:space:]]*ERL_MAX_PORTS=/d;/^# uncomment this to allow more then 1024 connections/d' \
268                 -e'/^[#[:space:]]*ERL_FULLSWEEP_AFTER=/d;/^# uncomment this to limit memory usage/d' \
269                 /etc/sysconfig/ejabberd || :
270 fi
271 cp %{_sysconfdir}/jabber/cookie /var/lib/ejabberd/.erlang.cookie || :
272 %systemd_trigger %{name}.service
273
274 %files
275 %defattr(644,root,root,755)
276 %doc sql _doc/*
277 %attr(755,root,root) %{_sbindir}/*
278 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd-inetrc
279 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.yml
280 %attr(640,root,jabber) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberdctl.cfg
281 # legacy config may still be there
282 %attr(640,root,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jabber/ejabberd.cfg
283 %attr(770,root,jabber) /var/log/ejabberd
284 %if %{with logdb}
285 %exclude %{_libdir}/ejabberd/ebin/mod_logdb*
286 %endif
287 %{_libdir}/ejabberd
288 %dir %attr(770,root,jabber) /var/lib/ejabberd
289 %ghost %attr(400,jabber,jabber) %ghost %config(noreplace) %verify(not md5 mtime size) /var/lib/ejabberd/.erlang.cookie
290 %attr(754,root,root) /etc/rc.d/init.d/%{name}
291 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
292 %{systemdunitdir}/%{name}.service
293
294 %if %{with logdb}
295 %files logdb
296 %defattr(644,root,root,755)
297 %{_libdir}/ejabberd/ebin/mod_logdb*
298 %endif
This page took 0.070914 seconds and 3 git commands to generate.