michael@376: ## michael@376: ## opensips.spec -- OpenPKG RPM Package Specification michael@377: ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. michael@376: ## michael@376: ## Permission to use, copy, modify, and distribute this software for michael@376: ## any purpose with or without fee is hereby granted, provided that michael@376: ## the above copyright notice and this permission notice appear in all michael@376: ## copies. michael@376: ## michael@376: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@376: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@376: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@376: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@376: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@376: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@376: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@376: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@376: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@376: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@376: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@376: ## SUCH DAMAGE. michael@376: ## michael@376: michael@376: # package options michael@376: %define V_rtpproxy 1.2.1 michael@376: michael@376: # package information michael@376: Name: opensips michael@377: Summary: Open SIP Router michael@376: URL: http://www.opensips.org/ michael@377: Vendor: Voice System SRL michael@376: Packager: OpenPKG Foundation e.V. michael@376: Distribution: OpenPKG Community michael@376: Class: PLUS michael@376: Group: VoIP michael@376: License: GPL michael@757: Version: 1.8.2 michael@547: Release: 20120800 michael@376: michael@376: # package options michael@377: %option with_cons yes michael@377: %option with_fsl yes michael@377: %option with_ssl yes michael@377: %option with_sctp no michael@377: %option with_json no michael@377: %option with_croute no michael@377: %option with_ldap no michael@377: %option with_memcached no michael@377: %option with_radius no michael@377: %option with_snmp no michael@377: %option with_bdb no michael@377: %option with_mysql no michael@377: %option with_osp no michael@377: %option with_pgsql no michael@377: %option with_odbc no michael@377: %option with_geoip no michael@377: %option with_dbgmem no michael@376: michael@376: # list of sources michael@397: Source0: http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{version}_src.tar.gz michael@377: Source1: http://www.b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz michael@376: Source2: rc.opensips michael@376: Source3: fsl.opensips michael@376: Source4: opensips.cfg michael@376: Patch0: opensips.patch michael@410: Patch1: opensips.patch.ctlrc michael@410: Patch2: opensips.patch.dict michael@410: Patch3: opensips.patch.uac michael@410: Patch4: opensips.patch.reg michael@410: Patch5: opensips.patch.rtpproxy michael@376: michael@376: # build information michael@547: BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, flex, bison, sed michael@547: PreReq: OpenPKG, openpkg >= 20100101, bash michael@547: BuildPreReq: libxml, expat, curl, ncurses, pkgconfig michael@547: PreReq: libxml, expat, curl, ncurses michael@377: %if "%{with_cons}" == "yes" michael@377: PreReq: perl-dbi, perl-term michael@377: %endif michael@376: %if "%{with_fsl}" == "yes" michael@376: BuildPreReq: fsl michael@376: PreReq: fsl michael@376: %endif michael@376: %if "%{with_ssl}" == "yes" michael@376: BuildPreReq: openssl michael@376: PreReq: openssl michael@376: %endif michael@377: %if "%{with_croute}" == "yes" michael@377: BuildPreReq: confuse michael@377: PreReq: confuse michael@377: %endif michael@377: %if "%{with_json}" == "yes" michael@377: BuildPreReq: json michael@377: PreReq: json michael@377: %endif michael@377: %if "%{with_ldap}" == "yes" michael@377: BuildPreReq: openldap michael@377: PreReq: openldap michael@377: %endif michael@377: %if "%{with_memcached}" == "yes" michael@377: BuildPreReq: memcached michael@377: PreReq: memcached michael@377: %endif michael@377: %if "%{with_osp}" == "yes" michael@377: BuildPreReq: osptoolkit michael@377: PreReq: osptoolkit michael@377: %endif michael@377: %if "%{with_radius}" == "yes" michael@377: BuildPreReq: radiusclient michael@377: PreReq: radiusclient michael@377: %endif michael@377: %if "%{with_snmp}" == "yes" michael@377: BuildPreReq: snmp michael@377: PreReq: snmp michael@377: %endif michael@377: %if "%{with_bdb}" == "yes" michael@377: BuildPreReq: db michael@377: PreReq: db michael@377: %endif michael@377: %if "%{with_mysql}" == "yes" michael@377: BuildPreReq: mysql michael@707: PreReq: mysql, perl-dbi::with_mysql michael@377: %endif michael@377: %if "%{with_pgsql}" == "yes" michael@377: BuildPreReq: postgresql michael@707: PreReq: postgresql, perl-dbi::with_pgsql michael@377: %endif michael@377: %if "%{with_odbc}" == "yes" michael@377: BuildPreReq: unixodbc michael@707: PreReq: unixodbc, perl-dbi::with_odbc michael@377: %endif michael@377: %if "%{with_geoip}" == "yes" michael@377: BuildPreReq: geoip michael@377: PreReq: geoip michael@377: %endif michael@376: michael@376: %description michael@376: OpenSIPS is (beside Kamailio) a successor to OpenSER, which in michael@377: turn was spawned from FhG FOKUS's SIP Express Router (SER). It michael@376: provides SIP (RFC3621) registrar, proxy and routing functionality. michael@377: A C shell like scripting language provides for control over the michael@377: server's behaviour. It's modular architecture allows for fine michael@377: grained loading of required functionality. michael@377: michael@377: The third party Sippy RTPproxy from http://www.rtpproxy.org/ michael@377: is included to make communication between SIP user agents michael@377: behind NATs (Network Address Translators) possible. michael@377: michael@377: OpenSIPS can be used as a: OpenSIPS fits in scenarios: michael@377: michael@377: Registrar server SIP trunking michael@377: Router, proxy SIP load balancing michael@377: Redirect server SIP front end termination michael@377: Presence agent Residential providers michael@377: Back to back user agent white label solutions michael@377: Instant messaging server Enterprise services michael@377: SIP to SMS gateway LCR for multi gateways michael@377: SIP to XMPP gateway michael@377: Load balancer or dispatcher michael@377: Front end for asterisk michael@377: NAT traversal unit michael@377: Application server michael@376: michael@376: %track michael@376: prog opensips = { michael@397: version = %{version} michael@376: url = http://www.opensips.org/pub/opensips/ michael@376: regex = (\d+\.\d+\.\d+)/ michael@376: url = http://www.opensips.org/pub/opensips/__NEWVER__/src/ michael@397: regex = opensips-(__VER__)_src\.tar\.gz michael@376: } michael@376: prog opensips:rtpproxy = { michael@376: version = %{V_rtpproxy} michael@376: url = http://www.rtpproxy.org/ michael@376: regex = rtpproxy-(\d+(?:\.\d+)+)\.tar\.gz michael@376: } michael@376: michael@376: %prep michael@397: %setup -q -n opensips-%{version}-tls michael@397: %setup -q -n opensips-%{version}-tls -T -D -a 1 michael@376: %patch -p0 michael@377: %patch -p0 -P 1 michael@377: %patch -p0 -P 2 michael@377: %patch -p0 -P 3 michael@410: %patch -p0 -P 4 michael@377: ( cd rtpproxy-%{V_rtpproxy} michael@410: %patch -p0 -P 5 michael@377: ) || exit $? michael@412: %{l_shtool} subst %{l_value -s -a} \ michael@412: scripts/opensipsctlrc \ michael@412: scripts/osipsconsolerc michael@377: %{l_shtool} subst \ michael@377: -e 's;^#! */bin/sh;#! %{l_prefix}/bin/bash;' \ michael@377: scripts/opensipsctl michael@377: %{l_shtool} subst \ michael@377: -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \ michael@377: modules/seas/doc/xml2sgml.sh \ michael@377: scripts/opensipsdbctl \ michael@410: test/*.sh michael@377: %{l_shtool} subst \ michael@377: %if "%{with_dbgmem}" == "yes" michael@377: -e 's;\(-DF_MALLOC\);#\1;' \ michael@377: -e 's;#\(-DDBG_QM_MALLOC\);\1;' \ michael@377: %endif michael@547: -e 's;\(#define PKG_MEM_SIZE\) 2;\1 4;' \ michael@377: config.h michael@377: %{l_shtool} subst \ michael@377: %if "%{with_fsl}" == "yes" michael@377: -e 's;@fslldflags@;-L$(prefix)/lib;g' \ michael@377: -e 's;@fsllibs@;-lfsl;g' \ michael@377: %else michael@377: -e 's;@fslldflags@;;g' \ michael@377: -e 's;@fsllibs@;;g' \ michael@377: %endif michael@377: -e 's;^\(DEFS+= -I\)\$(LOCALBASE).*;\1$(prefix)/include;' \ michael@377: -e 's;^\(DEFS+= -L\)\$(LOCALBASE).*;\1$(prefix)/lib -lssl -lcrypto;' \ michael@377: -e 's;^SVNVERSION *=.*;;g' \ michael@377: -e 's;^DBHTML2TXT *=.*;;g' \ michael@377: -e 's;^DBXML2PDF *=.*;;g' \ michael@377: -e 's;lib64;lib;' \ michael@377: Makefile.defs michael@377: %{l_shtool} subst \ michael@377: -e 's;\(radiusclient\)-ng;\1;g' \ michael@377: modules/aaa_radius/aaa_radius.c \ michael@377: modules/aaa_radius/rad.c \ michael@377: Makefile.defs michael@377: %{l_shtool} subst \ michael@377: -e 's;\(\$(data-dir)\)/\(dbtext\)/opensips;\1/\2;g' \ michael@377: -e 's;\(\$(data-dir)\)/\(db_berkeley\)/opensips;\1/\2;g' \ michael@377: -e 's;\(/usr/local/etc/opensips\);\1/*;g' \ michael@377: -e 's;\(s#/usr/local/sbin\)#;\1/*#;g' \ michael@377: -e 's;\(s#/usr/share/doc/$(NAME)/#$(doc-target)\)#;\1/#;g' \ michael@377: -e 's;\(\$(MAKE).*\) \(install_module_custom\);\1 makefile_defs=0 \2;' \ michael@547: -e 's#\(cd menuconfig;\)\$(MAKE) proper;#\1 CC="%{l_cc}" CPPFLAGS="%{l_cppflags ncurses}" LDFLAGS="%{l_ldflags}" LIBS="-lncurses" #' \ michael@377: Makefile michael@377: %{l_shtool} subst \ michael@377: -e 's;^\(LIBS=\).*;\1-L`%{l_prefix}/bin/pkg-config --libs db`;' \ michael@377: utils/db_berkeley/Makefile michael@377: %{l_shtool} subst \ michael@377: -e 's;/usr/share/doc/opensips/AUTHORS;%{l_prefix}/share/opensips/doc/AUTHORS;' \ michael@377: scripts/opensipsctl.8 michael@377: %{l_shtool} subst \ michael@377: -e 's;\(ETCDIR=".*\)/"$;\1";' \ michael@377: -e 's;\(ETCDIR="\)/usr/local/\(etc/opensips"\);\1%{l_prefix}/\2;' \ michael@377: -e 's;\. /etc/opensips/opensipsctlrc;true;' \ michael@377: -e 's;\. ~/.opensipsctlrc;true;' \ michael@377: -e 's;/usr/local\(/lib/opensips/opensipsctl\);%{l_prefix}\1;' \ michael@377: -e 's;/usr/local/\(etc/opensips/opensipsctlrc\);%{l_prefix}/\1;' \ michael@377: -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \ michael@377: scripts/opensipsdbctl \ michael@377: scripts/opensipsctl michael@377: %{l_shtool} subst \ michael@377: -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;g' \ michael@377: -e 's;\(my \$fifo_reply_path\) = "/tmp/";\1 = "%{l_prefix}/var/opensips/";' \ michael@377: -e 's;\(my \$HISTORY_FILE\) = "/tmp/osipsconsole_history";\1 = "%{l_prefix}/var/opensips/osipsconsole_history";' \ michael@377: scripts/opensipsctl \ michael@547: scripts/osipsconsole michael@377: %{l_shtool} subst \ michael@377: -e 's;/usr/local;;g' \ michael@377: -e 's;\(/etc/opensips/\)\.\(opensipsctlrc\);%{l_prefix}\1\2;g' \ michael@377: scripts/opensipsctl.8 michael@377: %{l_shtool} subst \ michael@377: -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;' \ michael@377: scripts/opensipsctl.base michael@377: %{l_shtool} subst \ michael@377: -e 's;\(path=\)\$CHROOT_DIR/tmp/\(\$name\);\1${OSER_FIRET}/\2;g' \ michael@377: scripts/opensipsctl.fifo michael@377: %{l_shtool} subst \ michael@377: -e 's;/usr/local/share/opensips/dbtext/opensips;%{l_prefix}/var/opensips/db;' \ michael@377: scripts/opensipsctl.dbtext michael@377: %{l_shtool} subst \ michael@377: -e 's;\(DB_PATH="\)[^"][^"]*;%{l_prefix}/var/opensips/db_berkeley;' \ michael@377: scripts/opensipsctl.db_berkeley michael@377: %{l_shtool} subst \ michael@377: -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \ michael@377: scripts/opensipsctl \ michael@377: scripts/opensipsdbctl.base michael@377: %{l_shtool} subst \ michael@377: -e 's;/usr/local/etc/opensips/dbtext;%{l_prefix}/var/opensips/db;' \ michael@377: -e 's;\(\$DATA_DIR/dbtext\)/opensips;\1;g' \ michael@377: scripts/opensipsdbctl.dbtext michael@377: %{l_shtool} subst \ michael@377: -e 's;\(DATA_DIR="\)[^"][^"]*;\1%{l_prefix}/share/opensips;' \ michael@377: scripts/opensipsdbctl.dbtext \ michael@377: scripts/opensipsdbctl.oracle michael@377: %{l_shtool} subst \ michael@377: -e 's;/usr/local/etc/opensips/db_berkeley;%{l_prefix}/var/opensips/db_berkeley;' \ michael@377: -e 's;/usr/local/BerkeleyDB.[^/][^/]*/bin;%{l_prefix}/bin;' \ michael@377: scripts/opensipsdbctl.db_berkeley michael@377: %{l_shtool} subst \ michael@377: -e 's;/usr/local/\(share/opensips\);%{l_prefix}/\1;' \ michael@377: scripts/opensipsdbctl.db_berkeley \ michael@377: scripts/opensipsdbctl.mysql \ michael@377: scripts/opensipsdbctl.pgsql michael@377: %{l_shtool} subst \ michael@377: -e 's;\(script_flags(int\));\1,null);' \ michael@377: scripts/dbtext/opensips/dialog michael@377: %{l_shtool} subst \ michael@377: -e 's;body(string);body(blob);' \ michael@377: -e 's;sender(string);sender(string,null);' \ michael@377: scripts/dbtext/opensips/presentity michael@377: %{l_shtool} subst \ michael@377: -e 's;\(expires(int\));\1,null);' \ michael@377: -e 's;\(desired_expires(int\));\1,null);' \ michael@377: -e 's;\(contact(string\));\1,null);' \ michael@377: -e 's;\(remote_contact(string\));\1,null);' \ michael@377: -e 's;\(version(int\));\1,null);' \ michael@377: -e 's;\(extra_headers(string\));\1,null);' \ michael@377: scripts/dbtext/opensips/pua michael@377: %{l_shtool} subst \ michael@377: -e 's;\(reason(string\));\1,null);' \ michael@377: scripts/dbtext/opensips/active_watchers \ michael@377: scripts/dbtext/opensips/rls_watchers michael@377: %{l_shtool} subst \ michael@377: -e 's;#! */usr/bin/python;#! %{l_prefix}/bin/python;' \ michael@377: scripts/dbtextdb/*.py michael@377: %{l_shtool} subst \ michael@377: -e 's;#! */usr/bin/perl;#! %{l_prefix}/bin/perl;' \ michael@377: -e 's;^\(my \$PATH_BIN =\) "./";\1 "%{l_prefix}/bin/";' \ michael@377: -e 's;^\(my \$PATH_CTLRC =\) "./scripts/";\1 "%{l_prefix}/etc/opensips/";' \ michael@377: -e 's;^\(my \$PATH_ETC =\) "/usr/local/etc";\1 "%{l_prefix}/etc";' \ michael@377: -e 's;^\(my \$PATH_LIBS =\) "/usr/local/lib";\1 "%{l_prefix}/lib";' \ michael@377: -e 's;^\(my \$PATH_SHARE =\) "/usr/local/share";\1 "%{l_prefix}/share";' \ michael@377: -e 's;^\(my $path = \)"/tmp/";\1"%{l_prefix}/var/opensips/";' \ michael@377: scripts/osipsconsole michael@377: %{l_shtool} subst \ michael@377: -e 's;if ( -x "/usr/bin/";if ( -x "%{l_prefix}/bin";' \ michael@377: -e 's;if \[ -x "/usr/bin/\$1" \];if [ -x "%{l_prefix}/bin/$1" ];' \ michael@377: -e 's;\$TOOLPATH = "/usr/bin/";$TOOLPATH = "%{l_prefix}/bin/";' \ michael@377: -e 's;TOOLPATH="/usr/bin/\$1";TOOLPATH="%{l_prefix}/bin/$1";' \ michael@377: -e 's;if ( -x "/bin/";if ( -x "/usr/bin/";' \ michael@377: -e 's;if \[ -x "/bin/\$1" \];if [ -x "/usr/bin/$1" ];' \ michael@377: -e 's;\$TOOLPATH = "/bin/";$TOOLPATH = "/usr/bin/";' \ michael@377: -e 's;TOOLPATH="/bin/\$1";TOOLPATH="/usr/bin/$1";' \ michael@377: -e 's;if ( -x "/usr/local/bin/\$1";if ( -x "/bin/$1";' \ michael@377: -e 's;if \[ -x "/usr/local/bin/\$1" \];if [ -x "/bin/$1" ];' \ michael@377: -e 's;\$TOOLPATH = "/usr/local/bin/;$TOOLPATH = "/bin/;' \ michael@377: -e 's;TOOLPATH="/usr/local/bin/\$1";TOOLPATH="/bin/$1";' \ michael@377: scripts/osipsconsole \ michael@377: scripts/opensipsctl.base michael@377: %{l_shtool} subst \ michael@377: -e 's;^\(DEFS+=\).*\\$;\1 \\;' \ michael@377: -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libcurl libxml-2.0`;g" \ michael@377: -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libcurl libxml-2.0`;" \ michael@377: modules/xcap_client/Makefile michael@377: %{l_shtool} subst \ michael@377: -e 's;^\(DEFS+=\).*\\$;\1 \\;' \ michael@377: -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libxml-2.0`;g" \ michael@377: -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libxml-2.0`;" \ michael@377: modules/cpl-c/Makefile \ michael@377: modules/presence/Makefile \ michael@377: modules/presence_dialoginfo/Makefile \ michael@377: modules/presence_xml/Makefile \ michael@377: modules/pua/Makefile \ michael@377: modules/pua_bla/Makefile \ michael@377: modules/pua_dialoginfo/Makefile \ michael@377: modules/pua_mi/Makefile \ michael@377: modules/pua_usrloc/Makefile \ michael@377: modules/pua_xmpp/Makefile \ michael@377: modules/b2b_logic/Makefile \ michael@377: modules/rls/Makefile michael@377: %{l_shtool} subst \ michael@413: -e 's;^\(DEFS+= *\);\1-D__EXTENSIONS__ ;' \ michael@413: modules/presence_xml/Makefile michael@413: %{l_shtool} subst \ michael@377: -e 's;^\(DEFS+=\).*;\1`%{l_prefix}/bin/pkg-config --cflags-only-I libconfuse`;' \ michael@377: -e 's;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libconfuse`;' \ michael@377: modules/carrierroute/Makefile michael@377: %{l_shtool} subst \ michael@377: -e 's;\(LIBS = .*-L\$(shell pg_config --libdir) -lpq\);\1 $(shell pg_config --libs);' \ michael@377: modules/db_postgres/Makefile michael@377: %{l_shtool} subst \ michael@377: -e 's;-I\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/include[\t ]*;;' \ michael@377: -e 's;-L\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/lib[\t ]*;;' \ michael@377: modules/db_berkeley/Makefile \ michael@377: utils/db_berkeley/Makefile michael@377: %{l_shtool} subst \ michael@377: -e 's;\(\$(cfg-prefix)\)\$(shell net-snmp-config --prefix);\1;' \ michael@377: modules/snmpstats/Makefile michael@377: %{l_shtool} subst \ michael@377: -e 's;LM_WARN(\(\"uac does not spread across\);LM_NOTICE(\1;' \ michael@377: modules/tm/uac.c michael@377: %{l_shtool} subst \ michael@688: -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \ michael@688: modules/db_berkeley/db_berkeley.c \ michael@688: modules/db_berkeley/bdb_lib.h \ michael@688: modules/sipcapture/sipcapture.h \ michael@688: modules/lua/sipwatch.h \ michael@688: modules/lua/crc32.h michael@758: # redundant since OpenSIPS commit #9666 (ab 1.9.*) michael@688: %{l_shtool} subst \ michael@758: -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),/' \ michael@757: tcp_main.c michael@757: %{l_shtool} subst \ michael@757: -e 's;\(sock_info->socket = socket(AF2PF(addr->s.sa_family), SOCK_SEQPACKET,\) 0;\1 IPPROTO_SCTP;' \ michael@757: sctp_server.c michael@757: %{l_shtool} subst \ michael@416: -e 's;LM_ERR(\("unable to load\);LM_WARN(\1;g' \ michael@416: tls/tls_init.c michael@416: %{l_shtool} subst \ michael@377: -e 's;^\(default_bits[ \t]*=[ \t]*\)2048;\14096;' \ michael@377: etc/tls/ca.conf michael@377: %{l_shtool} subst \ michael@377: -e '1,2d' \ michael@377: etc/tls/README michael@377: %{l_shtool} subst \ michael@377: -e 's;\(radiusclient\)-ng;\1;g' \ michael@377: -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \ michael@377: radius.h michael@376: michael@376: %build michael@377: # select modules michael@377: 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' michael@377: %if "%{with_croute}" == "yes" michael@377: modslist="$modslist carrierroute" michael@377: %endif michael@377: %if "%{with_json}" == "yes" michael@377: modslist="$modslist json" michael@377: %endif michael@377: %if "%{with_ldap}" == "yes" michael@377: modslist="$modslist h350 ldap" michael@377: %endif michael@377: %if "%{with_memcached}" == "yes" michael@377: modslist="$modslist memcached" michael@377: %endif michael@377: %if "%{with_osp}" == "yes" michael@377: modslist="$modslist osp" michael@377: %endif michael@377: %if "%{with_radius}" == "yes" michael@377: modslist="$modslist aaa_radius auth_aaa group uri" michael@377: %endif michael@377: %if "%{with_snmp}" == "yes" michael@377: modslist="$modslist snmpstats" michael@377: %endif michael@377: %if "%{with_bdb}" == "yes" michael@377: modslist="$modslist db_berkeley" michael@377: %endif michael@377: %if "%{with_mysql}" == "yes" michael@377: modslist="$modslist db_mysql" michael@377: %endif michael@377: %if "%{with_pgsql}" == "yes" michael@377: modslist="$modslist db_postgres" michael@377: %endif michael@377: %if "%{with_odbc}" == "yes" michael@377: modslist="$modslist db_unixodbc" michael@377: %endif michael@377: %if "%{with_geoip}" == "yes" michael@377: modslist="$modslist mmgeoip" michael@377: %endif michael@377: michael@376: # build dependencies michael@376: %{l_make} %{l_mflags} \ michael@377: CC="%{l_cc}" \ michael@377: %if "%{with_sctp}" == "yes" michael@377: SCTP=1 \ michael@377: %endif michael@376: %if "%{with_ssl}" == "yes" michael@376: TLS=1 \ michael@376: %endif michael@376: prefix=%{l_prefix} \ michael@376: dep >/dev/null 2>&1 || true michael@376: michael@376: # build program michael@377: %{l_make} %{l_mflags -O} \ michael@377: CC="%{l_cc}" \ michael@377: %if "%{with_sctp}" == "yes" michael@377: SCTP=1 \ michael@376: %endif michael@376: %if "%{with_ssl}" == "yes" michael@376: TLS=1 \ michael@376: %endif michael@376: prefix=%{l_prefix} \ michael@377: opensips michael@377: michael@377: # build utilities michael@377: %{l_make} %{l_mflags -O} \ michael@377: CC="%{l_cc}" \ michael@377: %if "%{with_sctp}" == "yes" michael@377: SCTP=1 \ michael@377: %endif michael@377: %if "%{with_ssl}" == "yes" michael@377: TLS=1 \ michael@377: %endif michael@377: prefix=%{l_prefix} \ michael@377: modules="$modslist" \ michael@377: utils michael@377: michael@377: # build modules michael@397: %{l_make} %{l_mflags -O} \ michael@377: CC="%{l_cc}" \ michael@377: %if "%{with_sctp}" == "yes" michael@377: SCTP=1 \ michael@377: %endif michael@377: %if "%{with_ssl}" == "yes" michael@377: TLS=1 \ michael@377: %endif michael@377: include_modules="$modslist" \ michael@377: skip_modules="" \ michael@377: prefix=%{l_prefix} \ michael@377: modules michael@376: michael@547: # build menuconfig michael@547: %{l_make} %{l_mflags} \ michael@547: prefix=%{l_prefix} \ michael@547: cfg-prefix=$RPM_BUILD_ROOT%{l_prefix}/etc \ michael@547: data-prefix=$RPM_BUILD_ROOT%{l_prefix}/share \ michael@547: opensipsmc michael@547: michael@376: # build rtpproxy extension michael@376: ( cd rtpproxy-%{V_rtpproxy} michael@376: export CC="%{l_cc}" michael@376: export CFLAGS="%{l_cflags -O}" michael@547: export CPPFLAGS="" michael@547: case "%{l_platform -t}" in michael@547: *-sunos5.11 ) CPPFLAGS="$CPPFLAGS -DGE_SOL11" ;; michael@547: esac michael@376: export LIBS="" michael@376: case "%{l_platform -t}" in michael@376: *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;; michael@376: esac michael@377: export GREP="grep" michael@376: ./configure michael@377: %{l_make} %{l_mflags -O} michael@376: ) || exit $? michael@376: michael@376: %install michael@377: # select modules michael@397: 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' michael@377: %if "%{with_croute}" == "yes" michael@377: modslist="$modslist carrierroute" michael@377: %endif michael@377: %if "%{with_json}" == "yes" michael@377: modslist="$modslist json" michael@377: %endif michael@377: %if "%{with_ldap}" == "yes" michael@377: modslist="$modslist h350 ldap" michael@377: %endif michael@377: %if "%{with_memcached}" == "yes" michael@377: modslist="$modslist memcached" michael@377: %endif michael@377: %if "%{with_osp}" == "yes" michael@377: modslist="$modslist osp" michael@377: %endif michael@377: %if "%{with_radius}" == "yes" michael@377: modslist="$modslist aaa_radius auth_aaa group uri" michael@377: %endif michael@377: %if "%{with_snmp}" == "yes" michael@377: modslist="$modslist snmpstats" michael@377: %endif michael@377: %if "%{with_bdb}" == "yes" michael@377: modslist="$modslist db_berkeley" michael@377: %endif michael@377: %if "%{with_mysql}" == "yes" michael@377: modslist="$modslist db_mysql" michael@377: %endif michael@377: %if "%{with_pgsql}" == "yes" michael@377: modslist="$modslist db_postgres" michael@377: %endif michael@377: %if "%{with_odbc}" == "yes" michael@377: modslist="$modslist db_unixodbc" michael@377: %endif michael@377: %if "%{with_geoip}" == "yes" michael@377: modslist="$modslist mmgeoip" michael@377: %endif michael@377: michael@377: # install program, utils, and modules michael@376: %{l_make} %{l_mflags} \ michael@376: INSTALL="%{l_shtool} install%{l_nil} -c" \ michael@376: basedir=$RPM_BUILD_ROOT \ michael@376: prefix=%{l_prefix} \ michael@377: doc-dir=share/opensips/doc \ michael@377: man-dir=man \ michael@377: data-dir=share/opensips \ michael@377: include_modules="$modslist" \ michael@377: skip_modules="" \ michael@376: install michael@376: michael@377: # install rtpproxy software michael@376: %{l_shtool} install -c -s -m 755 \ michael@377: rtpproxy-%{V_rtpproxy}/rtpproxy \ michael@377: $RPM_BUILD_ROOT%{l_prefix}/sbin/rtpproxy michael@376: michael@376: # strip down installation michael@376: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true michael@376: michael@377: # create installation hierarchy michael@377: %{l_shtool} mkdir -f -p -m 700 \ michael@377: $RPM_BUILD_ROOT%{l_prefix}/var/opensips/acc \ michael@377: $RPM_BUILD_ROOT%{l_prefix}/var/opensips/tmp michael@376: michael@376: # install default configuration michael@376: %{l_shtool} mkdir -f -p -m 755 \ michael@376: $RPM_BUILD_ROOT%{l_prefix}/etc/opensips michael@377: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@376: %{SOURCE opensips.cfg} \ michael@376: $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/ michael@376: michael@397: # conditionally remove osipsconsole resources michael@397: %if "%{with_cons}" != "yes" michael@377: rm $RPM_BUILD_ROOT%{l_prefix}/sbin/osipsconsole michael@397: rm $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/osipsconsolerc michael@377: %endif michael@377: michael@376: # install OSSP fsl configuration michael@376: %{l_shtool} mkdir -f -p -m 755 \ michael@376: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@376: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@376: %{SOURCE fsl.opensips} \ michael@376: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@376: michael@377: # install runcommand script michael@376: %{l_shtool} mkdir -f -p -m 755 \ michael@376: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@376: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@376: %{SOURCE rc.opensips} \ michael@376: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@376: michael@376: # determine installation files michael@376: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@376: %{l_files_std} \ michael@377: '%not %dir %{l_prefix}/etc/fsl' \ michael@376: '%config %{l_prefix}/etc/fsl/*' \ michael@376: '%config %{l_prefix}/etc/opensips/*' \ michael@376: '%doc %{l_prefix}/share/opensips/doc/*' \ michael@376: '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/opensips' michael@376: michael@376: %files -f files michael@376: michael@376: %clean michael@376: michael@376: %post michael@377: # on install, setup database (osipsconsole db create /pfx/var/opensips/db) michael@376: if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then michael@377: %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \ michael@377: $RPM_INSTALL_PREFIX/var/opensips/db michael@377: rm -f $RPM_INSTALL_PREFIX/share/opensips/dbtext/*.orig michael@377: %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \ michael@377: $RPM_INSTALL_PREFIX/share/opensips/dbtext/* \ michael@377: $RPM_INSTALL_PREFIX/var/opensips/db/ michael@376: fi michael@376: michael@376: # after upgrade, restart service michael@376: [ $1 -eq 2 ] || exit 0 michael@376: eval `%{l_rc} opensips status 2>/dev/null` michael@376: [ ".$opensips_active" = .yes ] && %{l_rc} opensips restart michael@376: exit 0 michael@376: michael@376: %preun michael@376: # before erase, stop service and remove log files michael@376: [ $1 -eq 0 ] || exit 0 michael@376: %{l_rc} opensips stop 2>/dev/null michael@376: rm -rf $RPM_INSTALL_PREFIX/var/opensips/db 2>/dev/null || true michael@376: rm -f $RPM_INSTALL_PREFIX/var/opensips/* 2>/dev/null || true michael@376: exit 0 michael@376: