Sat, 31 Oct 2009 19:03:03 +0100
Use sqlite and new muc by default, enable debug, don't erase SQL files.
1 ##
2 ## jabberd.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package version
25 %define V_major 2.2
26 %define V_minor 9
27 %define V_mucon 0.8
29 # package information
30 Name: jabberd
31 Summary: Jabber Instant Messaging Daemon
32 URL: http://jabberd2.xiaoka.com/
33 Vendor: Jabber Software Foundation
34 Packager: OpenPKG Foundation e.V.
35 Distribution: OpenPKG Community
36 Class: PLUS
37 Group: InstantMessaging
38 License: JOSL/GPL
39 Version: %{V_major}.%{V_minor}
40 Release: 20091028
42 # package options
43 %option with_mucon yes
44 %option with_sqlite yes
45 %option with_mysql no
46 %option with_pgsql no
47 %option with_pam no
49 # list of sources
50 Source0: http://codex.xiaoka.com/pub/jabberd2/releases/jabberd-%{version}.tar.gz
51 Source1: http://download.gna.org/mu-conference/mu-conference_%{V_mucon}.tar.gz
52 Source2: rc.jabberd
53 Patch0: jabberd.patch
55 # build information
56 Prefix: %{l_prefix}
57 BuildRoot: %{l_buildroot}
58 BuildPreReq: OpenPKG, openpkg >= 20060823, make
59 PreReq: OpenPKG, openpkg >= 20060823, perl
60 BuildPreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns
61 PreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns
62 %if "%{with_mucon}" == "yes"
63 BuildPreReq: glib2
64 PreReq: glib2
65 %endif
66 %if "%{with_sqlite}" == "yes"
67 BuildPreReq: sqlite
68 PreReq: sqlite
69 %endif
70 %if "%{with_mysql}" == "yes"
71 BuildPreReq: mysql
72 PreReq: mysql
73 %endif
74 %if "%{with_pgsql}" == "yes"
75 BuildPreReq: postgresql
76 PreReq: postgresql
77 %endif
78 %if "%{with_pam}" == "yes"
79 BuildPreReq: PAM
80 PreReq: PAM
81 %endif
82 AutoReq: no
83 AutoReqProv: no
85 %description
86 JabberD is the original server implementation for the Jabber instant
87 messaging platform. JabberD 2 is the next generation of the JabberD
88 server. It has been rewritten from the ground up to be scalable,
89 architecturally sound, and to support the latest protocol extensions
90 coming out of the JSF.
92 %track
93 prog jabberd = {
94 version = %{version}
95 url = http://codex.xiaoka.com/pub/jabberd2/releases/
96 regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.gz
97 }
98 prog jabberd:mucon = {
99 version = %{V_mucon}
100 url = http://download.gna.org/mu-conference/
101 regex = mu-conference_(__VER__)\.tar\.gz
102 }
104 %prep
105 %setup -q -n jabberd-%{version}
106 %setup -q -D -T -a 1
107 %{l_sed} <%{PATCH0} -e 's;@l_prefix@;%{l_prefix};g' | %{l_patch} -p0 -b
108 %{l_shtool} subst \
109 -e 's;exec perl;exec %{l_prefix}/bin/perl;' \
110 tools/jabberd.in
111 %if "%{with_mucon}" == "yes"
112 %{l_shtool} subst \
113 -e 's;^\(CFLAGS\ *:=.*pkg-config --cflags glib-2.0\);\1 libidn;' \
114 -e 's;^\(LIBS\ *:=.*\);\1 $(LOCLIBS);' \
115 mu-conference_%{V_mucon}/src/Makefile
116 %{l_shtool} subst \
117 -e 's;mu-conference.log;muc.log;g' \
118 mu-conference_%{V_mucon}/src/jcomp/jcr_log.c
119 %{l_shtool} subst \
120 -e 's;<port>[0-9][0-9]*</port>;<port>5347</port>;' \
121 -e 's;<spool>.*</spool>;<spool>%{l_prefix}/var/jabberd/spool/rooms</spool>;' \
122 -e 's;<logdir>\./syslogs</logdir>;<logdir>%{l_prefix}/var/jabberd/log</logdir>;' \
123 -e 's;<logdir>\./logs/</logdir>;<logdir>%{l_prefix}/var/jabberd/spool/logs</logdir>;' \
124 -e 's;<pidfile>.*</pidfile>;<pidfile>%{l_prefix}/var/jabberd/pid/muc.pid</pidfile>;' \
125 -e 's;<URL>.*</URL>;<URL>http://name.host.tld/</URL>;' \
126 -e 's;<stylesheet>.*</stylesheet>;<stylesheet>%{l_prefix}/share/jabberd/style.css</stylesheet>;' \
127 mu-conference_%{V_mucon}/muc-default.xml
128 echo \
129 'muc @sysconfdir@/muc.xml' \
130 >>etc/jabberd.cfg.dist.in
131 %endif
133 %build
134 # configure program
135 export CC="%{l_cc}"
136 export CFLAGS="%{l_cflags -O}"
137 export CPPFLAGS="%{l_cppflags libidn}"
138 export LDFLAGS="%{l_ldflags}"
139 export LIBS=""
140 case "%{l_platform -t}" in
141 *-linux* ) LIBS="$LIBS -ldl" ;;
142 *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
143 esac
144 export JHOME=%{l_prefix}/var/jabberd
145 %if "%{with_mysql}" == "yes"
146 CPPFLAGS="$CPPFLAGS %{l_cppflags mysql}"
147 LDFLAGS="$LDFLAGS %{l_ldflags mysql}"
148 LIBS="$LIBS -lz -lm"
149 %endif
150 %if "%{with_pgsql}" == "yes"
151 CPPFLAGS="$CPPFLAGS %{l_cppflags postgresql}"
152 %endif
153 ./configure \
154 --prefix=%{l_prefix} \
155 --sysconfdir=%{l_prefix}/etc/jabberd \
156 --mandir=%{l_prefix}/man \
157 --enable-db \
158 --enable-fs \
159 --enable-pipe \
160 --enable-ssl \
161 --enable-debug \
162 --with-sasl=gsasl \
163 %if "%{with_sqlite}" == "yes"
164 --enable-sqlite \
165 %else
166 --disable-sqlite \
167 %endif
168 %if "%{with_mysql}" == "yes"
169 --enable-mysql \
170 %else
171 --disable-mysql \
172 %endif
173 %if "%{with_pgsql}" == "yes"
174 --enable-pgsql \
175 %else
176 --disable-pgsql \
177 %endif
178 %if "%{with_pam}" == "yes"
179 --enable-pam \
180 %else
181 --disable-pam \
182 %endif
183 --disable-oracle \
184 --enable-static \
185 --enable-shared
187 # build program
188 %{l_make} %{l_mflags -O}
190 %if "%{with_mucon}" == "yes"
191 loclibs=''
192 case "%{l_platform -t}" in
193 *-sunos* )
194 loclibs='-lsocket -lnsl'
195 ;;
196 esac
197 ( cd mu-conference_%{V_mucon}
198 %{l_make} %{l_mflags -O} LOCLIBS=$loclibs
199 ) || exit $?
200 %endif
202 %install
203 # create installation filesystem structure
204 rm -rf $RPM_BUILD_ROOT
205 %{l_shtool} mkdir -f -p -m 755 \
206 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
207 $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \
208 $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \
209 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \
210 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \
211 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \
212 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log
214 # install required components
215 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
217 # install optional components
218 %if "%{with_mucon}" == "yes"
219 %{l_shtool} mkdir -f -p -m 755 \
220 $RPM_BUILD_ROOT%{l_prefix}/share/jabberd \
221 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/logs \
222 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/rooms
223 %{l_shtool} install -c -m 644 \
224 mu-conference_%{V_mucon}/muc-default.xml \
225 $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/muc.xml
226 %{l_shtool} install -c \
227 mu-conference_%{V_mucon}/src/mu-conference \
228 $RPM_BUILD_ROOT%{l_prefix}/bin/
229 %{l_shtool} install -c \
230 mu-conference_%{V_mucon}/style.css \
231 $RPM_BUILD_ROOT%{l_prefix}/share/jabberd
232 %endif
234 # strip installation
235 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
237 # remove unnecessary files
238 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist
239 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist
240 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a
242 # install run-command script
243 %{l_shtool} install -c -m 755 %{l_value -s -a} \
244 %if "%{with_mucon}" == "yes"
245 -e 's;\(jabberd_daemons\s*=.*\)\s\s*\(\w\w*\);\1 mucon\2;' \
246 %endif
247 %{SOURCE rc.jabberd} \
248 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
250 # determine installation files
251 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
252 %{l_files_std} \
253 '%config %{l_prefix}/etc/jabberd/*' \
254 '%config %{l_prefix}/var/jabberd/db/*' \
255 '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \
256 '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*'
258 %files -f files
260 %clean
261 rm -rf $RPM_BUILD_ROOT
263 %post
264 # after upgrade, restart service
265 [ $1 -eq 2 ] || exit 0
266 eval `%{l_rc} jabberd status 2>/dev/null`
267 [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart
268 exit 0
270 %preun
271 # before erase, stop service and remove log files
272 [ $1 -eq 0 ] || exit 0
273 %{l_rc} jabberd stop 2>/dev/null
274 rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true
275 exit 0