kamailio/kamailio.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 548
efb4f295e1cf
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

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

mercurial