Fri, 14 Sep 2012 20:39:02 +0200
Update sample version text as a new OpenSUSE distribution has released.
1 ##
2 ## jabberd.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2011 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 17
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: 20120800
42 # package options
43 %option with_sqlite no
44 %option with_mysql no
45 %option with_pgsql no
46 %option with_pam no
47 %option with_mucon yes
49 # list of sources
50 Source0: http://www.github.com/downloads/Jabberd2/jabberd2/jabberd-%{version}.tar.xz
51 Source1: http://download.gna.org/mu-conference/mu-conference_%{V_mucon}.tar.gz
52 Source1: rc.jabberd
53 Patch0: jabberd.patch
55 # build information
56 BuildPreReq: OpenPKG, openpkg >= 20100101, make
57 PreReq: OpenPKG, openpkg >= 20100101, perl
58 BuildPreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns
59 PreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns
60 %if "%{with_sqlite}" == "yes"
61 BuildPreReq: sqlite
62 PreReq: sqlite
63 %endif
64 %if "%{with_mysql}" == "yes"
65 BuildPreReq: mysql
66 PreReq: mysql
67 %endif
68 %if "%{with_pgsql}" == "yes"
69 BuildPreReq: postgresql
70 PreReq: postgresql
71 %endif
72 %if "%{with_pam}" == "yes"
73 BuildPreReq: PAM
74 PreReq: PAM
75 %endif
76 %if "%{with_mucon}" == "yes"
77 BuildPreReq: glib, pkgconfig
78 PreReq: glib
79 %endif
81 %description
82 JabberD is the original server implementation for the Jabber instant
83 messaging platform. JabberD 2 is the next generation of the JabberD
84 server. It has been rewritten from the ground up to be scalable,
85 architecturally sound, and to support the latest protocol extensions
86 coming out of the JSF.
88 %track
89 prog jabberd = {
90 version = %{version}
91 url = http://www.github.com/downloads/Jabberd2/jabberd2/
92 regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.xz
93 }
94 prog jabberd:mucon = {
95 version = %{V_mucon}
96 url = http://download.gna.org/mu-conference/
97 regex = mu-conference_(__VER__)\.tar\.gz
98 }
100 %prep
101 %setup -q -n jabberd-%{version}
102 %setup -q -D -T -a 1
103 %{l_shtool} subst \
104 -e 's;exec perl;exec %{l_prefix}/bin/perl;' \
105 tools/jabberd.in
106 %{l_shtool} subst \
107 -e 's;\$(initdir);;g' \
108 etc/Makefile.in
109 %if "%{with_mucon}" == "yes"
110 %{l_shtool} subst \
111 -e 's;^\(CFLAGS\ *:=.*pkg-config --cflags glib-2.0\);\1 libidn;' \
112 -e 's;^\(LIBS\ *:=.*\);\1 $(LOCLIBS);' \
113 mu-conference_%{V_mucon}/src/Makefile
114 %{l_shtool} subst \
115 -e 's;mu-conference.log;muc.log;g' \
116 mu-conference_%{V_mucon}/src/jcomp/jcr_log.c
117 %{l_shtool} subst \
118 -e 's;<port>[0-9][0-9]*</port>;<port>5347</port>;' \
119 -e 's;<spool>.*</spool>;<spool>%{l_prefix}/var/jabberd/spool/rooms</spool>;' \
120 -e 's;<logdir>\./syslogs</logdir>;<logdir>%{l_prefix}/var/jabberd/log</logdir>;' \
121 -e 's;<logdir>\./logs/</logdir>;<logdir>%{l_prefix}/var/jabberd/spool/logs</logdir>;' \
122 -e 's;<pidfile>.*</pidfile>;<pidfile>%{l_prefix}/var/jabberd/pid/muc.pid</pidfile>;' \
123 -e 's;<URL>.*</URL>;<URL>http://name.host.tld/</URL>;' \
124 -e 's;<stylesheet>.*</stylesheet>;<stylesheet>%{l_prefix}/share/jabberd/style.css</stylesheet>;' \
125 mu-conference_%{V_mucon}/muc-default.xml
126 echo \
127 'muc @sysconfdir@/muc.xml' \
128 >>etc/jabberd.cfg.dist.in
129 %endif
131 %build
132 # configure program
133 ( echo "ac_cv_func_kqueue=no"
134 ) >config.cache
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 --cache-file=./config.cache \
155 --prefix=%{l_prefix} \
156 --sysconfdir=%{l_prefix}/etc/jabberd \
157 --mandir=%{l_prefix}/man \
158 --enable-db \
159 --enable-fs \
160 --enable-pipe \
161 --enable-ssl \
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 %{l_shtool} mkdir -f -p -m 755 \
205 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
206 $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \
207 $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \
208 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \
209 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \
210 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \
211 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log
213 # install components
214 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
216 # install optional components
217 %if "%{with_mucon}" == "yes"
218 %{l_shtool} mkdir -f -p -m 755 \
219 $RPM_BUILD_ROOT%{l_prefix}/share/jabberd \
220 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/logs \
221 $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/rooms
222 %{l_shtool} install -c -m 644 \
223 mu-conference_%{V_mucon}/muc-default.xml \
224 $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/muc.xml
225 %{l_shtool} install -c \
226 mu-conference_%{V_mucon}/src/mu-conference \
227 $RPM_BUILD_ROOT%{l_prefix}/bin/
228 %{l_shtool} install -c \
229 mu-conference_%{V_mucon}/style.css \
230 $RPM_BUILD_ROOT%{l_prefix}/share/jabberd
231 %endif
233 # strip installation
234 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
236 # remove unnecessary files
237 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist
238 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist
239 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a
241 # install runcommand script
242 %{l_shtool} install -c -m 755 %{l_value -s -a} \
243 %if "%{with_mucon}" == "yes"
244 -e 's;\(jabberd_daemons\s*=.*\)\s\s*\(\w\w*\);\1 mucon\2;' \
245 %endif
246 %{SOURCE rc.jabberd} \
247 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
249 # determine installation files
250 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
251 %{l_files_std} \
252 '%config %{l_prefix}/etc/jabberd/*' \
253 '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \
254 '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*'
256 %files -f files
258 %clean
260 %post
261 # after upgrade, restart service
262 [ $1 -eq 2 ] || exit 0
263 eval `%{l_rc} jabberd status 2>/dev/null`
264 [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart
265 exit 0
267 %preun
268 # before erase, stop service and remove log files
269 [ $1 -eq 0 ] || exit 0
270 %{l_rc} jabberd stop 2>/dev/null
271 rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true
272 exit 0