Fri, 02 Dec 2011 19:26:06 +0100
Remove unused SHA1 checksums, renumber sources, and correct fax unpacking.
1 ##
2 ## kamailio.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2011 Michael Schloh von Bennewitz <michael@schloh.com>
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 information
25 Name: kamailio
26 Summary: Open Source SIP Server
27 URL: http://www.kamailio.org/
28 Vendor: IPTelorg GmbH, Fraunhofer FOKUS, SIP Router Project
29 Packager: Michael Schloh von Bennewitz
30 Distribution: Europalab Networks Production
31 Class: PLUS
32 Group: VoIP
33 License: GPL
34 Version: 3.1.5
35 Release: 20111001
37 # package options
38 %option with_cons yes
39 %option with_fsl yes
40 %option with_ssl yes
41 %option with_sctp no
42 %option with_croute no
43 %option with_ldap no
44 %option with_memcached no
45 %option with_radius no
46 %option with_snmp no
47 %option with_bdb no
48 %option with_mysql no
49 %option with_osp no
50 %option with_pgsql no
51 %option with_odbc no
52 %option with_geoip no
53 %option with_lua no
54 %option with_python no
56 # list of sources
57 Source0: http://www.kamailio.org/pub/kamailio/%{version}/src/kamailio-%{version}_src.tar.gz
58 Source2: rc.kamailio
59 Source3: fsl.kamailio
61 # build information
62 Prefix: %{l_prefix}
63 BuildRoot: %{l_buildroot}
64 BuildPreReq: OpenPKG, openpkg >= 20060823
65 PreReq: OpenPKG, openpkg >= 20060823
66 BuildPreReq: libxml, expat, curl, readline
67 PreReq: libxml, expat, curl, readline
68 BuildPreReq: make, gcc, flex, bison, sed, pkgconfig
69 PreReq: bash
70 %if "%{with_cons}" == "yes"
71 PreReq: perl-dbi, perl-term
72 %endif
73 %if "%{with_fsl}" == "yes"
74 BuildPreReq: fsl
75 PreReq: fsl
76 %endif
77 %if "%{with_ssl}" == "yes"
78 BuildPreReq: openssl
79 PreReq: openssl
80 %endif
81 %if "%{with_croute}" == "yes"
82 BuildPreReq: confuse
83 PreReq: confuse
84 %endif
85 %if "%{with_ldap}" == "yes"
86 BuildPreReq: openldap
87 PreReq: openldap
88 %endif
89 %if "%{with_memcached}" == "yes"
90 BuildPreReq: memcached
91 PreReq: memcached
92 %endif
93 %if "%{with_osp}" == "yes"
94 BuildPreReq: osptoolkit
95 PreReq: osptoolkit
96 %endif
97 %if "%{with_radius}" == "yes"
98 BuildPreReq: radiusclient
99 PreReq: radiusclient
100 %endif
101 %if "%{with_snmp}" == "yes"
102 BuildPreReq: snmp
103 PreReq: snmp
104 %endif
105 %if "%{with_bdb}" == "yes"
106 BuildPreReq: db
107 PreReq: db
108 %endif
109 %if "%{with_mysql}" == "yes"
110 BuildPreReq: mysql
111 PreReq: mysql
112 %endif
113 %if "%{with_pgsql}" == "yes"
114 BuildPreReq: postgresql
115 PreReq: postgresql
116 %endif
117 %if "%{with_odbc}" == "yes"
118 BuildPreReq: unixodbc
119 PreReq: unixodbc
120 %endif
121 %if "%{with_geoip}" == "yes"
122 BuildPreReq: geoip
123 PreReq: geoip
124 %endif
125 %if "%{with_lua}" == "yes"
126 BuildPreReq: lua
127 PreReq: lua
128 %endif
129 %if "%{with_python}" == "yes"
130 BuildPreReq: python
131 PreReq: python
132 %endif
133 AutoReq: no
134 AutoReqProv: no
136 %description
137 Kamailio is (beside Opensips) a successor to OpenSER, which in
138 turn was spawned from FhG FOKUS's SIP Express Router (SER). It
139 provides SIP (RFC3621) registrar, proxy and routing functionality.
140 A C shell like scripting language provides for control over the
141 server's behaviour. It's modular architecture allows for fine
142 grained loading of required functionality.
144 Kamailio can be used as a: Kamailio fits in scenarios:
146 Registrar server SIP trunking
147 Router, proxy SIP load balancing
148 Redirect server SIP front end termination
149 Presence agent Residential providers
150 Back to back user agent white label solutions
151 Instant messaging server Enterprise services
152 SIP to SMS gateway LCR for multi gateways
153 SIP to XMPP gateway
154 Load balancer or dispatcher
155 Front end for asterisk
156 NAT traversal unit
157 Application server
159 %track
160 prog kamailio = {
161 version = %{version}
162 url = http://www.kamailio.org/pub/kamailio/
163 regex = (\d+\.\d+\.\d+)/
164 url = http://www.kamailio.org/pub/kamailio/__NEWVER__/src/
165 regex = kamailio-(__VER__)_src\.tar\.gz
166 }
168 %prep
169 %setup -q
170 %{l_shtool} subst \
171 -e 's;\$(LOCALBASE)/[^/][^/]*/sctp.h;;g' \
172 -e 's;\$(LOCALBASE)/ssl/include;`%{l_prefix}/bin/pkg-config --cflags-only-I openssl`;g' \
173 -e 's;\$(LOCALBASE)/ssl/lib;`%{l_prefix}/bin/pkg-config --libs openssl`;g' \
174 -e 's;LOCALBASE *[\?:]*=.*;LOCALBASE = %{l_prefix};g' \
175 -e 's;\(data_dir\) *=.*;\1 = share/$(MAIN_NAME);g' \
176 -e 's;\(doc_dir\) *=.*;\1 = share/$(MAIN_NAME)/doc;g' \
177 -e 's;\(man_dir\) *=.*;\1 = man/;g' \
178 Makefile.defs
179 %{l_shtool} subst \
180 -e 's;CFLAGS *= *$;CFLAGS = %{l_cflags -O};g' \
181 -e 's;LDFLAGS *= *$;LDFLAGS = %{l_ldflags};g' \
182 -e 's;C_INCLUDES *= *$;C_INCLUDES = %{l_cppflags};g' \
183 Makefile.defs
184 %{l_shtool} subst \
185 -e 's;/usr/include/readline/readline.h;;g' \
186 utils/sercmd/Makefile
187 %{l_shtool} subst \
188 -e 's;-I$(LOCALBASE)/Berkeley[^ ]* *;;g' \
189 -e 's;-I$(LOCALBASE)/include[^ ]* *;;g' \
190 -e 's;-I$(SYSBASE)/include[^ ]* *;;g' \
191 -e 's;LIBS=.*;LIBS=`%{l_prefix}/bin/pkg-config --libs db`;g' \
192 utils/db_berkeley/Makefile
193 %{l_shtool} subst \
194 -e 's;\(\$(data_prefix)/\$(data_dir)/.*\)/kamailio;\1;g' \
195 utils/kamctl/Makefile
196 %{l_shtool} subst \
197 -e 's;\(radiusclient\)-ng;\1;g' \
198 -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
199 Makefile.radius \
200 lib/kcore/radius.h \
201 modules_s/avp_radius/avp_radius.c \
202 modules_s/uri_radius/checks.c \
203 modules_s/uri_radius/urirad_mod.c \
204 modules_s/acc_radius/acc_radius.c \
205 modules_s/auth_radius/authrad_mod.c \
206 modules_s/auth_radius/sterman.h
207 %{l_shtool} subst \
208 -e 's;\(DEFS *[\?:+]*=[^\\]*\);\1 -D__EXTENSIONS__;g' \
209 modules/db_mysql/Makefile \
210 modules/xmlrpc/Makefile
211 %{l_shtool} subst \
212 -e 's;\(-keyout.*\);\1 || true;' \
213 modules/tls/sip-router_cert.sh
215 %build
216 # select modules
217 modslist='acc alias_db auth auth_identity avp avpops avp_db benchmark blst call_control cfgutils cfg_db cfg_rpc counters cpl-c ctl db_text db_flatstore db_ops debugger dialog dialplan dispatcher diversion domain domainpolicy drouting eval exec enum fifo gflags group htable identity imc kex lcr malloc_test mangler matrix maxfwd mi_datagram mi_fifo mi_rpc mediaproxy mqueue msilo mtree nathelper nat_traversal options path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route presence presence_conference presence_dialoginfo presence_mwi presence_xml privacy pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity seas siptrace siputils sl sms speeddial sqlops sst statistics textops textopsx timer tm tmx topoh uac uac_redirect uri uri_db userblacklist usrloc utils xcap xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp'
218 %if "%{with_ssl}" == "yes"
219 modslist="$modslist tls"
220 %endif
221 %if "%{with_croute}" == "yes"
222 modslist="$modslist carrierroute"
223 %endif
224 %if "%{with_ldap}" == "yes"
225 modslist="$modslist ldap h350"
226 %endif
227 %if "%{with_memcached}" == "yes"
228 modslist="$modslist memcached"
229 %endif
230 %if "%{with_osp}" == "yes"
231 modslist="$modslist osp"
232 %endif
233 %if "%{with_radius}" == "yes"
234 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
235 %endif
236 %if "%{with_snmp}" == "yes"
237 modslist="$modslist snmpstats"
238 %endif
239 %if "%{with_bdb}" == "yes"
240 modslist="$modslist db_berkeley"
241 %endif
242 %if "%{with_mysql}" == "yes"
243 modslist="$modslist db_mysql"
244 %endif
245 %if "%{with_pgsql}" == "yes"
246 modslist="$modslist db_postgres"
247 %endif
248 %if "%{with_odbc}" == "yes"
249 modslist="$modslist db_unixodbc"
250 %endif
251 %if "%{with_lua}" == "yes"
252 modslist="$modslist app_lua"
253 %endif
254 %if "%{with_python}" == "yes"
255 modslist="$modslist app_python"
256 %endif
257 %if "%{with_geoip}" == "yes"
258 modslist="$modslist geoip"
259 %endif
261 # build configuration
262 %{l_make} %{l_mflags} \
263 CC="%{l_cc}" \
264 FLAVOUR=kamailio \
265 %if "%{with_sctp}" == "yes"
266 SCTP=1 \
267 %endif
268 %if "%{with_ssl}" == "yes"
269 TLS_HOOKS=1 \
270 %endif
271 prefix=%{l_prefix} \
272 cfg
274 # build program
275 %{l_make} %{l_mflags -O} \
276 CC="%{l_cc}" \
277 %if "%{with_sctp}" == "yes"
278 SCTP=1 \
279 %endif
280 %if "%{with_ssl}" == "yes"
281 TLS_HOOKS=1 \
282 %endif
283 prefix=%{l_prefix} \
284 kamailio
286 # build utilities
287 %{l_make} %{l_mflags -O} \
288 CC="%{l_cc}" \
289 %if "%{with_sctp}" == "yes"
290 SCTP=1 \
291 %endif
292 %if "%{with_ssl}" == "yes"
293 TLS_HOOKS=1 \
294 %endif
295 prefix=%{l_prefix} \
296 modules="$modslist" \
297 utils utils/kamctl
299 # build modules
300 %{l_make} %{l_mflags -O} \
301 CC="%{l_cc}" \
302 LD_RPATH=-Wl,-rpath, \
303 SER_RPATH_LST=%{l_prefix}/lib/kamailio \
304 %if "%{with_sctp}" == "yes"
305 SCTP=1 \
306 %endif
307 %if "%{with_ssl}" == "yes"
308 TLS_HOOKS=1 \
309 %endif
310 include_modules="$modslist" \
311 skip_modules="" \
312 prefix=%{l_prefix} \
313 every-module
315 %install
316 rm -rf $RPM_BUILD_ROOT
318 # select modules
319 modslist='acc alias_db auth auth_identity avp avpops avp_db benchmark blst call_control cfgutils cfg_db cfg_rpc counters cpl-c ctl db_text db_flatstore db_ops debugger dialog dialplan dispatcher diversion domain domainpolicy drouting eval exec enum fifo gflags group htable identity imc kex lcr malloc_test mangler matrix maxfwd mi_datagram mi_fifo mi_rpc mediaproxy mqueue msilo mtree nathelper nat_traversal options path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route presence presence_conference presence_dialoginfo presence_mwi presence_xml privacy pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity seas siptrace siputils sl sms speeddial sqlops sst statistics textops textopsx timer tm tmx topoh uac uac_redirect uri uri_db userblacklist usrloc utils xcap xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp'
320 %if "%{with_ssl}" == "yes"
321 modslist="$modslist tls"
322 %endif
323 %if "%{with_croute}" == "yes"
324 modslist="$modslist carrierroute"
325 %endif
326 %if "%{with_ldap}" == "yes"
327 modslist="$modslist ldap h350"
328 %endif
329 %if "%{with_memcached}" == "yes"
330 modslist="$modslist memcached"
331 %endif
332 %if "%{with_osp}" == "yes"
333 modslist="$modslist osp"
334 %endif
335 %if "%{with_radius}" == "yes"
336 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
337 %endif
338 %if "%{with_snmp}" == "yes"
339 modslist="$modslist snmpstats"
340 %endif
341 %if "%{with_bdb}" == "yes"
342 modslist="$modslist db_berkeley"
343 %endif
344 %if "%{with_mysql}" == "yes"
345 modslist="$modslist db_mysql"
346 %endif
347 %if "%{with_pgsql}" == "yes"
348 modslist="$modslist db_postgres"
349 %endif
350 %if "%{with_odbc}" == "yes"
351 modslist="$modslist db_unixodbc"
352 %endif
353 %if "%{with_lua}" == "yes"
354 modslist="$modslist app_lua"
355 %endif
356 %if "%{with_python}" == "yes"
357 modslist="$modslist app_python"
358 %endif
359 %if "%{with_geoip}" == "yes"
360 modslist="$modslist geoip"
361 %endif
363 # install program, utils, and modules
364 %{l_make} %{l_mflags} \
365 INSTALL="%{l_shtool} install -c" \
366 INSTALL_CFG="%{l_shtool} install -c" \
367 INSTALL_BIN="%{l_shtool} install -c" \
368 INSTALL_SCRIPT="%{l_shtool} install -c" \
369 INSTALL_MODULES="%{l_shtool} install -c" \
370 INSTALL_LIB="%{l_shtool} install -c" \
371 INSTALL_DOC="%{l_shtool} install -c" \
372 INSTALL_MAN="%{l_shtool} install -c" \
373 INSTALL_SHARE="%{l_shtool} install -c" \
374 basedir=$RPM_BUILD_ROOT \
375 prefix=%{l_prefix} \
376 doc-dir=share/kamailio/doc \
377 man-dir=man \
378 data-dir=share/kamailio \
379 include_modules="$modslist" \
380 skip_modules="" \
381 install
383 # strip down installation
384 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
386 # create installation hierarchy
387 %{l_shtool} mkdir -f -p -m 700 \
388 $RPM_BUILD_ROOT%{l_prefix}/var/kamailio
390 # install OSSP fsl configuration
391 %{l_shtool} mkdir -f -p -m 755 \
392 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
393 %{l_shtool} install -c -m 644 %{l_value -s -a} \
394 %{SOURCE fsl.kamailio} \
395 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
397 # install runcommand script
398 %{l_shtool} mkdir -f -p -m 755 \
399 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
400 %{l_shtool} install -c -m 755 %{l_value -s -a} \
401 %{SOURCE rc.kamailio} \
402 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
404 # determine installation files
405 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
406 %{l_files_std} \
407 '%not %dir %{l_prefix}/etc/fsl' \
408 '%config %{l_prefix}/etc/fsl/*' \
409 '%config %{l_prefix}/etc/kamailio/*' \
410 '%doc %{l_prefix}/share/kamailio/doc/*' \
411 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/kamailio'
413 %files -f files
415 %clean
416 rm -rf $RPM_BUILD_ROOT
418 %post
419 # on install, setup database (kamctl db create /pfx/var/kamailio/db)
420 if [ ! -d $RPM_INSTALL_PREFIX/var/kamailio/db ]; then
421 %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
422 $RPM_INSTALL_PREFIX/var/kamailio/db
423 rm -f $RPM_INSTALL_PREFIX/share/kamailio/dbtext/*.orig
424 %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
425 $RPM_INSTALL_PREFIX/share/kamailio/dbtext/* \
426 $RPM_INSTALL_PREFIX/var/kamailio/db/
427 fi
429 # after upgrade, restart service
430 [ $1 -eq 2 ] || exit 0
431 eval `%{l_rc} kamailio status 2>/dev/null`
432 [ ".$kamailio_active" = .yes ] && %{l_rc} kamailio restart
433 exit 0
435 %preun
436 # before erase, stop service and remove log files
437 [ $1 -eq 0 ] || exit 0
438 %{l_rc} kamailio stop 2>/dev/null
439 rm -rf $RPM_INSTALL_PREFIX/var/kamailio/db 2>/dev/null || true
440 rm -f $RPM_INSTALL_PREFIX/var/kamailio/* 2>/dev/null || true
441 exit 0