Thu, 02 Aug 2012 22:11:13 +0200
Provide 80Ko of shell script instead of standard 64Ko allocation.
This is needed to accommodate recent script addtions involving smf(5).
1 ##
2 ## kamailio.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2012 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.2.2
35 Release: 20120208
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_sqlite no
52 %option with_odbc no
53 %option with_geoip no
54 %option with_lua no
55 %option with_python no
57 # list of sources
58 Source0: http://www.kamailio.org/pub/kamailio/%{version}/src/kamailio-%{version}_src.tar.gz
59 Source2: rc.kamailio
60 Source3: fsl.kamailio
62 # build information
63 Prefix: %{l_prefix}
64 BuildRoot: %{l_buildroot}
65 BuildPreReq: OpenPKG, openpkg >= 20060823
66 PreReq: OpenPKG, openpkg >= 20060823
67 BuildPreReq: libxml, expat, curl, readline
68 PreReq: libxml, expat, curl, readline
69 BuildPreReq: make, gcc, flex, bison, sed, pkgconfig
70 PreReq: bash
71 %if "%{with_cons}" == "yes"
72 PreReq: perl-dbi, perl-term
73 %endif
74 %if "%{with_fsl}" == "yes"
75 BuildPreReq: fsl
76 PreReq: fsl
77 %endif
78 %if "%{with_ssl}" == "yes"
79 BuildPreReq: openssl
80 PreReq: openssl
81 %endif
82 %if "%{with_croute}" == "yes"
83 BuildPreReq: confuse
84 PreReq: confuse
85 %endif
86 %if "%{with_ldap}" == "yes"
87 BuildPreReq: openldap
88 PreReq: openldap
89 %endif
90 %if "%{with_memcached}" == "yes"
91 BuildPreReq: memcached
92 PreReq: memcached
93 %endif
94 %if "%{with_osp}" == "yes"
95 BuildPreReq: osptoolkit
96 PreReq: osptoolkit
97 %endif
98 %if "%{with_radius}" == "yes"
99 BuildPreReq: radiusclient
100 PreReq: radiusclient
101 %endif
102 %if "%{with_snmp}" == "yes"
103 BuildPreReq: snmp
104 PreReq: snmp
105 %endif
106 %if "%{with_bdb}" == "yes"
107 BuildPreReq: db
108 PreReq: db
109 %endif
110 %if "%{with_mysql}" == "yes"
111 BuildPreReq: mysql
112 PreReq: mysql
113 %endif
114 %if "%{with_pgsql}" == "yes"
115 BuildPreReq: postgresql
116 PreReq: postgresql
117 %endif
118 %if "%{with_odbc}" == "yes"
119 BuildPreReq: unixodbc
120 PreReq: unixodbc
121 %endif
122 %if "%{with_geoip}" == "yes"
123 BuildPreReq: geoip
124 PreReq: geoip
125 %endif
126 %if "%{with_lua}" == "yes"
127 BuildPreReq: lua
128 PreReq: lua
129 %endif
130 %if "%{with_python}" == "yes"
131 BuildPreReq: python
132 PreReq: python
133 %endif
134 AutoReq: no
135 AutoReqProv: no
137 %description
138 Kamailio is (beside Opensips) a successor to OpenSER, which in
139 turn was spawned from FhG FOKUS's SIP Express Router (SER). It
140 provides SIP (RFC3621) registrar, proxy and routing functionality.
141 A C shell like scripting language provides for control over the
142 server's behaviour. It's modular architecture allows for fine
143 grained loading of required functionality.
145 Kamailio can be used as a: Kamailio fits in scenarios:
147 Registrar server SIP trunking
148 Router, proxy SIP load balancing
149 Redirect server SIP front end termination
150 Presence agent Residential providers
151 Back to back user agent white label solutions
152 Instant messaging server Enterprise services
153 SIP to SMS gateway LCR for multi gateways
154 SIP to XMPP gateway
155 Load balancer or dispatcher
156 Front end for asterisk
157 NAT traversal unit
158 Application server
160 %track
161 prog kamailio = {
162 version = %{version}
163 url = http://www.kamailio.org/pub/kamailio/
164 regex = (\d+\.\d+\.\d+)/
165 url = http://www.kamailio.org/pub/kamailio/__NEWVER__/src/
166 regex = kamailio-(__VER__)_src\.tar\.gz
167 }
169 %prep
170 %setup -q
171 %{l_shtool} subst \
172 -e 's;\$(LOCALBASE)/[^/][^/]*/sctp.h;;g' \
173 -e 's;\$(LOCALBASE)/ssl/include;`%{l_prefix}/bin/pkg-config --cflags-only-I openssl`;g' \
174 -e 's;\$(LOCALBASE)/ssl/lib;`%{l_prefix}/bin/pkg-config --libs openssl`;g' \
175 -e 's;LOCALBASE *[\?:]*=.*;LOCALBASE = %{l_prefix};g' \
176 -e 's;\(data_dir\) *=.*;\1 = share/$(MAIN_NAME);g' \
177 -e 's;\(doc_dir\) *=.*;\1 = share/$(MAIN_NAME)/doc;g' \
178 -e 's;\(man_dir\) *=.*;\1 = man/;g' \
179 Makefile.defs
180 %{l_shtool} subst \
181 -e 's;CFLAGS *= *$;CFLAGS = %{l_cflags -O};g' \
182 -e 's;LDFLAGS *= *$;LDFLAGS = %{l_ldflags};g' \
183 -e 's;C_INCLUDES *= *$;C_INCLUDES = %{l_cppflags};g' \
184 Makefile.defs
185 %{l_shtool} subst \
186 -e 's;/usr/include/readline/readline.h;;g' \
187 utils/sercmd/Makefile
188 %{l_shtool} subst \
189 -e 's;-I$(LOCALBASE)/Berkeley[^ ]* *;;g' \
190 -e 's;-I$(LOCALBASE)/include[^ ]* *;;g' \
191 -e 's;-I$(SYSBASE)/include[^ ]* *;;g' \
192 -e 's;LIBS=.*;LIBS=`%{l_prefix}/bin/pkg-config --libs db`;g' \
193 utils/db_berkeley/Makefile
194 %{l_shtool} subst \
195 -e 's;\(\$(data_prefix)/\$(data_dir)/.*\)/kamailio;\1;g' \
196 utils/kamctl/Makefile
197 %{l_shtool} subst \
198 -e 's;\(radiusclient\)-ng;\1;g' \
199 -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
200 Makefile.radius \
201 lib/kcore/radius.h \
202 modules_s/avp_radius/avp_radius.c \
203 modules_s/uri_radius/checks.c \
204 modules_s/uri_radius/urirad_mod.c \
205 modules_s/acc_radius/acc_radius.c \
206 modules_s/auth_radius/authrad_mod.c \
207 modules_s/auth_radius/sterman.h
208 %{l_shtool} subst \
209 -e 's;\(DEFS *[\?:+]*=[^\\]*\);\1 -D__EXTENSIONS__;g' \
210 modules/db_mysql/Makefile \
211 modules/xmlrpc/Makefile
212 %{l_shtool} subst \
213 -e 's;\(-keyout.*\);\1 || true;' \
214 modules/tls/sip-router_cert.sh
215 %{l_shtool} subst \
216 -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \
217 -e 's; /\(etc/kamailio\); %{l_prefix}/\1;' \
218 -e 's;-f /usr/local/etc/kamailio/kamctlrc;false;' \
219 -e 's; /usr/local/etc/kamailio/kamctlrc;unleash-betty-boop;' \
220 -e 's;-f ~/.kamctlrc;false;g' \
221 -e 's;-f ./kamctlrc;false;g' \
222 -e 's;\(ETCDIR="\)/usr/local/\(etc/kamailio"\);\1%{l_prefix}/\2;' \
223 -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
224 -e 's;\(MYLIBDIR="\)/usr/local/\(lib/kamailio/kamctl"\);\1%{l_prefix}/\2;' \
225 utils/kamctl/kam*ctl
226 %{l_shtool} subst \
227 -e 's;/var/run/\(kamailio.pid\);%{l_prefix}/var/kamailio/\1;g' \
228 utils/kamctl/kamctl.base \
229 utils/kamctl/kamctlrc
230 %{l_shtool} subst \
231 -e 's;\(#include.*\)memcache\.h;\1libmemcached/memcached.h;' \
232 modules_k/memcached/memcached.h
234 %build
235 # select modules
236 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 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_b2b presence_conference presence_dialoginfo presence_mwi presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity sdpops seas sipcapture 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'
237 %if "%{with_ssl}" == "yes"
238 modslist="$modslist tls"
239 %endif
240 %if "%{with_croute}" == "yes"
241 modslist="$modslist carrierroute"
242 %endif
243 %if "%{with_ldap}" == "yes"
244 modslist="$modslist ldap h350"
245 %endif
246 %if "%{with_memcached}" == "yes"
247 modslist="$modslist memcached"
248 %endif
249 %if "%{with_osp}" == "yes"
250 modslist="$modslist osp"
251 %endif
252 %if "%{with_radius}" == "yes"
253 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
254 %endif
255 %if "%{with_snmp}" == "yes"
256 modslist="$modslist snmpstats"
257 %endif
258 %if "%{with_bdb}" == "yes"
259 modslist="$modslist db_berkeley"
260 %endif
261 %if "%{with_mysql}" == "yes"
262 modslist="$modslist db_mysql"
263 %endif
264 %if "%{with_pgsql}" == "yes"
265 modslist="$modslist db_postgres"
266 %endif
267 %if "%{with_sqlite}" == "yes"
268 modslist="$modslist db_sqlite"
269 %endif
270 %if "%{with_odbc}" == "yes"
271 modslist="$modslist db_unixodbc"
272 %endif
273 %if "%{with_lua}" == "yes"
274 modslist="$modslist app_lua"
275 %endif
276 %if "%{with_python}" == "yes"
277 modslist="$modslist app_python"
278 %endif
279 %if "%{with_geoip}" == "yes"
280 modslist="$modslist geoip"
281 %endif
283 # build configuration
284 %{l_make} %{l_mflags} \
285 CC="%{l_cc}" \
286 FLAVOUR=kamailio \
287 DESTDIR=$RPM_BUILD_ROOT \
288 INSTALL="%{l_shtool} install -c" \
289 TAR="tar" \
290 %if "%{with_sctp}" == "yes"
291 SCTP=1 \
292 %endif
293 %if "%{with_ssl}" == "yes"
294 TLS_HOOKS=1 \
295 %endif
296 prefix=%{l_prefix} \
297 cfg
299 # build program
300 %{l_make} %{l_mflags -O} \
301 CC="%{l_cc}" \
302 %if "%{with_sctp}" == "yes"
303 SCTP=1 \
304 %endif
305 %if "%{with_ssl}" == "yes"
306 TLS_HOOKS=1 \
307 %endif
308 prefix=%{l_prefix} \
309 kamailio
311 # build utilities
312 %{l_make} %{l_mflags -O} \
313 CC="%{l_cc}" \
314 %if "%{with_sctp}" == "yes"
315 SCTP=1 \
316 %endif
317 %if "%{with_ssl}" == "yes"
318 TLS_HOOKS=1 \
319 %endif
320 prefix=%{l_prefix} \
321 modules="$modslist" \
322 utils utils/kamctl
324 # build modules
325 %{l_make} %{l_mflags -O} \
326 CC="%{l_cc}" \
327 LD_RPATH=-Wl,-rpath, \
328 SER_RPATH_LST=%{l_prefix}/lib/kamailio \
329 %if "%{with_sctp}" == "yes"
330 SCTP=1 \
331 %endif
332 %if "%{with_ssl}" == "yes"
333 TLS_HOOKS=1 \
334 %endif
335 include_modules="$modslist" \
336 skip_modules="" \
337 prefix=%{l_prefix} \
338 every-module
340 %install
341 rm -rf $RPM_BUILD_ROOT
343 # select modules
344 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 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_b2b presence_conference presence_dialoginfo presence_mwi presence_reginfo presence_xml pua pua_bla pua_dialoginfo pua_mi pua_reginfo pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity sdpops seas sipcapture 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'
345 %if "%{with_ssl}" == "yes"
346 modslist="$modslist tls"
347 %endif
348 %if "%{with_croute}" == "yes"
349 modslist="$modslist carrierroute"
350 %endif
351 %if "%{with_ldap}" == "yes"
352 modslist="$modslist ldap h350"
353 %endif
354 %if "%{with_memcached}" == "yes"
355 modslist="$modslist memcached"
356 %endif
357 %if "%{with_osp}" == "yes"
358 modslist="$modslist osp"
359 %endif
360 %if "%{with_radius}" == "yes"
361 modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius"
362 %endif
363 %if "%{with_snmp}" == "yes"
364 modslist="$modslist snmpstats"
365 %endif
366 %if "%{with_bdb}" == "yes"
367 modslist="$modslist db_berkeley"
368 %endif
369 %if "%{with_mysql}" == "yes"
370 modslist="$modslist db_mysql"
371 %endif
372 %if "%{with_pgsql}" == "yes"
373 modslist="$modslist db_postgres"
374 %endif
375 %if "%{with_odbc}" == "yes"
376 modslist="$modslist db_unixodbc"
377 %endif
378 %if "%{with_lua}" == "yes"
379 modslist="$modslist app_lua"
380 %endif
381 %if "%{with_python}" == "yes"
382 modslist="$modslist app_python"
383 %endif
384 %if "%{with_geoip}" == "yes"
385 modslist="$modslist geoip"
386 %endif
388 # install program, utils, and modules
389 %{l_make} %{l_mflags} \
390 include_modules="$modslist" \
391 skip_modules="" \
392 install
394 # pare unused documentation
395 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/kamailio/docmodules*
397 # strip down installation
398 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
400 # create installation hierarchy
401 %{l_shtool} mkdir -f -p -m 700 \
402 $RPM_BUILD_ROOT%{l_prefix}/var/kamailio
404 # install OSSP fsl configuration
405 %{l_shtool} mkdir -f -p -m 755 \
406 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
407 %{l_shtool} install -c -m 644 %{l_value -s -a} \
408 %{SOURCE fsl.kamailio} \
409 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
411 # install runcommand script
412 %{l_shtool} mkdir -f -p -m 755 \
413 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
414 %{l_shtool} install -c -m 755 %{l_value -s -a} \
415 %{SOURCE rc.kamailio} \
416 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
418 # determine installation files
419 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
420 %{l_files_std} \
421 '%not %dir %{l_prefix}/etc/fsl' \
422 '%config %{l_prefix}/etc/fsl/*' \
423 '%config %{l_prefix}/etc/kamailio/*' \
424 '%doc %{l_prefix}/share/kamailio/doc/*' \
425 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/kamailio'
427 %files -f files
429 %clean
430 rm -rf $RPM_BUILD_ROOT
432 %post
433 # on install, setup database (kamctl db create /pfx/var/kamailio/db)
434 if [ ! -d $RPM_INSTALL_PREFIX/var/kamailio/db ]; then
435 %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
436 $RPM_INSTALL_PREFIX/var/kamailio/db
437 rm -f $RPM_INSTALL_PREFIX/share/kamailio/dbtext/*.orig
438 %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
439 $RPM_INSTALL_PREFIX/share/kamailio/dbtext/* \
440 $RPM_INSTALL_PREFIX/var/kamailio/db/
441 fi
443 # after upgrade, restart service
444 [ $1 -eq 2 ] || exit 0
445 eval `%{l_rc} kamailio status 2>/dev/null`
446 [ ".$kamailio_active" = .yes ] && %{l_rc} kamailio restart
447 exit 0
449 %preun
450 # before erase, stop service and remove log files
451 [ $1 -eq 0 ] || exit 0
452 %{l_rc} kamailio stop 2>/dev/null
453 rm -rf $RPM_INSTALL_PREFIX/var/kamailio/db 2>/dev/null || true
454 rm -f $RPM_INSTALL_PREFIX/var/kamailio/* 2>/dev/null || true
455 exit 0