opensips/opensips.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 757
bb40ee892364
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 ##  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.8.2
    38 Release:      20120800
    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 BuildPreReq:  OpenPKG, openpkg >= 20100101, make, gcc, flex, bison, sed
    74 PreReq:       OpenPKG, openpkg >= 20100101, bash
    75 BuildPreReq:  libxml, expat, curl, ncurses, pkgconfig
    76 PreReq:       libxml, expat, curl, ncurses
    77 %if "%{with_cons}" == "yes"
    78 PreReq:       perl-dbi, perl-term
    79 %endif
    80 %if "%{with_fsl}" == "yes"
    81 BuildPreReq:  fsl
    82 PreReq:       fsl
    83 %endif
    84 %if "%{with_ssl}" == "yes"
    85 BuildPreReq:  openssl
    86 PreReq:       openssl
    87 %endif
    88 %if "%{with_croute}" == "yes"
    89 BuildPreReq:  confuse
    90 PreReq:       confuse
    91 %endif
    92 %if "%{with_json}" == "yes"
    93 BuildPreReq:  json
    94 PreReq:       json
    95 %endif
    96 %if "%{with_ldap}" == "yes"
    97 BuildPreReq:  openldap
    98 PreReq:       openldap
    99 %endif
   100 %if "%{with_memcached}" == "yes"
   101 BuildPreReq:  memcached
   102 PreReq:       memcached
   103 %endif
   104 %if "%{with_osp}" == "yes"
   105 BuildPreReq:  osptoolkit
   106 PreReq:       osptoolkit
   107 %endif
   108 %if "%{with_radius}" == "yes"
   109 BuildPreReq:  radiusclient
   110 PreReq:       radiusclient
   111 %endif
   112 %if "%{with_snmp}" == "yes"
   113 BuildPreReq:  snmp
   114 PreReq:       snmp
   115 %endif
   116 %if "%{with_bdb}" == "yes"
   117 BuildPreReq:  db
   118 PreReq:       db
   119 %endif
   120 %if "%{with_mysql}" == "yes"
   121 BuildPreReq:  mysql
   122 PreReq:       mysql, perl-dbi::with_mysql
   123 %endif
   124 %if "%{with_pgsql}" == "yes"
   125 BuildPreReq:  postgresql
   126 PreReq:       postgresql, perl-dbi::with_pgsql
   127 %endif
   128 %if "%{with_odbc}" == "yes"
   129 BuildPreReq:  unixodbc
   130 PreReq:       unixodbc, perl-dbi::with_odbc
   131 %endif
   132 %if "%{with_geoip}" == "yes"
   133 BuildPreReq:  geoip
   134 PreReq:       geoip
   135 %endif
   137 %description
   138     OpenSIPS is (beside Kamailio) 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     The third party Sippy RTPproxy from http://www.rtpproxy.org/
   146     is included to make communication between SIP user agents
   147     behind NATs (Network Address Translators) possible.
   149     OpenSIPS can be used as a:      OpenSIPS fits in scenarios:
   151     Registrar server                SIP trunking
   152     Router, proxy                   SIP load balancing
   153     Redirect server                 SIP front end termination
   154     Presence agent                  Residential providers
   155     Back to back user agent         white label solutions
   156     Instant messaging server        Enterprise services
   157     SIP to SMS gateway              LCR for multi gateways
   158     SIP to XMPP gateway
   159     Load balancer or dispatcher
   160     Front end for asterisk
   161     NAT traversal unit
   162     Application server
   164 %track
   165     prog opensips = {
   166         version   = %{version}
   167         url       = http://www.opensips.org/pub/opensips/
   168         regex     = (\d+\.\d+\.\d+)/
   169         url       = http://www.opensips.org/pub/opensips/__NEWVER__/src/
   170         regex     = opensips-(__VER__)_src\.tar\.gz
   171     }
   172     prog opensips:rtpproxy = {
   173         version   = %{V_rtpproxy}
   174         url       = http://www.rtpproxy.org/
   175         regex     = rtpproxy-(\d+(?:\.\d+)+)\.tar\.gz
   176     }
   178 %prep
   179     %setup -q -n opensips-%{version}-tls
   180     %setup -q -n opensips-%{version}-tls -T -D -a 1
   181     %patch -p0
   182     %patch -p0 -P 1
   183     %patch -p0 -P 2
   184     %patch -p0 -P 3
   185     %patch -p0 -P 4
   186     ( cd rtpproxy-%{V_rtpproxy}
   187       %patch -p0 -P 5
   188     ) || exit $?
   189     %{l_shtool} subst %{l_value -s -a} \
   190         scripts/opensipsctlrc \
   191         scripts/osipsconsolerc
   192     %{l_shtool} subst \
   193         -e 's;^#! */bin/sh;#! %{l_prefix}/bin/bash;' \
   194         scripts/opensipsctl
   195     %{l_shtool} subst \
   196         -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \
   197         modules/seas/doc/xml2sgml.sh \
   198         scripts/opensipsdbctl \
   199         test/*.sh
   200     %{l_shtool} subst \
   201 %if "%{with_dbgmem}" == "yes"
   202         -e 's;\(-DF_MALLOC\);#\1;' \
   203         -e 's;#\(-DDBG_QM_MALLOC\);\1;' \
   204 %endif
   205         -e 's;\(#define PKG_MEM_SIZE\) 2;\1 4;' \
   206         config.h
   207     %{l_shtool} subst \
   208 %if "%{with_fsl}" == "yes"
   209         -e 's;@fslldflags@;-L$(prefix)/lib;g' \
   210         -e 's;@fsllibs@;-lfsl;g' \
   211 %else
   212         -e 's;@fslldflags@;;g' \
   213         -e 's;@fsllibs@;;g' \
   214 %endif
   215         -e 's;^\(DEFS+= -I\)\$(LOCALBASE).*;\1$(prefix)/include;' \
   216         -e 's;^\(DEFS+= -L\)\$(LOCALBASE).*;\1$(prefix)/lib -lssl -lcrypto;' \
   217         -e 's;^SVNVERSION *=.*;;g' \
   218         -e 's;^DBHTML2TXT *=.*;;g' \
   219         -e 's;^DBXML2PDF *=.*;;g' \
   220         -e 's;lib64;lib;' \
   221         Makefile.defs
   222     %{l_shtool} subst \
   223         -e 's;\(radiusclient\)-ng;\1;g' \
   224         modules/aaa_radius/aaa_radius.c \
   225         modules/aaa_radius/rad.c \
   226         Makefile.defs
   227     %{l_shtool} subst \
   228         -e 's;\(\$(data-dir)\)/\(dbtext\)/opensips;\1/\2;g' \
   229         -e 's;\(\$(data-dir)\)/\(db_berkeley\)/opensips;\1/\2;g' \
   230         -e 's;\(/usr/local/etc/opensips\);\1/*;g' \
   231         -e 's;\(s#/usr/local/sbin\)#;\1/*#;g' \
   232         -e 's;\(s#/usr/share/doc/$(NAME)/#$(doc-target)\)#;\1/#;g' \
   233         -e 's;\(\$(MAKE).*\) \(install_module_custom\);\1 makefile_defs=0 \2;' \
   234         -e 's#\(cd menuconfig;\)\$(MAKE) proper;#\1 CC="%{l_cc}" CPPFLAGS="%{l_cppflags ncurses}" LDFLAGS="%{l_ldflags}" LIBS="-lncurses" #' \
   235         Makefile
   236     %{l_shtool} subst \
   237         -e 's;^\(LIBS=\).*;\1-L`%{l_prefix}/bin/pkg-config --libs db`;' \
   238         utils/db_berkeley/Makefile
   239     %{l_shtool} subst \
   240         -e 's;/usr/share/doc/opensips/AUTHORS;%{l_prefix}/share/opensips/doc/AUTHORS;' \
   241         scripts/opensipsctl.8
   242     %{l_shtool} subst \
   243         -e 's;\(ETCDIR=".*\)/"$;\1";' \
   244         -e 's;\(ETCDIR="\)/usr/local/\(etc/opensips"\);\1%{l_prefix}/\2;' \
   245         -e 's;\. /etc/opensips/opensipsctlrc;true;' \
   246         -e 's;\. ~/.opensipsctlrc;true;' \
   247         -e 's;/usr/local\(/lib/opensips/opensipsctl\);%{l_prefix}\1;' \
   248         -e 's;/usr/local/\(etc/opensips/opensipsctlrc\);%{l_prefix}/\1;' \
   249         -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
   250         scripts/opensipsdbctl \
   251         scripts/opensipsctl
   252     %{l_shtool} subst \
   253         -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;g' \
   254         -e 's;\(my \$fifo_reply_path\) = "/tmp/";\1 = "%{l_prefix}/var/opensips/";' \
   255         -e 's;\(my \$HISTORY_FILE\) = "/tmp/osipsconsole_history";\1 = "%{l_prefix}/var/opensips/osipsconsole_history";' \
   256         scripts/opensipsctl \
   257         scripts/osipsconsole
   258     %{l_shtool} subst \
   259         -e 's;/usr/local;;g' \
   260         -e 's;\(/etc/opensips/\)\.\(opensipsctlrc\);%{l_prefix}\1\2;g' \
   261         scripts/opensipsctl.8
   262     %{l_shtool} subst \
   263         -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;' \
   264         scripts/opensipsctl.base
   265     %{l_shtool} subst \
   266         -e 's;\(path=\)\$CHROOT_DIR/tmp/\(\$name\);\1${OSER_FIRET}/\2;g' \
   267         scripts/opensipsctl.fifo
   268     %{l_shtool} subst \
   269         -e 's;/usr/local/share/opensips/dbtext/opensips;%{l_prefix}/var/opensips/db;' \
   270         scripts/opensipsctl.dbtext
   271     %{l_shtool} subst \
   272         -e 's;\(DB_PATH="\)[^"][^"]*;%{l_prefix}/var/opensips/db_berkeley;' \
   273         scripts/opensipsctl.db_berkeley
   274     %{l_shtool} subst \
   275         -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
   276         scripts/opensipsctl \
   277         scripts/opensipsdbctl.base
   278     %{l_shtool} subst \
   279         -e 's;/usr/local/etc/opensips/dbtext;%{l_prefix}/var/opensips/db;' \
   280         -e 's;\(\$DATA_DIR/dbtext\)/opensips;\1;g' \
   281         scripts/opensipsdbctl.dbtext
   282     %{l_shtool} subst \
   283         -e 's;\(DATA_DIR="\)[^"][^"]*;\1%{l_prefix}/share/opensips;' \
   284         scripts/opensipsdbctl.dbtext \
   285         scripts/opensipsdbctl.oracle
   286     %{l_shtool} subst \
   287         -e 's;/usr/local/etc/opensips/db_berkeley;%{l_prefix}/var/opensips/db_berkeley;' \
   288         -e 's;/usr/local/BerkeleyDB.[^/][^/]*/bin;%{l_prefix}/bin;' \
   289         scripts/opensipsdbctl.db_berkeley
   290     %{l_shtool} subst \
   291         -e 's;/usr/local/\(share/opensips\);%{l_prefix}/\1;' \
   292         scripts/opensipsdbctl.db_berkeley \
   293         scripts/opensipsdbctl.mysql \
   294         scripts/opensipsdbctl.pgsql
   295     %{l_shtool} subst \
   296         -e 's;\(script_flags(int\));\1,null);' \
   297         scripts/dbtext/opensips/dialog
   298     %{l_shtool} subst \
   299         -e 's;body(string);body(blob);' \
   300         -e 's;sender(string);sender(string,null);' \
   301         scripts/dbtext/opensips/presentity
   302     %{l_shtool} subst \
   303         -e 's;\(expires(int\));\1,null);' \
   304         -e 's;\(desired_expires(int\));\1,null);' \
   305         -e 's;\(contact(string\));\1,null);' \
   306         -e 's;\(remote_contact(string\));\1,null);' \
   307         -e 's;\(version(int\));\1,null);' \
   308         -e 's;\(extra_headers(string\));\1,null);' \
   309         scripts/dbtext/opensips/pua
   310     %{l_shtool} subst \
   311         -e 's;\(reason(string\));\1,null);' \
   312         scripts/dbtext/opensips/active_watchers \
   313         scripts/dbtext/opensips/rls_watchers
   314     %{l_shtool} subst \
   315         -e 's;#! */usr/bin/python;#! %{l_prefix}/bin/python;' \
   316         scripts/dbtextdb/*.py
   317     %{l_shtool} subst \
   318         -e 's;#! */usr/bin/perl;#! %{l_prefix}/bin/perl;' \
   319         -e 's;^\(my \$PATH_BIN =\) "./";\1 "%{l_prefix}/bin/";' \
   320         -e 's;^\(my \$PATH_CTLRC =\) "./scripts/";\1 "%{l_prefix}/etc/opensips/";' \
   321         -e 's;^\(my \$PATH_ETC =\) "/usr/local/etc";\1 "%{l_prefix}/etc";' \
   322         -e 's;^\(my \$PATH_LIBS =\) "/usr/local/lib";\1 "%{l_prefix}/lib";' \
   323         -e 's;^\(my \$PATH_SHARE =\) "/usr/local/share";\1 "%{l_prefix}/share";' \
   324         -e 's;^\(my $path = \)"/tmp/";\1"%{l_prefix}/var/opensips/";' \
   325         scripts/osipsconsole
   326     %{l_shtool} subst \
   327         -e 's;if ( -x "/usr/bin/";if ( -x "%{l_prefix}/bin";' \
   328         -e 's;if \[ -x "/usr/bin/\$1" \];if [ -x "%{l_prefix}/bin/$1" ];' \
   329         -e 's;\$TOOLPATH = "/usr/bin/";$TOOLPATH = "%{l_prefix}/bin/";' \
   330         -e 's;TOOLPATH="/usr/bin/\$1";TOOLPATH="%{l_prefix}/bin/$1";' \
   331         -e 's;if ( -x "/bin/";if ( -x "/usr/bin/";' \
   332         -e 's;if \[ -x "/bin/\$1" \];if [ -x "/usr/bin/$1" ];' \
   333         -e 's;\$TOOLPATH = "/bin/";$TOOLPATH = "/usr/bin/";' \
   334         -e 's;TOOLPATH="/bin/\$1";TOOLPATH="/usr/bin/$1";' \
   335         -e 's;if ( -x "/usr/local/bin/\$1";if ( -x "/bin/$1";' \
   336         -e 's;if \[ -x "/usr/local/bin/\$1" \];if [ -x "/bin/$1" ];' \
   337         -e 's;\$TOOLPATH = "/usr/local/bin/;$TOOLPATH = "/bin/;' \
   338         -e 's;TOOLPATH="/usr/local/bin/\$1";TOOLPATH="/bin/$1";' \
   339         scripts/osipsconsole \
   340         scripts/opensipsctl.base
   341     %{l_shtool} subst \
   342         -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
   343         -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libcurl libxml-2.0`;g" \
   344         -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libcurl libxml-2.0`;" \
   345         modules/xcap_client/Makefile
   346     %{l_shtool} subst \
   347         -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
   348         -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libxml-2.0`;g" \
   349         -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libxml-2.0`;" \
   350         modules/cpl-c/Makefile \
   351         modules/presence/Makefile \
   352         modules/presence_dialoginfo/Makefile \
   353         modules/presence_xml/Makefile \
   354         modules/pua/Makefile \
   355         modules/pua_bla/Makefile \
   356         modules/pua_dialoginfo/Makefile \
   357         modules/pua_mi/Makefile \
   358         modules/pua_usrloc/Makefile \
   359         modules/pua_xmpp/Makefile \
   360         modules/b2b_logic/Makefile \
   361         modules/rls/Makefile
   362     %{l_shtool} subst \
   363         -e 's;^\(DEFS+= *\);\1-D__EXTENSIONS__ ;' \
   364         modules/presence_xml/Makefile
   365     %{l_shtool} subst \
   366         -e 's;^\(DEFS+=\).*;\1`%{l_prefix}/bin/pkg-config --cflags-only-I libconfuse`;' \
   367         -e 's;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libconfuse`;' \
   368         modules/carrierroute/Makefile
   369     %{l_shtool} subst \
   370         -e 's;\(LIBS = .*-L\$(shell pg_config --libdir) -lpq\);\1 $(shell pg_config --libs);' \
   371         modules/db_postgres/Makefile
   372     %{l_shtool} subst \
   373         -e 's;-I\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/include[\t ]*;;' \
   374         -e 's;-L\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/lib[\t ]*;;' \
   375         modules/db_berkeley/Makefile \
   376         utils/db_berkeley/Makefile
   377     %{l_shtool} subst \
   378         -e 's;\(\$(cfg-prefix)\)\$(shell net-snmp-config --prefix);\1;' \
   379         modules/snmpstats/Makefile
   380     %{l_shtool} subst \
   381         -e 's;LM_WARN(\(\"uac does not spread across\);LM_NOTICE(\1;' \
   382         modules/tm/uac.c
   383     %{l_shtool} subst \
   384         -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
   385         modules/db_berkeley/db_berkeley.c \
   386         modules/db_berkeley/bdb_lib.h \
   387         modules/sipcapture/sipcapture.h \
   388         modules/lua/sipwatch.h \
   389         modules/lua/crc32.h
   390     #   redundant since OpenSIPS commit #9666 (ab 1.9.*)
   391     %{l_shtool} subst \
   392         -e 's/\(LM_ERR("\)\(failed to retrieve SO_ERROR (%d) %s\\n",\)/char erraddrstr[INET6_ADDRSTRLEN]; \1addr (%s) port (%d), \2 servaddr->sa_family == AF_INET ? inet_ntoa(((struct sockaddr_in *)servaddr)->sin_addr) : inet_ntop(AF_INET6, \&((struct sockaddr_in6 *)servaddr)->sin6_addr, erraddrstr, sizeof(erraddrstr)), servaddr->sa_family == AF_INET ? ntohs(((struct sockaddr_in *)servaddr)->sin_port) : ntohs(((struct sockaddr_in6 *)servaddr)->sin6_port),/' \
   393         tcp_main.c
   394     %{l_shtool} subst \
   395         -e 's;\(sock_info->socket = socket(AF2PF(addr->s.sa_family), SOCK_SEQPACKET,\) 0;\1 IPPROTO_SCTP;' \
   396         sctp_server.c
   397     %{l_shtool} subst \
   398         -e 's;LM_ERR(\("unable to load\);LM_WARN(\1;g' \
   399         tls/tls_init.c
   400     %{l_shtool} subst \
   401         -e 's;^\(default_bits[ \t]*=[ \t]*\)2048;\14096;' \
   402         etc/tls/ca.conf
   403     %{l_shtool} subst \
   404         -e '1,2d' \
   405         etc/tls/README
   406     %{l_shtool} subst \
   407         -e 's;\(radiusclient\)-ng;\1;g' \
   408         -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
   409         radius.h
   411 %build
   412     #   select modules
   413     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'
   414 %if "%{with_croute}" == "yes"
   415     modslist="$modslist carrierroute"
   416 %endif
   417 %if "%{with_json}" == "yes"
   418     modslist="$modslist json"
   419 %endif
   420 %if "%{with_ldap}" == "yes"
   421     modslist="$modslist h350 ldap"
   422 %endif
   423 %if "%{with_memcached}" == "yes"
   424     modslist="$modslist memcached"
   425 %endif
   426 %if "%{with_osp}" == "yes"
   427     modslist="$modslist osp"
   428 %endif
   429 %if "%{with_radius}" == "yes"
   430     modslist="$modslist aaa_radius auth_aaa group uri"
   431 %endif
   432 %if "%{with_snmp}" == "yes"
   433     modslist="$modslist snmpstats"
   434 %endif
   435 %if "%{with_bdb}" == "yes"
   436     modslist="$modslist db_berkeley"
   437 %endif
   438 %if "%{with_mysql}" == "yes"
   439     modslist="$modslist db_mysql"
   440 %endif
   441 %if "%{with_pgsql}" == "yes"
   442     modslist="$modslist db_postgres"
   443 %endif
   444 %if "%{with_odbc}" == "yes"
   445     modslist="$modslist db_unixodbc"
   446 %endif
   447 %if "%{with_geoip}" == "yes"
   448     modslist="$modslist mmgeoip"
   449 %endif
   451     #   build dependencies
   452     %{l_make} %{l_mflags} \
   453         CC="%{l_cc}" \
   454 %if "%{with_sctp}" == "yes"
   455         SCTP=1 \
   456 %endif
   457 %if "%{with_ssl}" == "yes"
   458         TLS=1 \
   459 %endif
   460         prefix=%{l_prefix} \
   461         dep >/dev/null 2>&1 || true
   463     #   build program
   464     %{l_make} %{l_mflags -O} \
   465         CC="%{l_cc}" \
   466 %if "%{with_sctp}" == "yes"
   467         SCTP=1 \
   468 %endif
   469 %if "%{with_ssl}" == "yes"
   470         TLS=1 \
   471 %endif
   472         prefix=%{l_prefix} \
   473         opensips
   475     #   build utilities
   476     %{l_make} %{l_mflags -O} \
   477         CC="%{l_cc}" \
   478 %if "%{with_sctp}" == "yes"
   479         SCTP=1 \
   480 %endif
   481 %if "%{with_ssl}" == "yes"
   482         TLS=1 \
   483 %endif
   484         prefix=%{l_prefix} \
   485         modules="$modslist" \
   486         utils
   488     #   build modules
   489     %{l_make} %{l_mflags -O} \
   490         CC="%{l_cc}" \
   491 %if "%{with_sctp}" == "yes"
   492         SCTP=1 \
   493 %endif
   494 %if "%{with_ssl}" == "yes"
   495         TLS=1 \
   496 %endif
   497         include_modules="$modslist" \
   498         skip_modules="" \
   499         prefix=%{l_prefix} \
   500         modules
   502     #   build menuconfig
   503     %{l_make} %{l_mflags} \
   504         prefix=%{l_prefix} \
   505         cfg-prefix=$RPM_BUILD_ROOT%{l_prefix}/etc \
   506         data-prefix=$RPM_BUILD_ROOT%{l_prefix}/share \
   507         opensipsmc
   509     #   build rtpproxy extension
   510     ( cd rtpproxy-%{V_rtpproxy}
   511       export CC="%{l_cc}"
   512       export CFLAGS="%{l_cflags -O}"
   513       export CPPFLAGS=""
   514       case "%{l_platform -t}" in
   515           *-sunos5.11 ) CPPFLAGS="$CPPFLAGS -DGE_SOL11" ;;
   516       esac
   517       export LIBS=""
   518       case "%{l_platform -t}" in
   519           *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
   520       esac
   521       export GREP="grep"
   522       ./configure
   523       %{l_make} %{l_mflags -O}
   524     ) || exit $?
   526 %install
   527     #   select modules
   528     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'
   529 %if "%{with_croute}" == "yes"
   530     modslist="$modslist carrierroute"
   531 %endif
   532 %if "%{with_json}" == "yes"
   533     modslist="$modslist json"
   534 %endif
   535 %if "%{with_ldap}" == "yes"
   536     modslist="$modslist h350 ldap"
   537 %endif
   538 %if "%{with_memcached}" == "yes"
   539     modslist="$modslist memcached"
   540 %endif
   541 %if "%{with_osp}" == "yes"
   542     modslist="$modslist osp"
   543 %endif
   544 %if "%{with_radius}" == "yes"
   545     modslist="$modslist aaa_radius auth_aaa group uri"
   546 %endif
   547 %if "%{with_snmp}" == "yes"
   548     modslist="$modslist snmpstats"
   549 %endif
   550 %if "%{with_bdb}" == "yes"
   551     modslist="$modslist db_berkeley"
   552 %endif
   553 %if "%{with_mysql}" == "yes"
   554     modslist="$modslist db_mysql"
   555 %endif
   556 %if "%{with_pgsql}" == "yes"
   557     modslist="$modslist db_postgres"
   558 %endif
   559 %if "%{with_odbc}" == "yes"
   560     modslist="$modslist db_unixodbc"
   561 %endif
   562 %if "%{with_geoip}" == "yes"
   563     modslist="$modslist mmgeoip"
   564 %endif
   566     #   install program, utils, and modules
   567     %{l_make} %{l_mflags} \
   568         INSTALL="%{l_shtool} install%{l_nil} -c" \
   569         basedir=$RPM_BUILD_ROOT \
   570         prefix=%{l_prefix} \
   571         doc-dir=share/opensips/doc \
   572         man-dir=man \
   573         data-dir=share/opensips \
   574         include_modules="$modslist" \
   575         skip_modules="" \
   576         install
   578     #   install rtpproxy software
   579     %{l_shtool} install -c -s -m 755 \
   580         rtpproxy-%{V_rtpproxy}/rtpproxy \
   581         $RPM_BUILD_ROOT%{l_prefix}/sbin/rtpproxy
   583     #   strip down installation
   584     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   586     #   create installation hierarchy
   587     %{l_shtool} mkdir -f -p -m 700 \
   588         $RPM_BUILD_ROOT%{l_prefix}/var/opensips/acc \
   589         $RPM_BUILD_ROOT%{l_prefix}/var/opensips/tmp
   591     #   install default configuration
   592     %{l_shtool} mkdir -f -p -m 755 \
   593         $RPM_BUILD_ROOT%{l_prefix}/etc/opensips
   594     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   595         %{SOURCE opensips.cfg} \
   596         $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/
   598     #   conditionally remove osipsconsole resources
   599 %if "%{with_cons}" != "yes"
   600         rm $RPM_BUILD_ROOT%{l_prefix}/sbin/osipsconsole
   601         rm $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/osipsconsolerc
   602 %endif
   604     #   install OSSP fsl configuration
   605     %{l_shtool} mkdir -f -p -m 755 \
   606         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   607     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   608         %{SOURCE fsl.opensips} \
   609         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   611     #   install runcommand script
   612     %{l_shtool} mkdir -f -p -m 755 \
   613         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   614     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   615         %{SOURCE rc.opensips} \
   616         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   618     #   determine installation files
   619     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   620         %{l_files_std} \
   621         '%not %dir %{l_prefix}/etc/fsl' \
   622         '%config %{l_prefix}/etc/fsl/*' \
   623         '%config %{l_prefix}/etc/opensips/*' \
   624         '%doc %{l_prefix}/share/opensips/doc/*' \
   625         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/opensips'
   627 %files -f files
   629 %clean
   631 %post
   632     #   on install, setup database (osipsconsole db create /pfx/var/opensips/db)
   633     if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then
   634         %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
   635             $RPM_INSTALL_PREFIX/var/opensips/db
   636         rm -f $RPM_INSTALL_PREFIX/share/opensips/dbtext/*.orig
   637         %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
   638             $RPM_INSTALL_PREFIX/share/opensips/dbtext/* \
   639             $RPM_INSTALL_PREFIX/var/opensips/db/
   640     fi
   642     #   after upgrade, restart service
   643     [ $1 -eq 2 ] || exit 0
   644     eval `%{l_rc} opensips status 2>/dev/null`
   645     [ ".$opensips_active" = .yes ] && %{l_rc} opensips restart
   646     exit 0
   648 %preun
   649     #   before erase, stop service and remove log files
   650     [ $1 -eq 0 ] || exit 0
   651     %{l_rc} opensips stop 2>/dev/null
   652     rm -rf $RPM_INSTALL_PREFIX/var/opensips/db 2>/dev/null || true
   653     rm -f  $RPM_INSTALL_PREFIX/var/opensips/*  2>/dev/null || true
   654     exit 0

mercurial