opensips/opensips.spec

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

mercurial