1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/kamailio/kamailio.spec Fri Oct 07 00:17:41 2011 +0200 1.3 @@ -0,0 +1,440 @@ 1.4 +## 1.5 +## kamailio.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2011 Michael Schloh von Bennewitz <michael@schloh.com> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: kamailio 1.29 +Summary: Open Source SIP Server 1.30 +URL: http://www.kamailio.org/ 1.31 +Vendor: IPTelorg GmbH, Fraunhofer FOKUS, SIP Router Project 1.32 +Packager: Michael Schloh von Bennewitz 1.33 +Distribution: Europalab Networks Production 1.34 +Class: PLUS 1.35 +Group: VoIP 1.36 +License: GPL 1.37 +Version: 3.1.5 1.38 +Release: 20111000 1.39 + 1.40 +# package options 1.41 +%option with_cons yes 1.42 +%option with_fsl yes 1.43 +%option with_ssl yes 1.44 +%option with_sctp no 1.45 +%option with_croute no 1.46 +%option with_ldap no 1.47 +%option with_memcached no 1.48 +%option with_radius no 1.49 +%option with_snmp no 1.50 +%option with_bdb no 1.51 +%option with_mysql no 1.52 +%option with_osp no 1.53 +%option with_pgsql no 1.54 +%option with_odbc no 1.55 +%option with_geoip no 1.56 +%option with_lua no 1.57 +%option with_python no 1.58 + 1.59 +# list of sources 1.60 +Source0: http://www.kamailio.org/pub/kamailio/%{version}/src/kamailio-%{version}_src.tar.gz 1.61 +Source2: rc.kamailio 1.62 +Source3: fsl.kamailio 1.63 + 1.64 +# build information 1.65 +Prefix: %{l_prefix} 1.66 +BuildRoot: %{l_buildroot} 1.67 +BuildPreReq: OpenPKG, openpkg >= 20060823 1.68 +PreReq: OpenPKG, openpkg >= 20060823 1.69 +BuildPreReq: libxml, expat, curl, readline 1.70 +PreReq: libxml, expat, curl, readline 1.71 +BuildPreReq: make, gcc, flex, bison, sed, pkgconfig 1.72 +PreReq: bash 1.73 +%if "%{with_cons}" == "yes" 1.74 +PreReq: perl-dbi, perl-term 1.75 +%endif 1.76 +%if "%{with_fsl}" == "yes" 1.77 +BuildPreReq: fsl 1.78 +PreReq: fsl 1.79 +%endif 1.80 +%if "%{with_ssl}" == "yes" 1.81 +BuildPreReq: openssl 1.82 +PreReq: openssl 1.83 +%endif 1.84 +%if "%{with_croute}" == "yes" 1.85 +BuildPreReq: confuse 1.86 +PreReq: confuse 1.87 +%endif 1.88 +%if "%{with_ldap}" == "yes" 1.89 +BuildPreReq: openldap 1.90 +PreReq: openldap 1.91 +%endif 1.92 +%if "%{with_memcached}" == "yes" 1.93 +BuildPreReq: memcached 1.94 +PreReq: memcached 1.95 +%endif 1.96 +%if "%{with_osp}" == "yes" 1.97 +BuildPreReq: osptoolkit 1.98 +PreReq: osptoolkit 1.99 +%endif 1.100 +%if "%{with_radius}" == "yes" 1.101 +BuildPreReq: radiusclient 1.102 +PreReq: radiusclient 1.103 +%endif 1.104 +%if "%{with_snmp}" == "yes" 1.105 +BuildPreReq: snmp 1.106 +PreReq: snmp 1.107 +%endif 1.108 +%if "%{with_bdb}" == "yes" 1.109 +BuildPreReq: db 1.110 +PreReq: db 1.111 +%endif 1.112 +%if "%{with_mysql}" == "yes" 1.113 +BuildPreReq: mysql 1.114 +PreReq: mysql 1.115 +%endif 1.116 +%if "%{with_pgsql}" == "yes" 1.117 +BuildPreReq: postgresql 1.118 +PreReq: postgresql 1.119 +%endif 1.120 +%if "%{with_odbc}" == "yes" 1.121 +BuildPreReq: unixodbc 1.122 +PreReq: unixodbc 1.123 +%endif 1.124 +%if "%{with_geoip}" == "yes" 1.125 +BuildPreReq: geoip 1.126 +PreReq: geoip 1.127 +%endif 1.128 +%if "%{with_lua}" == "yes" 1.129 +BuildPreReq: lua 1.130 +PreReq: lua 1.131 +%endif 1.132 +%if "%{with_python}" == "yes" 1.133 +BuildPreReq: python 1.134 +PreReq: python 1.135 +%endif 1.136 +AutoReq: no 1.137 +AutoReqProv: no 1.138 + 1.139 +%description 1.140 + Kamailio is (beside Opensips) a successor to OpenSER, which in 1.141 + turn was spawned from FhG FOKUS's SIP Express Router (SER). It 1.142 + provides SIP (RFC3621) registrar, proxy and routing functionality. 1.143 + A C shell like scripting language provides for control over the 1.144 + server's behaviour. It's modular architecture allows for fine 1.145 + grained loading of required functionality. 1.146 + 1.147 + Kamailio can be used as a: Kamailio fits in scenarios: 1.148 + 1.149 + Registrar server SIP trunking 1.150 + Router, proxy SIP load balancing 1.151 + Redirect server SIP front end termination 1.152 + Presence agent Residential providers 1.153 + Back to back user agent white label solutions 1.154 + Instant messaging server Enterprise services 1.155 + SIP to SMS gateway LCR for multi gateways 1.156 + SIP to XMPP gateway 1.157 + Load balancer or dispatcher 1.158 + Front end for asterisk 1.159 + NAT traversal unit 1.160 + Application server 1.161 + 1.162 +%track 1.163 + prog kamailio = { 1.164 + version = %{version} 1.165 + url = http://www.kamailio.org/pub/kamailio/ 1.166 + regex = (\d+\.\d+\.\d+)/ 1.167 + url = http://www.kamailio.org/pub/kamailio/__NEWVER__/src/ 1.168 + regex = kamailio-(__VER__)_src\.tar\.gz 1.169 + } 1.170 + 1.171 +%prep 1.172 + %setup -q 1.173 + %{l_shtool} subst \ 1.174 + -e 's;\$(LOCALBASE)/[^/][^/]*/sctp.h;;g' \ 1.175 + -e 's;\$(LOCALBASE)/ssl/include;`%{l_prefix}/bin/pkg-config --cflags-only-I openssl`;g' \ 1.176 + -e 's;\$(LOCALBASE)/ssl/lib;`%{l_prefix}/bin/pkg-config --libs openssl`;g' \ 1.177 + -e 's;\(data_dir\) *= *\(\$(MAIN_NAME)\);\1 = share/\2;g' \ 1.178 + -e 's;LOCALBASE *[\?:]*=.*;LOCALBASE = %{l_prefix};g' \ 1.179 + Makefile.defs 1.180 + %{l_shtool} subst \ 1.181 + -e 's;CFLAGS *= *$;CFLAGS = %{l_cflags -O};g' \ 1.182 + -e 's;LDFLAGS *= *$;LDFLAGS = %{l_ldflags};g' \ 1.183 + -e 's;C_INCLUDES *= *$;C_INCLUDES = %{l_cppflags};g' \ 1.184 + Makefile.defs 1.185 + %{l_shtool} subst \ 1.186 + -e 's;/usr/include/readline/readline.h;;g' \ 1.187 + utils/sercmd/Makefile 1.188 + %{l_shtool} subst \ 1.189 + -e 's;-I$(LOCALBASE)/Berkeley[^ ]* *;;g' \ 1.190 + -e 's;-I$(LOCALBASE)/include[^ ]* *;;g' \ 1.191 + -e 's;-I$(SYSBASE)/include[^ ]* *;;g' \ 1.192 + -e 's;LIBS=.*;LIBS=`%{l_prefix}/bin/pkg-config --libs db`;g' \ 1.193 + utils/db_berkeley/Makefile 1.194 + %{l_shtool} subst \ 1.195 + -e 's;\(mkdir.*\$(data_prefix)/\$(data_dir)/.*\)/kamailio;\1;g' \ 1.196 + utils/kamctl/Makefile 1.197 + %{l_shtool} subst \ 1.198 + -e 's;\(radiusclient\)-ng;\1;g' \ 1.199 + -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \ 1.200 + Makefile.radius \ 1.201 + lib/kcore/radius.h \ 1.202 + modules_s/avp_radius/avp_radius.c \ 1.203 + modules_s/uri_radius/checks.c \ 1.204 + modules_s/uri_radius/urirad_mod.c \ 1.205 + modules_s/acc_radius/acc_radius.c \ 1.206 + modules_s/auth_radius/authrad_mod.c \ 1.207 + modules_s/auth_radius/sterman.h 1.208 + %{l_shtool} subst \ 1.209 + -e 's;\(DEFS *[\?:+]*=[^\\]*\);\1 -D__EXTENSIONS__;g' \ 1.210 + modules/db_mysql/Makefile \ 1.211 + modules/xmlrpc/Makefile 1.212 + %{l_shtool} subst \ 1.213 + -e 's;\(-keyout.*\);\1 || true;' \ 1.214 + modules/tls/sip-router_cert.sh 1.215 + 1.216 +%build 1.217 + # select modules 1.218 + 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' 1.219 +%if "%{with_ssl}" == "yes" 1.220 + modslist="$modslist tls" 1.221 +%endif 1.222 +%if "%{with_croute}" == "yes" 1.223 + modslist="$modslist carrierroute" 1.224 +%endif 1.225 +%if "%{with_ldap}" == "yes" 1.226 + modslist="$modslist ldap h350" 1.227 +%endif 1.228 +%if "%{with_memcached}" == "yes" 1.229 + modslist="$modslist memcached" 1.230 +%endif 1.231 +%if "%{with_osp}" == "yes" 1.232 + modslist="$modslist osp" 1.233 +%endif 1.234 +%if "%{with_radius}" == "yes" 1.235 + modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius" 1.236 +%endif 1.237 +%if "%{with_snmp}" == "yes" 1.238 + modslist="$modslist snmpstats" 1.239 +%endif 1.240 +%if "%{with_bdb}" == "yes" 1.241 + modslist="$modslist db_berkeley" 1.242 +%endif 1.243 +%if "%{with_mysql}" == "yes" 1.244 + modslist="$modslist db_mysql" 1.245 +%endif 1.246 +%if "%{with_pgsql}" == "yes" 1.247 + modslist="$modslist db_postgres" 1.248 +%endif 1.249 +%if "%{with_odbc}" == "yes" 1.250 + modslist="$modslist db_unixodbc" 1.251 +%endif 1.252 +%if "%{with_lua}" == "yes" 1.253 + modslist="$modslist app_lua" 1.254 +%endif 1.255 +%if "%{with_python}" == "yes" 1.256 + modslist="$modslist app_python" 1.257 +%endif 1.258 +%if "%{with_geoip}" == "yes" 1.259 + modslist="$modslist geoip" 1.260 +%endif 1.261 + 1.262 + # build configuration 1.263 + %{l_make} %{l_mflags} \ 1.264 + CC="%{l_cc}" \ 1.265 + FLAVOUR=kamailio \ 1.266 +%if "%{with_sctp}" == "yes" 1.267 + SCTP=1 \ 1.268 +%endif 1.269 +%if "%{with_ssl}" == "yes" 1.270 + TLS_HOOKS=1 \ 1.271 +%endif 1.272 + prefix=%{l_prefix} \ 1.273 + cfg 1.274 + 1.275 + # build program 1.276 + %{l_make} %{l_mflags -O} \ 1.277 + CC="%{l_cc}" \ 1.278 +%if "%{with_sctp}" == "yes" 1.279 + SCTP=1 \ 1.280 +%endif 1.281 +%if "%{with_ssl}" == "yes" 1.282 + TLS_HOOKS=1 \ 1.283 +%endif 1.284 + prefix=%{l_prefix} \ 1.285 + kamailio 1.286 + 1.287 + # build utilities 1.288 + %{l_make} %{l_mflags -O} \ 1.289 + CC="%{l_cc}" \ 1.290 +%if "%{with_sctp}" == "yes" 1.291 + SCTP=1 \ 1.292 +%endif 1.293 +%if "%{with_ssl}" == "yes" 1.294 + TLS_HOOKS=1 \ 1.295 +%endif 1.296 + prefix=%{l_prefix} \ 1.297 + modules="$modslist" \ 1.298 + utils utils/kamctl 1.299 + 1.300 + # build modules 1.301 + %{l_make} %{l_mflags -O} \ 1.302 + CC="%{l_cc}" \ 1.303 + LD_RPATH=-Wl,-rpath, \ 1.304 + SER_RPATH_LST=%{l_prefix}/lib/kamailio \ 1.305 +%if "%{with_sctp}" == "yes" 1.306 + SCTP=1 \ 1.307 +%endif 1.308 +%if "%{with_ssl}" == "yes" 1.309 + TLS_HOOKS=1 \ 1.310 +%endif 1.311 + include_modules="$modslist" \ 1.312 + skip_modules="" \ 1.313 + prefix=%{l_prefix} \ 1.314 + every-module 1.315 + 1.316 +%install 1.317 + rm -rf $RPM_BUILD_ROOT 1.318 + 1.319 + # select modules 1.320 + 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' 1.321 +%if "%{with_ssl}" == "yes" 1.322 + modslist="$modslist tls" 1.323 +%endif 1.324 +%if "%{with_croute}" == "yes" 1.325 + modslist="$modslist carrierroute" 1.326 +%endif 1.327 +%if "%{with_ldap}" == "yes" 1.328 + modslist="$modslist ldap h350" 1.329 +%endif 1.330 +%if "%{with_memcached}" == "yes" 1.331 + modslist="$modslist memcached" 1.332 +%endif 1.333 +%if "%{with_osp}" == "yes" 1.334 + modslist="$modslist osp" 1.335 +%endif 1.336 +%if "%{with_radius}" == "yes" 1.337 + modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius" 1.338 +%endif 1.339 +%if "%{with_snmp}" == "yes" 1.340 + modslist="$modslist snmpstats" 1.341 +%endif 1.342 +%if "%{with_bdb}" == "yes" 1.343 + modslist="$modslist db_berkeley" 1.344 +%endif 1.345 +%if "%{with_mysql}" == "yes" 1.346 + modslist="$modslist db_mysql" 1.347 +%endif 1.348 +%if "%{with_pgsql}" == "yes" 1.349 + modslist="$modslist db_postgres" 1.350 +%endif 1.351 +%if "%{with_odbc}" == "yes" 1.352 + modslist="$modslist db_unixodbc" 1.353 +%endif 1.354 +%if "%{with_lua}" == "yes" 1.355 + modslist="$modslist app_lua" 1.356 +%endif 1.357 +%if "%{with_python}" == "yes" 1.358 + modslist="$modslist app_python" 1.359 +%endif 1.360 +%if "%{with_geoip}" == "yes" 1.361 + modslist="$modslist geoip" 1.362 +%endif 1.363 + 1.364 + # install program, utils, and modules 1.365 + %{l_make} %{l_mflags} \ 1.366 + INSTALL="%{l_shtool} install -c" \ 1.367 + INSTALL_CFG="%{l_shtool} install -c" \ 1.368 + INSTALL_BIN="%{l_shtool} install -c" \ 1.369 + INSTALL_SCRIPT="%{l_shtool} install -c" \ 1.370 + INSTALL_MODULES="%{l_shtool} install -c" \ 1.371 + INSTALL_LIB="%{l_shtool} install -c" \ 1.372 + INSTALL_DOC="%{l_shtool} install -c" \ 1.373 + INSTALL_MAN="%{l_shtool} install -c" \ 1.374 + INSTALL_SHARE="%{l_shtool} install -c" \ 1.375 + basedir=$RPM_BUILD_ROOT \ 1.376 + prefix=%{l_prefix} \ 1.377 + doc-dir=share/kamailio/doc \ 1.378 + man-dir=man \ 1.379 + data-dir=share/kamailio \ 1.380 + include_modules="$modslist" \ 1.381 + skip_modules="" \ 1.382 + install 1.383 + 1.384 + # strip down installation 1.385 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 1.386 + 1.387 + # create installation hierarchy 1.388 + %{l_shtool} mkdir -f -p -m 700 \ 1.389 + $RPM_BUILD_ROOT%{l_prefix}/var/kamailio 1.390 + 1.391 + # install OSSP fsl configuration 1.392 + %{l_shtool} mkdir -f -p -m 755 \ 1.393 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.394 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.395 + %{SOURCE fsl.kamailio} \ 1.396 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.397 + 1.398 + # install runcommand script 1.399 + %{l_shtool} mkdir -f -p -m 755 \ 1.400 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.401 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.402 + %{SOURCE rc.kamailio} \ 1.403 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.404 + 1.405 + # determine installation files 1.406 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.407 + %{l_files_std} \ 1.408 + '%not %dir %{l_prefix}/etc/fsl' \ 1.409 + '%config %{l_prefix}/etc/fsl/*' \ 1.410 + '%config %{l_prefix}/etc/kamailio/*' \ 1.411 + '%doc %{l_prefix}/share/kamailio/doc/*' \ 1.412 + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/kamailio' 1.413 + 1.414 +%files -f files 1.415 + 1.416 +%clean 1.417 + rm -rf $RPM_BUILD_ROOT 1.418 + 1.419 +%post 1.420 + # on install, setup database (kamctl db create /pfx/var/kamailio/db) 1.421 + if [ ! -d $RPM_INSTALL_PREFIX/var/kamailio/db ]; then 1.422 + %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \ 1.423 + $RPM_INSTALL_PREFIX/var/kamailio/db 1.424 + rm -f $RPM_INSTALL_PREFIX/share/kamailio/dbtext/*.orig 1.425 + %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \ 1.426 + $RPM_INSTALL_PREFIX/share/kamailio/dbtext/* \ 1.427 + $RPM_INSTALL_PREFIX/var/kamailio/db/ 1.428 + fi 1.429 + 1.430 + # after upgrade, restart service 1.431 + [ $1 -eq 2 ] || exit 0 1.432 + eval `%{l_rc} kamailio status 2>/dev/null` 1.433 + [ ".$kamailio_active" = .yes ] && %{l_rc} kamailio restart 1.434 + exit 0 1.435 + 1.436 +%preun 1.437 + # before erase, stop service and remove log files 1.438 + [ $1 -eq 0 ] || exit 0 1.439 + %{l_rc} kamailio stop 2>/dev/null 1.440 + rm -rf $RPM_INSTALL_PREFIX/var/kamailio/db 2>/dev/null || true 1.441 + rm -f $RPM_INSTALL_PREFIX/var/kamailio/* 2>/dev/null || true 1.442 + exit 0 1.443 +