diff -r 8f552d1cd671 -r 67e813202d53 opensips/opensips.spec
--- a/opensips/opensips.spec Wed Sep 21 14:02:13 2011 +0200
+++ b/opensips/opensips.spec Wed Sep 21 14:04:16 2011 +0200
@@ -1,6 +1,6 @@
##
## opensips.spec -- OpenPKG RPM Package Specification
-## Copyright (c) 2000-2010 OpenPKG Foundation e.V.
+## Copyright (c) 2000-2008 OpenPKG Foundation e.V.
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
@@ -22,40 +22,62 @@
##
# package options
-%define V_opensips 1.6.4
%define V_rtpproxy 1.2.1
# package information
Name: opensips
-Summary: Open SIP Server
+Summary: Open SIP Router
URL: http://www.opensips.org/
-Vendor: FhG FOKUS et al.
+Vendor: Voice System SRL
Packager: OpenPKG Foundation e.V.
Distribution: OpenPKG Community
Class: PLUS
Group: VoIP
License: GPL
-Version: %{V_opensips}
-Release: 20101221
+Version: 1.7.0
+Release: 20110912
# package options
-%option with_fsl yes
-%option with_ssl no
+%option with_cons yes
+%option with_fsl yes
+%option with_ssl yes
+%option with_sctp no
+%option with_json no
+%option with_croute no
+%option with_ldap no
+%option with_memcached no
+%option with_radius no
+%option with_snmp no
+%option with_bdb no
+%option with_mysql no
+%option with_osp no
+%option with_pgsql no
+%option with_odbc no
+%option with_geoip no
+%option with_dbgmem no
# list of sources
-Source0: http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{V_opensips}-tls_src.tar.gz
-Source1: http://b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz
+Source0: http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{version}_src.tar.gz
+Source1: http://www.b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz
Source2: rc.opensips
Source3: fsl.opensips
Source4: opensips.cfg
-Source5: opensips.schema-dbtext.txt
Patch0: opensips.patch
+Patch1: opensips.patch.dict
+Patch2: opensips.patch.uac
+Patch3: opensips.patch.reg
+Patch4: opensips.patch.rtpproxy
# build information
-BuildPreReq: OpenPKG, openpkg >= 20100101, make, gcc, flex, bison, sed
-PreReq: OpenPKG, openpkg >= 20100101
-BuildPreReq: pcre
-PreReq: pcre
+Prefix: %{l_prefix}
+BuildRoot: %{l_buildroot}
+BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, flex, bison, sed
+PreReq: OpenPKG, openpkg >= 20060823, bash
+BuildPreReq: libxml, expat, curl, pkgconfig
+PreReq: libxml, expat, curl
+%if "%{with_cons}" == "yes"
+PreReq: perl-dbi, perl-term
+%endif
%if "%{with_fsl}" == "yes"
BuildPreReq: fsl
PreReq: fsl
@@ -64,22 +86,91 @@
BuildPreReq: openssl
PreReq: openssl
%endif
+%if "%{with_croute}" == "yes"
+BuildPreReq: confuse
+PreReq: confuse
+%endif
+%if "%{with_json}" == "yes"
+BuildPreReq: json
+PreReq: json
+%endif
+%if "%{with_ldap}" == "yes"
+BuildPreReq: openldap
+PreReq: openldap
+%endif
+%if "%{with_memcached}" == "yes"
+BuildPreReq: memcached
+PreReq: memcached
+%endif
+%if "%{with_osp}" == "yes"
+BuildPreReq: osptoolkit
+PreReq: osptoolkit
+%endif
+%if "%{with_radius}" == "yes"
+BuildPreReq: radiusclient
+PreReq: radiusclient
+%endif
+%if "%{with_snmp}" == "yes"
+BuildPreReq: snmp
+PreReq: snmp
+%endif
+%if "%{with_bdb}" == "yes"
+BuildPreReq: db
+PreReq: db
+%endif
+%if "%{with_mysql}" == "yes"
+BuildPreReq: mysql
+PreReq: mysql
+%endif
+%if "%{with_pgsql}" == "yes"
+BuildPreReq: postgresql
+PreReq: postgresql
+%endif
+%if "%{with_odbc}" == "yes"
+BuildPreReq: unixodbc
+PreReq: unixodbc
+%endif
+%if "%{with_geoip}" == "yes"
+BuildPreReq: geoip
+PreReq: geoip
+%endif
+AutoReq: no
+AutoReqProv: no
%description
OpenSIPS is (beside Kamailio) a successor to OpenSER, which in
- turn was spawned from FhG FOKUS' SIP Express Router (SER). It
+ turn was spawned from FhG FOKUS's SIP Express Router (SER). It
provides SIP (RFC3621) registrar, proxy and routing functionality.
- A C shell like scripting language provides full control over the
- server's behaviour. It's modular architecture allows only required
- functionality to be loaded.
+ A C shell like scripting language provides for control over the
+ server's behaviour. It's modular architecture allows for fine
+ grained loading of required functionality.
+
+ The third party Sippy RTPproxy from http://www.rtpproxy.org/
+ is included to make communication between SIP user agents
+ behind NATs (Network Address Translators) possible.
+
+ OpenSIPS can be used as a: OpenSIPS fits in scenarios:
+
+ Registrar server SIP trunking
+ Router, proxy SIP load balancing
+ Redirect server SIP front end termination
+ Presence agent Residential providers
+ Back to back user agent white label solutions
+ Instant messaging server Enterprise services
+ SIP to SMS gateway LCR for multi gateways
+ SIP to XMPP gateway
+ Load balancer or dispatcher
+ Front end for asterisk
+ NAT traversal unit
+ Application server
%track
prog opensips = {
- version = %{V_opensips}
+ version = %{version}
url = http://www.opensips.org/pub/opensips/
regex = (\d+\.\d+\.\d+)/
url = http://www.opensips.org/pub/opensips/__NEWVER__/src/
- regex = opensips-(__VER__)-tls_src\.tar\.gz
+ regex = opensips-(__VER__)_src\.tar\.gz
}
prog opensips:rtpproxy = {
version = %{V_rtpproxy}
@@ -91,11 +182,267 @@
%setup -q -n opensips-%{version}-tls
%setup -q -n opensips-%{version}-tls -T -D -a 1
%patch -p0
+ %patch -p0 -P 1
+ %patch -p0 -P 2
+ %patch -p0 -P 3
+ ( cd rtpproxy-%{V_rtpproxy}
+ %patch -p0 -P 4
+ ) || exit $?
+ %{l_shtool} subst \
+ -e 's;^#! */bin/sh;#! %{l_prefix}/bin/bash;' \
+ scripts/opensipsctl
+ %{l_shtool} subst \
+ -e 's;^#! */bin/bash;#! %{l_prefix}/bin/bash;' \
+ modules/seas/doc/xml2sgml.sh \
+ scripts/opensipsdbctl \
+ test/*
+ %{l_shtool} subst \
+%if "%{with_dbgmem}" == "yes"
+ -e 's;\(-DF_MALLOC\);#\1;' \
+ -e 's;#\(-DDBG_QM_MALLOC\);\1;' \
+%endif
+ -e 's;\(#define PKG_MEM_POOL_SIZE\) \(1024\*1024\);\1 8*\2;' \
+ Makefile.defs \
+ config.h
+ %{l_shtool} subst \
+%if "%{with_fsl}" == "yes"
+ -e 's;@fslldflags@;-L$(prefix)/lib;g' \
+ -e 's;@fsllibs@;-lfsl;g' \
+%else
+ -e 's;@fslldflags@;;g' \
+ -e 's;@fsllibs@;;g' \
+%endif
+ -e 's;^\(DEFS+= -I\)\$(LOCALBASE).*;\1$(prefix)/include;' \
+ -e 's;^\(DEFS+= -L\)\$(LOCALBASE).*;\1$(prefix)/lib -lssl -lcrypto;' \
+ -e 's;^SVNVERSION *=.*;;g' \
+ -e 's;^DBHTML2TXT *=.*;;g' \
+ -e 's;^DBXML2PDF *=.*;;g' \
+ -e 's;lib64;lib;' \
+ Makefile.defs
+ %{l_shtool} subst \
+ -e 's;\(radiusclient\)-ng;\1;g' \
+ modules/aaa_radius/aaa_radius.c \
+ modules/aaa_radius/rad.c \
+ Makefile.defs
+ %{l_shtool} subst \
+ -e 's;\(\$(data-dir)\)/\(dbtext\)/opensips;\1/\2;g' \
+ -e 's;\(\$(data-dir)\)/\(db_berkeley\)/opensips;\1/\2;g' \
+ -e 's;\(/usr/local/etc/opensips\);\1/*;g' \
+ -e 's;\(s#/usr/local/sbin\)#;\1/*#;g' \
+ -e 's;\(s#/usr/share/doc/$(NAME)/#$(doc-target)\)#;\1/#;g' \
+ -e 's;\(\$(MAKE).*\) \(install_module_custom\);\1 makefile_defs=0 \2;' \
+ Makefile
+ %{l_shtool} subst \
+ -e 's;^\(LIBS=\).*;\1-L`%{l_prefix}/bin/pkg-config --libs db`;' \
+ utils/db_berkeley/Makefile
+ %{l_shtool} subst \
+ -e 's;/usr/share/doc/opensips/AUTHORS;%{l_prefix}/share/opensips/doc/AUTHORS;' \
+ scripts/opensipsctl.8
+ %{l_shtool} subst \
+ -e 's;\(ETCDIR=".*\)/"$;\1";' \
+ -e 's;\(ETCDIR="\)/usr/local/\(etc/opensips"\);\1%{l_prefix}/\2;' \
+ -e 's;\. /etc/opensips/opensipsctlrc;true;' \
+ -e 's;\. ~/.opensipsctlrc;true;' \
+ -e 's;/usr/local\(/lib/opensips/opensipsctl\);%{l_prefix}\1;' \
+ -e 's;/usr/local/\(etc/opensips/opensipsctlrc\);%{l_prefix}/\1;' \
+ -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
+ scripts/opensipsdbctl \
+ scripts/opensipsctl
+ %{l_shtool} subst \
+ -e 's;\(DB_PATH="\)[^"][^"]*;\1%{l_prefix}/var/opensips/db;' \
+ scripts/osipsconsolerc \
+ scripts/opensipsctlrc
+ %{l_shtool} subst \
+ -e 's;=/var/run/\(opensips.pid\);=%{l_prefix}/var/opensips/\1;g' \
+ -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;g' \
+ -e 's;\(my \$fifo_reply_path\) = "/tmp/";\1 = "%{l_prefix}/var/opensips/";' \
+ -e 's;\(my \$HISTORY_FILE\) = "/tmp/osipsconsole_history";\1 = "%{l_prefix}/var/opensips/osipsconsole_history";' \
+ scripts/opensipsctl \
+ scripts/opensipsctlrc \
+ scripts/osipsconsole \
+ scripts/osipsconsolerc
+ %{l_shtool} subst \
+ -e 's;/usr/local;;g' \
+ -e 's;\(/etc/opensips/\)\.\(opensipsctlrc\);%{l_prefix}\1\2;g' \
+ scripts/opensipsctl.8
+ %{l_shtool} subst \
+ -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;' \
+ scripts/opensipsctl.base
+ %{l_shtool} subst \
+ -e 's;\(path=\)\$CHROOT_DIR/tmp/\(\$name\);\1${OSER_FIRET}/\2;g' \
+ scripts/opensipsctl.fifo
+ %{l_shtool} subst \
+ -e 's;/usr/local/share/opensips/dbtext/opensips;%{l_prefix}/var/opensips/db;' \
+ scripts/opensipsctl.dbtext
+ %{l_shtool} subst \
+ -e 's;\(DB_PATH="\)[^"][^"]*;%{l_prefix}/var/opensips/db_berkeley;' \
+ scripts/opensipsctl.db_berkeley
+ %{l_shtool} subst \
+ -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
+ scripts/opensipsctl \
+ scripts/opensipsdbctl.base
+ %{l_shtool} subst \
+ -e 's;/usr/local/etc/opensips/dbtext;%{l_prefix}/var/opensips/db;' \
+ -e 's;\(\$DATA_DIR/dbtext\)/opensips;\1;g' \
+ scripts/opensipsdbctl.dbtext
+ %{l_shtool} subst \
+ -e 's;\(DATA_DIR="\)[^"][^"]*;\1%{l_prefix}/share/opensips;' \
+ scripts/opensipsdbctl.dbtext \
+ scripts/opensipsdbctl.oracle
+ %{l_shtool} subst \
+ -e 's;/usr/local/etc/opensips/db_berkeley;%{l_prefix}/var/opensips/db_berkeley;' \
+ -e 's;/usr/local/BerkeleyDB.[^/][^/]*/bin;%{l_prefix}/bin;' \
+ scripts/opensipsdbctl.db_berkeley
+ %{l_shtool} subst \
+ -e 's;/usr/local/\(share/opensips\);%{l_prefix}/\1;' \
+ scripts/opensipsdbctl.db_berkeley \
+ scripts/opensipsdbctl.mysql \
+ scripts/opensipsdbctl.pgsql
+ %{l_shtool} subst \
+ -e 's;\(script_flags(int\));\1,null);' \
+ scripts/dbtext/opensips/dialog
+ %{l_shtool} subst \
+ -e 's;body(string);body(blob);' \
+ -e 's;sender(string);sender(string,null);' \
+ scripts/dbtext/opensips/presentity
+ %{l_shtool} subst \
+ -e 's;\(expires(int\));\1,null);' \
+ -e 's;\(desired_expires(int\));\1,null);' \
+ -e 's;\(contact(string\));\1,null);' \
+ -e 's;\(remote_contact(string\));\1,null);' \
+ -e 's;\(version(int\));\1,null);' \
+ -e 's;\(extra_headers(string\));\1,null);' \
+ scripts/dbtext/opensips/pua
+ %{l_shtool} subst \
+ -e 's;\(reason(string\));\1,null);' \
+ scripts/dbtext/opensips/active_watchers \
+ scripts/dbtext/opensips/rls_watchers
+ %{l_shtool} subst \
+ -e 's;#! */usr/bin/python;#! %{l_prefix}/bin/python;' \
+ scripts/dbtextdb/*.py
+ %{l_shtool} subst \
+ -e 's;#! */usr/bin/perl;#! %{l_prefix}/bin/perl;' \
+ -e 's;^\(my \$PATH_BIN =\) "./";\1 "%{l_prefix}/bin/";' \
+ -e 's;^\(my \$PATH_CTLRC =\) "./scripts/";\1 "%{l_prefix}/etc/opensips/";' \
+ -e 's;^\(my \$PATH_ETC =\) "/usr/local/etc";\1 "%{l_prefix}/etc";' \
+ -e 's;^\(my \$PATH_LIBS =\) "/usr/local/lib";\1 "%{l_prefix}/lib";' \
+ -e 's;^\(my \$PATH_SHARE =\) "/usr/local/share";\1 "%{l_prefix}/share";' \
+ -e 's;^\(my $path = \)"/tmp/";\1"%{l_prefix}/var/opensips/";' \
+ scripts/osipsconsole
+ %{l_shtool} subst \
+ -e 's;if ( -x "/usr/bin/";if ( -x "%{l_prefix}/bin";' \
+ -e 's;if \[ -x "/usr/bin/\$1" \];if [ -x "%{l_prefix}/bin/$1" ];' \
+ -e 's;\$TOOLPATH = "/usr/bin/";$TOOLPATH = "%{l_prefix}/bin/";' \
+ -e 's;TOOLPATH="/usr/bin/\$1";TOOLPATH="%{l_prefix}/bin/$1";' \
+ -e 's;if ( -x "/bin/";if ( -x "/usr/bin/";' \
+ -e 's;if \[ -x "/bin/\$1" \];if [ -x "/usr/bin/$1" ];' \
+ -e 's;\$TOOLPATH = "/bin/";$TOOLPATH = "/usr/bin/";' \
+ -e 's;TOOLPATH="/bin/\$1";TOOLPATH="/usr/bin/$1";' \
+ -e 's;if ( -x "/usr/local/bin/\$1";if ( -x "/bin/$1";' \
+ -e 's;if \[ -x "/usr/local/bin/\$1" \];if [ -x "/bin/$1" ];' \
+ -e 's;\$TOOLPATH = "/usr/local/bin/;$TOOLPATH = "/bin/;' \
+ -e 's;TOOLPATH="/usr/local/bin/\$1";TOOLPATH="/bin/$1";' \
+ scripts/osipsconsole \
+ scripts/opensipsctl.base
+ %{l_shtool} subst \
+ -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
+ -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libcurl libxml-2.0`;g" \
+ -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libcurl libxml-2.0`;" \
+ modules/xcap_client/Makefile
+ %{l_shtool} subst \
+ -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
+ -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libxml-2.0`;g" \
+ -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libxml-2.0`;" \
+ modules/cpl-c/Makefile \
+ modules/presence/Makefile \
+ modules/presence_dialoginfo/Makefile \
+ modules/presence_xml/Makefile \
+ modules/pua/Makefile \
+ modules/pua_bla/Makefile \
+ modules/pua_dialoginfo/Makefile \
+ modules/pua_mi/Makefile \
+ modules/pua_usrloc/Makefile \
+ modules/pua_xmpp/Makefile \
+ modules/b2b_logic/Makefile \
+ modules/rls/Makefile
+ %{l_shtool} subst \
+ -e 's;^\(DEFS+=\).*;\1`%{l_prefix}/bin/pkg-config --cflags-only-I libconfuse`;' \
+ -e 's;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libconfuse`;' \
+ modules/carrierroute/Makefile
+ %{l_shtool} subst \
+ -e 's;\(LIBS = .*-L\$(shell pg_config --libdir) -lpq\);\1 $(shell pg_config --libs);' \
+ modules/db_postgres/Makefile
+ %{l_shtool} subst \
+ -e 's;-I\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/include[\t ]*;;' \
+ -e 's;-L\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/lib[\t ]*;;' \
+ modules/db_berkeley/Makefile \
+ utils/db_berkeley/Makefile
+ %{l_shtool} subst \
+ -e 's;\(\$(cfg-prefix)\)\$(shell net-snmp-config --prefix);\1;' \
+ modules/snmpstats/Makefile
+ %{l_shtool} subst \
+ -e 's;LM_WARN(\(\"uac does not spread across\);LM_NOTICE(\1;' \
+ modules/tm/uac.c
+ %{l_shtool} subst \
+ -e 's;\(#define MAX_SSL_RETRIES\) 32;\1 1024;' \
+ tls/tls_server.c
+ %{l_shtool} subst \
+ -e 's;^\(default_bits[ \t]*=[ \t]*\)2048;\14096;' \
+ etc/tls/ca.conf
+ %{l_shtool} subst \
+ -e '1,2d' \
+ etc/tls/README
+ %{l_shtool} subst \
+ -e 's;\(radiusclient\)-ng;\1;g' \
+ -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
+ radius.h
%build
+ # select modules
+ 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'
+%if "%{with_croute}" == "yes"
+ modslist="$modslist carrierroute"
+%endif
+%if "%{with_json}" == "yes"
+ modslist="$modslist json"
+%endif
+%if "%{with_ldap}" == "yes"
+ modslist="$modslist h350 ldap"
+%endif
+%if "%{with_memcached}" == "yes"
+ modslist="$modslist memcached"
+%endif
+%if "%{with_osp}" == "yes"
+ modslist="$modslist osp"
+%endif
+%if "%{with_radius}" == "yes"
+ modslist="$modslist aaa_radius auth_aaa group uri"
+%endif
+%if "%{with_snmp}" == "yes"
+ modslist="$modslist snmpstats"
+%endif
+%if "%{with_bdb}" == "yes"
+ modslist="$modslist db_berkeley"
+%endif
+%if "%{with_mysql}" == "yes"
+ modslist="$modslist db_mysql"
+%endif
+%if "%{with_pgsql}" == "yes"
+ modslist="$modslist db_postgres"
+%endif
+%if "%{with_odbc}" == "yes"
+ modslist="$modslist db_unixodbc"
+%endif
+%if "%{with_geoip}" == "yes"
+ modslist="$modslist mmgeoip"
+%endif
+
# build dependencies
%{l_make} %{l_mflags} \
- CC="%{l_cc} %{l_cflags} %{l_cppflags}" \
+ CC="%{l_cc}" \
+%if "%{with_sctp}" == "yes"
+ SCTP=1 \
+%endif
%if "%{with_ssl}" == "yes"
TLS=1 \
%endif
@@ -103,22 +450,43 @@
dep >/dev/null 2>&1 || true
# build program
- %{l_make} %{l_mflags} \
- CC="%{l_cc} %{l_cflags} %{l_cppflags}" \
-%if "%{with_ssl}" == "yes"
- TLS=1 \
+ %{l_make} %{l_mflags -O} \
+ CC="%{l_cc}" \
+%if "%{with_sctp}" == "yes"
+ SCTP=1 \
%endif
- prefix=%{l_prefix}
-
- # build modules
- %{l_make} %{l_mflags} \
- CC="%{l_cc} %{l_cflags} %{l_cppflags}" \
%if "%{with_ssl}" == "yes"
TLS=1 \
%endif
prefix=%{l_prefix} \
- modules \
- skip_modules="mysql jabber"
+ opensips
+
+ # build utilities
+ %{l_make} %{l_mflags -O} \
+ CC="%{l_cc}" \
+%if "%{with_sctp}" == "yes"
+ SCTP=1 \
+%endif
+%if "%{with_ssl}" == "yes"
+ TLS=1 \
+%endif
+ prefix=%{l_prefix} \
+ modules="$modslist" \
+ utils
+
+ # build modules
+ %{l_make} %{l_mflags -O} \
+ CC="%{l_cc}" \
+%if "%{with_sctp}" == "yes"
+ SCTP=1 \
+%endif
+%if "%{with_ssl}" == "yes"
+ TLS=1 \
+%endif
+ include_modules="$modslist" \
+ skip_modules="" \
+ prefix=%{l_prefix} \
+ modules
# build rtpproxy extension
( cd rtpproxy-%{V_rtpproxy}
@@ -128,62 +496,96 @@
case "%{l_platform -t}" in
*-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
esac
+ export GREP="grep"
./configure
- %{l_make} %{l_mflags}
+ %{l_make} %{l_mflags -O}
) || exit $?
%install
+ rm -rf $RPM_BUILD_ROOT
- # install program
+ # select modules
+ 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'
+%if "%{with_croute}" == "yes"
+ modslist="$modslist carrierroute"
+%endif
+%if "%{with_json}" == "yes"
+ modslist="$modslist json"
+%endif
+%if "%{with_ldap}" == "yes"
+ modslist="$modslist h350 ldap"
+%endif
+%if "%{with_memcached}" == "yes"
+ modslist="$modslist memcached"
+%endif
+%if "%{with_osp}" == "yes"
+ modslist="$modslist osp"
+%endif
+%if "%{with_radius}" == "yes"
+ modslist="$modslist aaa_radius auth_aaa group uri"
+%endif
+%if "%{with_snmp}" == "yes"
+ modslist="$modslist snmpstats"
+%endif
+%if "%{with_bdb}" == "yes"
+ modslist="$modslist db_berkeley"
+%endif
+%if "%{with_mysql}" == "yes"
+ modslist="$modslist db_mysql"
+%endif
+%if "%{with_pgsql}" == "yes"
+ modslist="$modslist db_postgres"
+%endif
+%if "%{with_odbc}" == "yes"
+ modslist="$modslist db_unixodbc"
+%endif
+%if "%{with_geoip}" == "yes"
+ modslist="$modslist mmgeoip"
+%endif
+
+ # install program, utils, and modules
%{l_make} %{l_mflags} \
INSTALL="%{l_shtool} install%{l_nil} -c" \
basedir=$RPM_BUILD_ROOT \
prefix=%{l_prefix} \
- cfg-prefix=$RPM_BUILD_ROOT \
- cfg-target=%{l_prefix}/etc/opensips/ \
- doc-dir=share/opensips/doc/ \
- man-dir=man/ \
+ doc-dir=share/opensips/doc \
+ man-dir=man \
+ data-dir=share/opensips \
+ include_modules="$modslist" \
+ skip_modules="" \
install
- # install modules
- %{l_make} %{l_mflags} \
- INSTALL="%{l_shtool} install%{l_nil} -c" \
- basedir=$RPM_BUILD_ROOT \
- prefix=%{l_prefix} \
- cfg-prefix=$RPM_BUILD_ROOT \
- cfg-target=%{l_prefix}/etc/opensips/ \
- doc-dir=share/opensips/doc/ \
- man-dir=man/ \
- install-modules \
- skip_modules="mysql jabber"
-
- # install rtpproxy extension
+ # install rtpproxy software
%{l_shtool} install -c -s -m 755 \
- rtpproxy-%{V_rtpproxy}/rtpproxy $RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_rtpproxy
+ rtpproxy-%{V_rtpproxy}/rtpproxy \
+ $RPM_BUILD_ROOT%{l_prefix}/sbin/rtpproxy
# strip down installation
strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
- rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_mysql.sh
- # post-adjust installation
- %{l_shtool} subst \
- -e 's;/etc/opensips/opensipsctlrc;%{l_prefix}/etc/opensips/opensipsctlrc;g' \
- $RPM_BUILD_ROOT%{l_prefix}/sbin/opensipsctl
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/etc/opensips
- %{l_shtool} install -c -m 644 \
- -e 's;^# \(PID_FILE\)=.*;\1=%{l_prefix}/var/opensips/opensips.pid;' \
- -e 's;^# \(OSIPS_FIFO\)=.*;\1=%{l_prefix}/var/opensips/opensips.fifo;' \
- scripts/opensipsctlrc \
- $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/opensipsctlrc
+ # create installation hierarchy
+ %{l_shtool} mkdir -f -p -m 700 \
+ $RPM_BUILD_ROOT%{l_prefix}/var/opensips/acc \
+ $RPM_BUILD_ROOT%{l_prefix}/var/opensips/tmp
# install default configuration
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/opensips
- %{l_shtool} install -c -m 755 %{l_value -s -a} \
+ %{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE opensips.cfg} \
+ %{SOURCE opensipsctlrc} \
+ %{SOURCE osipsconsolerc} \
$RPM_BUILD_ROOT%{l_prefix}/etc/opensips/
+ # conditionally install osipsconsole resources
+%if "%{with_cons}" == "yes"
+ %{l_shtool} install -c -m 644 %{l_value -s -a} \
+ %{SOURCE osipsconsolerc} \
+ $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/
+%else
+ rm $RPM_BUILD_ROOT%{l_prefix}/sbin/osipsconsole
+%endif
+
# install OSSP fsl configuration
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl
@@ -191,23 +593,17 @@
%{SOURCE fsl.opensips} \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
- # install run-command script
+ # install runcommand script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.opensips} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # create database directory and install database schema definitions
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix}/var/opensips
- %{l_shtool} install -c -m 644 \
- %{SOURCE opensips.schema-dbtext.txt} \
- $RPM_BUILD_ROOT%{l_prefix}/share/opensips/
-
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
+ '%not %dir %{l_prefix}/etc/fsl' \
'%config %{l_prefix}/etc/fsl/*' \
'%config %{l_prefix}/etc/opensips/*' \
'%doc %{l_prefix}/share/opensips/doc/*' \
@@ -216,20 +612,17 @@
%files -f files
%clean
+ rm -rf $RPM_BUILD_ROOT
%post
- # on install, setup database
+ # on install, setup database (osipsconsole db create /pfx/var/opensips/db)
if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then
- mkdir $RPM_INSTALL_PREFIX/var/opensips/db
- chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db
- chmod 755 $RPM_INSTALL_PREFIX/var/opensips/db
- schema="$RPM_INSTALL_PREFIX/share/opensips/opensips.schema-dbtext.txt"
- for table in `sed -e '/^#.*/d' -e '/^$/d' -e 's;\([^:]*\):.*;\1;' <$schema | sort -u`; do
- grep "^${table}:" $schema | sed -e "s;^${table}: *;;" \
- >$RPM_INSTALL_PREFIX/var/opensips/db/$table
- done
- chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db/* 2>/dev/null || true
- chmod 644 $RPM_INSTALL_PREFIX/var/opensips/db/* 2>/dev/null || true
+ %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
+ $RPM_INSTALL_PREFIX/var/opensips/db
+ rm -f $RPM_INSTALL_PREFIX/share/opensips/dbtext/*.orig
+ %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
+ $RPM_INSTALL_PREFIX/share/opensips/dbtext/* \
+ $RPM_INSTALL_PREFIX/var/opensips/db/
fi
# after upgrade, restart service