opensips/opensips.spec

Fri, 30 Mar 2012 18:55:41 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 30 Mar 2012 18:55:41 +0200
changeset 416
0bc1d0d1fe3a
parent 413
506d3a1a6c3c
child 547
1c75a8bb0fec
permissions
-rw-r--r--

Patch TLS domain logic to allow certless outgoing (UAC) connections.

     1 ##
     2 ##  opensips.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2008 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 options
    25 %define       V_rtpproxy  1.2.1
    27 #   package information
    28 Name:         opensips
    29 Summary:      Open SIP Router
    30 URL:          http://www.opensips.org/
    31 Vendor:       Voice System SRL
    32 Packager:     OpenPKG Foundation e.V.
    33 Distribution: OpenPKG Community
    34 Class:        PLUS
    35 Group:        VoIP
    36 License:      GPL
    37 Version:      1.7.2
    38 Release:      20120208
    40 #   package options
    41 %option       with_cons    yes
    42 %option       with_fsl     yes
    43 %option       with_ssl     yes
    44 %option       with_sctp    no
    45 %option       with_json    no
    46 %option       with_croute  no
    47 %option       with_ldap    no
    48 %option       with_memcached no
    49 %option       with_radius  no
    50 %option       with_snmp    no
    51 %option       with_bdb     no
    52 %option       with_mysql   no
    53 %option       with_osp     no
    54 %option       with_pgsql   no
    55 %option       with_odbc    no
    56 %option       with_geoip   no
    57 %option       with_dbgmem  no
    59 #   list of sources
    60 Source0:      http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{version}_src.tar.gz
    61 Source1:      http://www.b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz
    62 Source2:      rc.opensips
    63 Source3:      fsl.opensips
    64 Source4:      opensips.cfg
    65 Patch0:       opensips.patch
    66 Patch1:       opensips.patch.ctlrc
    67 Patch2:       opensips.patch.dict
    68 Patch3:       opensips.patch.uac
    69 Patch4:       opensips.patch.reg
    70 Patch5:       opensips.patch.rtpproxy
    72 #   build information
    73 Prefix:       %{l_prefix}
    74 BuildRoot:    %{l_buildroot}
    75 BuildPreReq:  OpenPKG, openpkg >= 20060823, make, gcc, flex, bison, sed
    76 PreReq:       OpenPKG, openpkg >= 20060823, bash
    77 BuildPreReq:  libxml, expat, curl, pkgconfig
    78 PreReq:       libxml, expat, curl
    79 %if "%{with_cons}" == "yes"
    80 PreReq:       perl-dbi, perl-term
    81 %endif
    82 %if "%{with_fsl}" == "yes"
    83 BuildPreReq:  fsl
    84 PreReq:       fsl
    85 %endif
    86 %if "%{with_ssl}" == "yes"
    87 BuildPreReq:  openssl
    88 PreReq:       openssl
    89 %endif
    90 %if "%{with_croute}" == "yes"
    91 BuildPreReq:  confuse
    92 PreReq:       confuse
    93 %endif
    94 %if "%{with_json}" == "yes"
    95 BuildPreReq:  json
    96 PreReq:       json
    97 %endif
    98 %if "%{with_ldap}" == "yes"
    99 BuildPreReq:  openldap
   100 PreReq:       openldap
   101 %endif
   102 %if "%{with_memcached}" == "yes"
   103 BuildPreReq:  memcached
   104 PreReq:       memcached
   105 %endif
   106 %if "%{with_osp}" == "yes"
   107 BuildPreReq:  osptoolkit
   108 PreReq:       osptoolkit
   109 %endif
   110 %if "%{with_radius}" == "yes"
   111 BuildPreReq:  radiusclient
   112 PreReq:       radiusclient
   113 %endif
   114 %if "%{with_snmp}" == "yes"
   115 BuildPreReq:  snmp
   116 PreReq:       snmp
   117 %endif
   118 %if "%{with_bdb}" == "yes"
   119 BuildPreReq:  db
   120 PreReq:       db
   121 %endif
   122 %if "%{with_mysql}" == "yes"
   123 BuildPreReq:  mysql
   124 PreReq:       mysql
   125 %endif
   126 %if "%{with_pgsql}" == "yes"
   127 BuildPreReq:  postgresql
   128 PreReq:       postgresql
   129 %endif
   130 %if "%{with_odbc}" == "yes"
   131 BuildPreReq:  unixodbc
   132 PreReq:       unixodbc
   133 %endif
   134 %if "%{with_geoip}" == "yes"
   135 BuildPreReq:  geoip
   136 PreReq:       geoip
   137 %endif
   138 AutoReq:      no
   139 AutoReqProv:  no
   141 %description
   142     OpenSIPS is (beside Kamailio) a successor to OpenSER, which in
   143     turn was spawned from FhG FOKUS's SIP Express Router (SER). It
   144     provides SIP (RFC3621) registrar, proxy and routing functionality.
   145     A C shell like scripting language provides for control over the
   146     server's behaviour. It's modular architecture allows for fine
   147     grained loading of required functionality.
   149     The third party Sippy RTPproxy from http://www.rtpproxy.org/
   150     is included to make communication between SIP user agents
   151     behind NATs (Network Address Translators) possible.
   153     OpenSIPS can be used as a:      OpenSIPS fits in scenarios:
   155     Registrar server                SIP trunking
   156     Router, proxy                   SIP load balancing
   157     Redirect server                 SIP front end termination
   158     Presence agent                  Residential providers
   159     Back to back user agent         white label solutions
   160     Instant messaging server        Enterprise services
   161     SIP to SMS gateway              LCR for multi gateways
   162     SIP to XMPP gateway
   163     Load balancer or dispatcher
   164     Front end for asterisk
   165     NAT traversal unit
   166     Application server
   168 %track
   169     prog opensips = {
   170         version   = %{version}
   171         url       = http://www.opensips.org/pub/opensips/
   172         regex     = (\d+\.\d+\.\d+)/
   173         url       = http://www.opensips.org/pub/opensips/__NEWVER__/src/
   174         regex     = opensips-(__VER__)_src\.tar\.gz
   175     }
   176     prog opensips:rtpproxy = {
   177         version   = %{V_rtpproxy}
   178         url       = http://www.rtpproxy.org/
   179         regex     = rtpproxy-(\d+(?:\.\d+)+)\.tar\.gz
   180     }
   182 %prep
   183     %setup -q -n opensips-%{version}-tls
   184     %setup -q -n opensips-%{version}-tls -T -D -a 1
   185     %patch -p0
   186     %patch -p0 -P 1
   187     %patch -p0 -P 2
   188     %patch -p0 -P 3
   189     %patch -p0 -P 4
   190     ( cd rtpproxy-%{V_rtpproxy}
   191       %patch -p0 -P 5
   192     ) || exit $?
   193     %{l_shtool} subst %{l_value -s -a} \
   194         scripts/opensipsctlrc \
   195         scripts/osipsconsolerc
   196     %{l_shtool} subst \
   197         -e 's;^#! */bin/sh;#! %{l_prefix}/bin/bash;' \
   198         scripts/opensipsctl
   199     %{l_shtool} subst \
   200         -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \
   201         modules/seas/doc/xml2sgml.sh \
   202         scripts/opensipsdbctl \
   203         test/*.sh
   204     %{l_shtool} subst \
   205 %if "%{with_dbgmem}" == "yes"
   206         -e 's;\(-DF_MALLOC\);#\1;' \
   207         -e 's;#\(-DDBG_QM_MALLOC\);\1;' \
   208 %endif
   209         -e 's;\(#define PKG_MEM_POOL_SIZE\) \(1024\*1024\);\1 4*\2;' \
   210         Makefile.defs \
   211         config.h
   212     %{l_shtool} subst \
   213 %if "%{with_fsl}" == "yes"
   214         -e 's;@fslldflags@;-L$(prefix)/lib;g' \
   215         -e 's;@fsllibs@;-lfsl;g' \
   216 %else
   217         -e 's;@fslldflags@;;g' \
   218         -e 's;@fsllibs@;;g' \
   219 %endif
   220         -e 's;^\(DEFS+= -I\)\$(LOCALBASE).*;\1$(prefix)/include;' \
   221         -e 's;^\(DEFS+= -L\)\$(LOCALBASE).*;\1$(prefix)/lib -lssl -lcrypto;' \
   222         -e 's;^SVNVERSION *=.*;;g' \
   223         -e 's;^DBHTML2TXT *=.*;;g' \
   224         -e 's;^DBXML2PDF *=.*;;g' \
   225         -e 's;lib64;lib;' \
   226         Makefile.defs
   227     %{l_shtool} subst \
   228         -e 's;\(radiusclient\)-ng;\1;g' \
   229         modules/aaa_radius/aaa_radius.c \
   230         modules/aaa_radius/rad.c \
   231         Makefile.defs
   232     %{l_shtool} subst \
   233         -e 's;\(\$(data-dir)\)/\(dbtext\)/opensips;\1/\2;g' \
   234         -e 's;\(\$(data-dir)\)/\(db_berkeley\)/opensips;\1/\2;g' \
   235         -e 's;\(/usr/local/etc/opensips\);\1/*;g' \
   236         -e 's;\(s#/usr/local/sbin\)#;\1/*#;g' \
   237         -e 's;\(s#/usr/share/doc/$(NAME)/#$(doc-target)\)#;\1/#;g' \
   238         -e 's;\(\$(MAKE).*\) \(install_module_custom\);\1 makefile_defs=0 \2;' \
   239         Makefile
   240     %{l_shtool} subst \
   241         -e 's;^\(LIBS=\).*;\1-L`%{l_prefix}/bin/pkg-config --libs db`;' \
   242         utils/db_berkeley/Makefile
   243     %{l_shtool} subst \
   244         -e 's;/usr/share/doc/opensips/AUTHORS;%{l_prefix}/share/opensips/doc/AUTHORS;' \
   245         scripts/opensipsctl.8
   246     %{l_shtool} subst \
   247         -e 's;\(ETCDIR=".*\)/"$;\1";' \
   248         -e 's;\(ETCDIR="\)/usr/local/\(etc/opensips"\);\1%{l_prefix}/\2;' \
   249         -e 's;\. /etc/opensips/opensipsctlrc;true;' \
   250         -e 's;\. ~/.opensipsctlrc;true;' \
   251         -e 's;/usr/local\(/lib/opensips/opensipsctl\);%{l_prefix}\1;' \
   252         -e 's;/usr/local/\(etc/opensips/opensipsctlrc\);%{l_prefix}/\1;' \
   253         -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
   254         scripts/opensipsdbctl \
   255         scripts/opensipsctl
   256     %{l_shtool} subst \
   257         -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;g' \
   258         -e 's;\(my \$fifo_reply_path\) = "/tmp/";\1 = "%{l_prefix}/var/opensips/";' \
   259         -e 's;\(my \$HISTORY_FILE\) = "/tmp/osipsconsole_history";\1 = "%{l_prefix}/var/opensips/osipsconsole_history";' \
   260         scripts/opensipsctl \
   261         scripts/osipsconsole \
   262     %{l_shtool} subst \
   263         -e 's;/usr/local;;g' \
   264         -e 's;\(/etc/opensips/\)\.\(opensipsctlrc\);%{l_prefix}\1\2;g' \
   265         scripts/opensipsctl.8
   266     %{l_shtool} subst \
   267         -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;' \
   268         scripts/opensipsctl.base
   269     %{l_shtool} subst \
   270         -e 's;\(path=\)\$CHROOT_DIR/tmp/\(\$name\);\1${OSER_FIRET}/\2;g' \
   271         scripts/opensipsctl.fifo
   272     %{l_shtool} subst \
   273         -e 's;/usr/local/share/opensips/dbtext/opensips;%{l_prefix}/var/opensips/db;' \
   274         scripts/opensipsctl.dbtext
   275     %{l_shtool} subst \
   276         -e 's;\(DB_PATH="\)[^"][^"]*;%{l_prefix}/var/opensips/db_berkeley;' \
   277         scripts/opensipsctl.db_berkeley
   278     %{l_shtool} subst \
   279         -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
   280         scripts/opensipsctl \
   281         scripts/opensipsdbctl.base
   282     %{l_shtool} subst \
   283         -e 's;/usr/local/etc/opensips/dbtext;%{l_prefix}/var/opensips/db;' \
   284         -e 's;\(\$DATA_DIR/dbtext\)/opensips;\1;g' \
   285         scripts/opensipsdbctl.dbtext
   286     %{l_shtool} subst \
   287         -e 's;\(DATA_DIR="\)[^"][^"]*;\1%{l_prefix}/share/opensips;' \
   288         scripts/opensipsdbctl.dbtext \
   289         scripts/opensipsdbctl.oracle
   290     %{l_shtool} subst \
   291         -e 's;/usr/local/etc/opensips/db_berkeley;%{l_prefix}/var/opensips/db_berkeley;' \
   292         -e 's;/usr/local/BerkeleyDB.[^/][^/]*/bin;%{l_prefix}/bin;' \
   293         scripts/opensipsdbctl.db_berkeley
   294     %{l_shtool} subst \
   295         -e 's;/usr/local/\(share/opensips\);%{l_prefix}/\1;' \
   296         scripts/opensipsdbctl.db_berkeley \
   297         scripts/opensipsdbctl.mysql \
   298         scripts/opensipsdbctl.pgsql
   299     %{l_shtool} subst \
   300         -e 's;\(script_flags(int\));\1,null);' \
   301         scripts/dbtext/opensips/dialog
   302     %{l_shtool} subst \
   303         -e 's;body(string);body(blob);' \
   304         -e 's;sender(string);sender(string,null);' \
   305         scripts/dbtext/opensips/presentity
   306     %{l_shtool} subst \
   307         -e 's;\(expires(int\));\1,null);' \
   308         -e 's;\(desired_expires(int\));\1,null);' \
   309         -e 's;\(contact(string\));\1,null);' \
   310         -e 's;\(remote_contact(string\));\1,null);' \
   311         -e 's;\(version(int\));\1,null);' \
   312         -e 's;\(extra_headers(string\));\1,null);' \
   313         scripts/dbtext/opensips/pua
   314     %{l_shtool} subst \
   315         -e 's;\(reason(string\));\1,null);' \
   316         scripts/dbtext/opensips/active_watchers \
   317         scripts/dbtext/opensips/rls_watchers
   318     %{l_shtool} subst \
   319         -e 's;#! */usr/bin/python;#! %{l_prefix}/bin/python;' \
   320         scripts/dbtextdb/*.py
   321     %{l_shtool} subst \
   322         -e 's;#! */usr/bin/perl;#! %{l_prefix}/bin/perl;' \
   323         -e 's;^\(my \$PATH_BIN =\) "./";\1 "%{l_prefix}/bin/";' \
   324         -e 's;^\(my \$PATH_CTLRC =\) "./scripts/";\1 "%{l_prefix}/etc/opensips/";' \
   325         -e 's;^\(my \$PATH_ETC =\) "/usr/local/etc";\1 "%{l_prefix}/etc";' \
   326         -e 's;^\(my \$PATH_LIBS =\) "/usr/local/lib";\1 "%{l_prefix}/lib";' \
   327         -e 's;^\(my \$PATH_SHARE =\) "/usr/local/share";\1 "%{l_prefix}/share";' \
   328         -e 's;^\(my $path = \)"/tmp/";\1"%{l_prefix}/var/opensips/";' \
   329         scripts/osipsconsole
   330     %{l_shtool} subst \
   331         -e 's;if ( -x "/usr/bin/";if ( -x "%{l_prefix}/bin";' \
   332         -e 's;if \[ -x "/usr/bin/\$1" \];if [ -x "%{l_prefix}/bin/$1" ];' \
   333         -e 's;\$TOOLPATH = "/usr/bin/";$TOOLPATH = "%{l_prefix}/bin/";' \
   334         -e 's;TOOLPATH="/usr/bin/\$1";TOOLPATH="%{l_prefix}/bin/$1";' \
   335         -e 's;if ( -x "/bin/";if ( -x "/usr/bin/";' \
   336         -e 's;if \[ -x "/bin/\$1" \];if [ -x "/usr/bin/$1" ];' \
   337         -e 's;\$TOOLPATH = "/bin/";$TOOLPATH = "/usr/bin/";' \
   338         -e 's;TOOLPATH="/bin/\$1";TOOLPATH="/usr/bin/$1";' \
   339         -e 's;if ( -x "/usr/local/bin/\$1";if ( -x "/bin/$1";' \
   340         -e 's;if \[ -x "/usr/local/bin/\$1" \];if [ -x "/bin/$1" ];' \
   341         -e 's;\$TOOLPATH = "/usr/local/bin/;$TOOLPATH = "/bin/;' \
   342         -e 's;TOOLPATH="/usr/local/bin/\$1";TOOLPATH="/bin/$1";' \
   343         scripts/osipsconsole \
   344         scripts/opensipsctl.base
   345     %{l_shtool} subst \
   346         -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
   347         -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libcurl libxml-2.0`;g" \
   348         -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libcurl libxml-2.0`;" \
   349         modules/xcap_client/Makefile
   350     %{l_shtool} subst \
   351         -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
   352         -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libxml-2.0`;g" \
   353         -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libxml-2.0`;" \
   354         modules/cpl-c/Makefile \
   355         modules/presence/Makefile \
   356         modules/presence_dialoginfo/Makefile \
   357         modules/presence_xml/Makefile \
   358         modules/pua/Makefile \
   359         modules/pua_bla/Makefile \
   360         modules/pua_dialoginfo/Makefile \
   361         modules/pua_mi/Makefile \
   362         modules/pua_usrloc/Makefile \
   363         modules/pua_xmpp/Makefile \
   364         modules/b2b_logic/Makefile \
   365         modules/rls/Makefile
   366     %{l_shtool} subst \
   367         -e 's;^\(DEFS+= *\);\1-D__EXTENSIONS__ ;' \
   368         modules/presence_xml/Makefile
   369     %{l_shtool} subst \
   370         -e 's;^\(DEFS+=\).*;\1`%{l_prefix}/bin/pkg-config --cflags-only-I libconfuse`;' \
   371         -e 's;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libconfuse`;' \
   372         modules/carrierroute/Makefile
   373     %{l_shtool} subst \
   374         -e 's;\(LIBS = .*-L\$(shell pg_config --libdir) -lpq\);\1 $(shell pg_config --libs);' \
   375         modules/db_postgres/Makefile
   376     %{l_shtool} subst \
   377         -e 's;-I\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/include[\t ]*;;' \
   378         -e 's;-L\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/lib[\t ]*;;' \
   379         modules/db_berkeley/Makefile \
   380         utils/db_berkeley/Makefile
   381     %{l_shtool} subst \
   382         -e 's;\(\$(cfg-prefix)\)\$(shell net-snmp-config --prefix);\1;' \
   383         modules/snmpstats/Makefile
   384     %{l_shtool} subst \
   385         -e 's;LM_WARN(\(\"uac does not spread across\);LM_NOTICE(\1;' \
   386         modules/tm/uac.c
   387     %{l_shtool} subst \
   388         -e 's;\(#define MAX_SSL_RETRIES\) 32;\1 1024;' \
   389         tls/tls_server.c
   390     %{l_shtool} subst \
   391         -e 's;LM_ERR(\("unable to load\);LM_WARN(\1;g' \
   392         tls/tls_init.c
   393     %{l_shtool} subst \
   394         -e 's;^\(default_bits[ \t]*=[ \t]*\)2048;\14096;' \
   395         etc/tls/ca.conf
   396     %{l_shtool} subst \
   397         -e '1,2d' \
   398         etc/tls/README
   399     %{l_shtool} subst \
   400         -e 's;\(radiusclient\)-ng;\1;g' \
   401         -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
   402         radius.h
   404 %build
   405     #   select modules
   406     modslist='b2b_entities b2b_logic cpl-c db_http dialplan identity jabber perl perlvdb presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp regex rls tlsops xcap_client xmpp'
   407 %if "%{with_croute}" == "yes"
   408     modslist="$modslist carrierroute"
   409 %endif
   410 %if "%{with_json}" == "yes"
   411     modslist="$modslist json"
   412 %endif
   413 %if "%{with_ldap}" == "yes"
   414     modslist="$modslist h350 ldap"
   415 %endif
   416 %if "%{with_memcached}" == "yes"
   417     modslist="$modslist memcached"
   418 %endif
   419 %if "%{with_osp}" == "yes"
   420     modslist="$modslist osp"
   421 %endif
   422 %if "%{with_radius}" == "yes"
   423     modslist="$modslist aaa_radius auth_aaa group uri"
   424 %endif
   425 %if "%{with_snmp}" == "yes"
   426     modslist="$modslist snmpstats"
   427 %endif
   428 %if "%{with_bdb}" == "yes"
   429     modslist="$modslist db_berkeley"
   430 %endif
   431 %if "%{with_mysql}" == "yes"
   432     modslist="$modslist db_mysql"
   433 %endif
   434 %if "%{with_pgsql}" == "yes"
   435     modslist="$modslist db_postgres"
   436 %endif
   437 %if "%{with_odbc}" == "yes"
   438     modslist="$modslist db_unixodbc"
   439 %endif
   440 %if "%{with_geoip}" == "yes"
   441     modslist="$modslist mmgeoip"
   442 %endif
   444     #   build dependencies
   445     %{l_make} %{l_mflags} \
   446         CC="%{l_cc}" \
   447 %if "%{with_sctp}" == "yes"
   448         SCTP=1 \
   449 %endif
   450 %if "%{with_ssl}" == "yes"
   451         TLS=1 \
   452 %endif
   453         prefix=%{l_prefix} \
   454         dep >/dev/null 2>&1 || true
   456     #   build program
   457     %{l_make} %{l_mflags -O} \
   458         CC="%{l_cc}" \
   459 %if "%{with_sctp}" == "yes"
   460         SCTP=1 \
   461 %endif
   462 %if "%{with_ssl}" == "yes"
   463         TLS=1 \
   464 %endif
   465         prefix=%{l_prefix} \
   466         opensips
   468     #   build utilities
   469     %{l_make} %{l_mflags -O} \
   470         CC="%{l_cc}" \
   471 %if "%{with_sctp}" == "yes"
   472         SCTP=1 \
   473 %endif
   474 %if "%{with_ssl}" == "yes"
   475         TLS=1 \
   476 %endif
   477         prefix=%{l_prefix} \
   478         modules="$modslist" \
   479         utils
   481     #   build modules
   482     %{l_make} %{l_mflags -O} \
   483         CC="%{l_cc}" \
   484 %if "%{with_sctp}" == "yes"
   485         SCTP=1 \
   486 %endif
   487 %if "%{with_ssl}" == "yes"
   488         TLS=1 \
   489 %endif
   490         include_modules="$modslist" \
   491         skip_modules="" \
   492         prefix=%{l_prefix} \
   493         modules
   495     #   build rtpproxy extension
   496     ( cd rtpproxy-%{V_rtpproxy}
   497       export CC="%{l_cc}"
   498       export CFLAGS="%{l_cflags -O}"
   499       export LIBS=""
   500       case "%{l_platform -t}" in
   501           *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
   502       esac
   503       export GREP="grep"
   504       ./configure
   505       %{l_make} %{l_mflags -O}
   506     ) || exit $?
   508 %install
   509     #   clean build cruft
   510     rm -rf $RPM_BUILD_ROOT
   512     #   select modules
   513     modslist='b2b_entities b2b_logic cpl-c db_http identity jabber perl perlvdb presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp regex rls tlsops xcap_client xmpp'
   514 %if "%{with_croute}" == "yes"
   515     modslist="$modslist carrierroute"
   516 %endif
   517 %if "%{with_json}" == "yes"
   518     modslist="$modslist json"
   519 %endif
   520 %if "%{with_ldap}" == "yes"
   521     modslist="$modslist h350 ldap"
   522 %endif
   523 %if "%{with_memcached}" == "yes"
   524     modslist="$modslist memcached"
   525 %endif
   526 %if "%{with_osp}" == "yes"
   527     modslist="$modslist osp"
   528 %endif
   529 %if "%{with_radius}" == "yes"
   530     modslist="$modslist aaa_radius auth_aaa group uri"
   531 %endif
   532 %if "%{with_snmp}" == "yes"
   533     modslist="$modslist snmpstats"
   534 %endif
   535 %if "%{with_bdb}" == "yes"
   536     modslist="$modslist db_berkeley"
   537 %endif
   538 %if "%{with_mysql}" == "yes"
   539     modslist="$modslist db_mysql"
   540 %endif
   541 %if "%{with_pgsql}" == "yes"
   542     modslist="$modslist db_postgres"
   543 %endif
   544 %if "%{with_odbc}" == "yes"
   545     modslist="$modslist db_unixodbc"
   546 %endif
   547 %if "%{with_geoip}" == "yes"
   548     modslist="$modslist mmgeoip"
   549 %endif
   551     #   install program, utils, and modules
   552     %{l_make} %{l_mflags} \
   553         INSTALL="%{l_shtool} install%{l_nil} -c" \
   554         basedir=$RPM_BUILD_ROOT \
   555         prefix=%{l_prefix} \
   556         doc-dir=share/opensips/doc \
   557         man-dir=man \
   558         data-dir=share/opensips \
   559         include_modules="$modslist" \
   560         skip_modules="" \
   561         install
   563     #   install rtpproxy software
   564     %{l_shtool} install -c -s -m 755 \
   565         rtpproxy-%{V_rtpproxy}/rtpproxy \
   566         $RPM_BUILD_ROOT%{l_prefix}/sbin/rtpproxy
   568     #   strip down installation
   569     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   571     #   create installation hierarchy
   572     %{l_shtool} mkdir -f -p -m 700 \
   573         $RPM_BUILD_ROOT%{l_prefix}/var/opensips/acc \
   574         $RPM_BUILD_ROOT%{l_prefix}/var/opensips/tmp
   576     #   install default configuration
   577     %{l_shtool} mkdir -f -p -m 755 \
   578         $RPM_BUILD_ROOT%{l_prefix}/etc/opensips
   579     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   580         %{SOURCE opensips.cfg} \
   581         $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/
   583     #   conditionally remove osipsconsole resources
   584 %if "%{with_cons}" != "yes"
   585         rm $RPM_BUILD_ROOT%{l_prefix}/sbin/osipsconsole
   586         rm $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/osipsconsolerc
   587 %endif
   589     #   install OSSP fsl configuration
   590     %{l_shtool} mkdir -f -p -m 755 \
   591         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   592     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   593         %{SOURCE fsl.opensips} \
   594         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   596     #   install runcommand script
   597     %{l_shtool} mkdir -f -p -m 755 \
   598         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   599     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   600         %{SOURCE rc.opensips} \
   601         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   603     #   determine installation files
   604     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   605         %{l_files_std} \
   606         '%not %dir %{l_prefix}/etc/fsl' \
   607         '%config %{l_prefix}/etc/fsl/*' \
   608         '%config %{l_prefix}/etc/opensips/*' \
   609         '%doc %{l_prefix}/share/opensips/doc/*' \
   610         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/opensips'
   612 %files -f files
   614 %clean
   615     rm -rf $RPM_BUILD_ROOT
   617 %post
   618     #   on install, setup database (osipsconsole db create /pfx/var/opensips/db)
   619     if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then
   620         %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
   621             $RPM_INSTALL_PREFIX/var/opensips/db
   622         rm -f $RPM_INSTALL_PREFIX/share/opensips/dbtext/*.orig
   623         %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
   624             $RPM_INSTALL_PREFIX/share/opensips/dbtext/* \
   625             $RPM_INSTALL_PREFIX/var/opensips/db/
   626     fi
   628     #   after upgrade, restart service
   629     [ $1 -eq 2 ] || exit 0
   630     eval `%{l_rc} opensips status 2>/dev/null`
   631     [ ".$opensips_active" = .yes ] && %{l_rc} opensips restart
   632     exit 0
   634 %preun
   635     #   before erase, stop service and remove log files
   636     [ $1 -eq 0 ] || exit 0
   637     %{l_rc} opensips stop 2>/dev/null
   638     rm -rf $RPM_INSTALL_PREFIX/var/opensips/db 2>/dev/null || true
   639     rm -f  $RPM_INSTALL_PREFIX/var/opensips/*  2>/dev/null || true
   640     exit 0

mercurial