Thu, 01 Dec 2011 13:33:32 +0100
Update and correct to vendor version, removing deprecated module logic.
1 ##
2 ## opensips.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package options
25 %define V_rtpproxy 1.2.1
27 # package information
28 Name: opensips
29 Summary: Open SIP Router
30 URL: http://www.opensips.org/
31 Vendor: Voice System SRL
32 Packager: OpenPKG Foundation e.V.
33 Distribution: OpenPKG Community
34 Class: PLUS
35 Group: VoIP
36 License: GPL
37 Version: 1.7.1
38 Release: 20111120
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.dict
67 Patch2: opensips.patch.uac
68 Patch3: opensips.patch.reg
69 Patch4: opensips.patch.rtpproxy
71 # build information
72 Prefix: %{l_prefix}
73 BuildRoot: %{l_buildroot}
74 BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, flex, bison, sed
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
81 %if "%{with_fsl}" == "yes"
82 BuildPreReq: fsl
83 PreReq: fsl
84 %endif
85 %if "%{with_ssl}" == "yes"
86 BuildPreReq: openssl
87 PreReq: openssl
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
140 %description
141 OpenSIPS is (beside Kamailio) a successor to OpenSER, which in
142 turn was spawned from FhG FOKUS's SIP Express Router (SER). It
143 provides SIP (RFC3621) registrar, proxy and routing functionality.
144 A C shell like scripting language provides for control over the
145 server's behaviour. It's modular architecture allows for fine
146 grained loading of required functionality.
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.
152 OpenSIPS can be used as a: OpenSIPS fits in scenarios:
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
167 %track
168 prog opensips = {
169 version = %{version}
170 url = http://www.opensips.org/pub/opensips/
171 regex = (\d+\.\d+\.\d+)/
172 url = http://www.opensips.org/pub/opensips/__NEWVER__/src/
173 regex = opensips-(__VER__)_src\.tar\.gz
174 }
175 prog opensips:rtpproxy = {
176 version = %{V_rtpproxy}
177 url = http://www.rtpproxy.org/
178 regex = rtpproxy-(\d+(?:\.\d+)+)\.tar\.gz
179 }
181 %prep
182 %setup -q -n opensips-%{version}-tls
183 %setup -q -n opensips-%{version}-tls -T -D -a 1
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 4*\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 -e 's;start opensips \(with 64MB share memory\).*;start \1 instead of default 32MB;' \
254 -e 's;\(# STARTOPTIONS=.*\);\1"-m 64";' \
255 scripts/osipsconsolerc \
256 scripts/opensipsctlrc
257 %{l_shtool} subst \
258 -e 's;=/var/run/\(opensips.pid\);=%{l_prefix}/var/opensips/\1;g' \
259 -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;g' \
260 -e 's;\(my \$fifo_reply_path\) = "/tmp/";\1 = "%{l_prefix}/var/opensips/";' \
261 -e 's;\(my \$HISTORY_FILE\) = "/tmp/osipsconsole_history";\1 = "%{l_prefix}/var/opensips/osipsconsole_history";' \
262 scripts/opensipsctl \
263 scripts/opensipsctlrc \
264 scripts/osipsconsole \
265 scripts/osipsconsolerc
266 %{l_shtool} subst \
267 -e 's;/usr/local;;g' \
268 -e 's;\(/etc/opensips/\)\.\(opensipsctlrc\);%{l_prefix}\1\2;g' \
269 scripts/opensipsctl.8
270 %{l_shtool} subst \
271 -e 's;/var/run/\(opensips.pid\);%{l_prefix}/var/opensips/\1;' \
272 scripts/opensipsctl.base
273 %{l_shtool} subst \
274 -e 's;\(path=\)\$CHROOT_DIR/tmp/\(\$name\);\1${OSER_FIRET}/\2;g' \
275 scripts/opensipsctl.fifo
276 %{l_shtool} subst \
277 -e 's;/usr/local/share/opensips/dbtext/opensips;%{l_prefix}/var/opensips/db;' \
278 scripts/opensipsctl.dbtext
279 %{l_shtool} subst \
280 -e 's;\(DB_PATH="\)[^"][^"]*;%{l_prefix}/var/opensips/db_berkeley;' \
281 scripts/opensipsctl.db_berkeley
282 %{l_shtool} subst \
283 -e 's;PATH=\$PATH:/usr/local/sbin;PATH=%{l_prefix}/sbin:$PATH;' \
284 scripts/opensipsctl \
285 scripts/opensipsdbctl.base
286 %{l_shtool} subst \
287 -e 's;/usr/local/etc/opensips/dbtext;%{l_prefix}/var/opensips/db;' \
288 -e 's;\(\$DATA_DIR/dbtext\)/opensips;\1;g' \
289 scripts/opensipsdbctl.dbtext
290 %{l_shtool} subst \
291 -e 's;\(DATA_DIR="\)[^"][^"]*;\1%{l_prefix}/share/opensips;' \
292 scripts/opensipsdbctl.dbtext \
293 scripts/opensipsdbctl.oracle
294 %{l_shtool} subst \
295 -e 's;/usr/local/etc/opensips/db_berkeley;%{l_prefix}/var/opensips/db_berkeley;' \
296 -e 's;/usr/local/BerkeleyDB.[^/][^/]*/bin;%{l_prefix}/bin;' \
297 scripts/opensipsdbctl.db_berkeley
298 %{l_shtool} subst \
299 -e 's;/usr/local/\(share/opensips\);%{l_prefix}/\1;' \
300 scripts/opensipsdbctl.db_berkeley \
301 scripts/opensipsdbctl.mysql \
302 scripts/opensipsdbctl.pgsql
303 %{l_shtool} subst \
304 -e 's;\(script_flags(int\));\1,null);' \
305 scripts/dbtext/opensips/dialog
306 %{l_shtool} subst \
307 -e 's;body(string);body(blob);' \
308 -e 's;sender(string);sender(string,null);' \
309 scripts/dbtext/opensips/presentity
310 %{l_shtool} subst \
311 -e 's;\(expires(int\));\1,null);' \
312 -e 's;\(desired_expires(int\));\1,null);' \
313 -e 's;\(contact(string\));\1,null);' \
314 -e 's;\(remote_contact(string\));\1,null);' \
315 -e 's;\(version(int\));\1,null);' \
316 -e 's;\(extra_headers(string\));\1,null);' \
317 scripts/dbtext/opensips/pua
318 %{l_shtool} subst \
319 -e 's;\(reason(string\));\1,null);' \
320 scripts/dbtext/opensips/active_watchers \
321 scripts/dbtext/opensips/rls_watchers
322 %{l_shtool} subst \
323 -e 's;#! */usr/bin/python;#! %{l_prefix}/bin/python;' \
324 scripts/dbtextdb/*.py
325 %{l_shtool} subst \
326 -e 's;#! */usr/bin/perl;#! %{l_prefix}/bin/perl;' \
327 -e 's;^\(my \$PATH_BIN =\) "./";\1 "%{l_prefix}/bin/";' \
328 -e 's;^\(my \$PATH_CTLRC =\) "./scripts/";\1 "%{l_prefix}/etc/opensips/";' \
329 -e 's;^\(my \$PATH_ETC =\) "/usr/local/etc";\1 "%{l_prefix}/etc";' \
330 -e 's;^\(my \$PATH_LIBS =\) "/usr/local/lib";\1 "%{l_prefix}/lib";' \
331 -e 's;^\(my \$PATH_SHARE =\) "/usr/local/share";\1 "%{l_prefix}/share";' \
332 -e 's;^\(my $path = \)"/tmp/";\1"%{l_prefix}/var/opensips/";' \
333 scripts/osipsconsole
334 %{l_shtool} subst \
335 -e 's;if ( -x "/usr/bin/";if ( -x "%{l_prefix}/bin";' \
336 -e 's;if \[ -x "/usr/bin/\$1" \];if [ -x "%{l_prefix}/bin/$1" ];' \
337 -e 's;\$TOOLPATH = "/usr/bin/";$TOOLPATH = "%{l_prefix}/bin/";' \
338 -e 's;TOOLPATH="/usr/bin/\$1";TOOLPATH="%{l_prefix}/bin/$1";' \
339 -e 's;if ( -x "/bin/";if ( -x "/usr/bin/";' \
340 -e 's;if \[ -x "/bin/\$1" \];if [ -x "/usr/bin/$1" ];' \
341 -e 's;\$TOOLPATH = "/bin/";$TOOLPATH = "/usr/bin/";' \
342 -e 's;TOOLPATH="/bin/\$1";TOOLPATH="/usr/bin/$1";' \
343 -e 's;if ( -x "/usr/local/bin/\$1";if ( -x "/bin/$1";' \
344 -e 's;if \[ -x "/usr/local/bin/\$1" \];if [ -x "/bin/$1" ];' \
345 -e 's;\$TOOLPATH = "/usr/local/bin/;$TOOLPATH = "/bin/;' \
346 -e 's;TOOLPATH="/usr/local/bin/\$1";TOOLPATH="/bin/$1";' \
347 scripts/osipsconsole \
348 scripts/opensipsctl.base
349 %{l_shtool} subst \
350 -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
351 -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libcurl libxml-2.0`;g" \
352 -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libcurl libxml-2.0`;" \
353 modules/xcap_client/Makefile
354 %{l_shtool} subst \
355 -e 's;^\(DEFS+=\).*\\$;\1 \\;' \
356 -e "s;\-I[^ \t][^ \t]*;`%{l_prefix}/bin/pkg-config --cflags-only-I libxml-2.0`;g" \
357 -e "s;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libxml-2.0`;" \
358 modules/cpl-c/Makefile \
359 modules/presence/Makefile \
360 modules/presence_dialoginfo/Makefile \
361 modules/presence_xml/Makefile \
362 modules/pua/Makefile \
363 modules/pua_bla/Makefile \
364 modules/pua_dialoginfo/Makefile \
365 modules/pua_mi/Makefile \
366 modules/pua_usrloc/Makefile \
367 modules/pua_xmpp/Makefile \
368 modules/b2b_logic/Makefile \
369 modules/rls/Makefile
370 %{l_shtool} subst \
371 -e 's;^\(DEFS+=\).*;\1`%{l_prefix}/bin/pkg-config --cflags-only-I libconfuse`;' \
372 -e 's;^\(LIBS=\).*;\1`%{l_prefix}/bin/pkg-config --libs libconfuse`;' \
373 modules/carrierroute/Makefile
374 %{l_shtool} subst \
375 -e 's;\(LIBS = .*-L\$(shell pg_config --libdir) -lpq\);\1 $(shell pg_config --libs);' \
376 modules/db_postgres/Makefile
377 %{l_shtool} subst \
378 -e 's;-I\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/include[\t ]*;;' \
379 -e 's;-L\$(LOCALBASE)/BerkeleyDB[0-9\.\-]*/lib[\t ]*;;' \
380 modules/db_berkeley/Makefile \
381 utils/db_berkeley/Makefile
382 %{l_shtool} subst \
383 -e 's;\(\$(cfg-prefix)\)\$(shell net-snmp-config --prefix);\1;' \
384 modules/snmpstats/Makefile
385 %{l_shtool} subst \
386 -e 's;LM_WARN(\(\"uac does not spread across\);LM_NOTICE(\1;' \
387 modules/tm/uac.c
388 %{l_shtool} subst \
389 -e 's;\(#define MAX_SSL_RETRIES\) 32;\1 1024;' \
390 tls/tls_server.c
391 %{l_shtool} subst \
392 -e 's;^\(default_bits[ \t]*=[ \t]*\)2048;\14096;' \
393 etc/tls/ca.conf
394 %{l_shtool} subst \
395 -e '1,2d' \
396 etc/tls/README
397 %{l_shtool} subst \
398 -e 's;\(radiusclient\)-ng;\1;g' \
399 -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \
400 radius.h
402 %build
403 # select modules
404 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'
405 %if "%{with_croute}" == "yes"
406 modslist="$modslist carrierroute"
407 %endif
408 %if "%{with_json}" == "yes"
409 modslist="$modslist json"
410 %endif
411 %if "%{with_ldap}" == "yes"
412 modslist="$modslist h350 ldap"
413 %endif
414 %if "%{with_memcached}" == "yes"
415 modslist="$modslist memcached"
416 %endif
417 %if "%{with_osp}" == "yes"
418 modslist="$modslist osp"
419 %endif
420 %if "%{with_radius}" == "yes"
421 modslist="$modslist aaa_radius auth_aaa group uri"
422 %endif
423 %if "%{with_snmp}" == "yes"
424 modslist="$modslist snmpstats"
425 %endif
426 %if "%{with_bdb}" == "yes"
427 modslist="$modslist db_berkeley"
428 %endif
429 %if "%{with_mysql}" == "yes"
430 modslist="$modslist db_mysql"
431 %endif
432 %if "%{with_pgsql}" == "yes"
433 modslist="$modslist db_postgres"
434 %endif
435 %if "%{with_odbc}" == "yes"
436 modslist="$modslist db_unixodbc"
437 %endif
438 %if "%{with_geoip}" == "yes"
439 modslist="$modslist mmgeoip"
440 %endif
442 # build dependencies
443 %{l_make} %{l_mflags} \
444 CC="%{l_cc}" \
445 %if "%{with_sctp}" == "yes"
446 SCTP=1 \
447 %endif
448 %if "%{with_ssl}" == "yes"
449 TLS=1 \
450 %endif
451 prefix=%{l_prefix} \
452 dep >/dev/null 2>&1 || true
454 # build program
455 %{l_make} %{l_mflags -O} \
456 CC="%{l_cc}" \
457 %if "%{with_sctp}" == "yes"
458 SCTP=1 \
459 %endif
460 %if "%{with_ssl}" == "yes"
461 TLS=1 \
462 %endif
463 prefix=%{l_prefix} \
464 opensips
466 # build utilities
467 %{l_make} %{l_mflags -O} \
468 CC="%{l_cc}" \
469 %if "%{with_sctp}" == "yes"
470 SCTP=1 \
471 %endif
472 %if "%{with_ssl}" == "yes"
473 TLS=1 \
474 %endif
475 prefix=%{l_prefix} \
476 modules="$modslist" \
477 utils
479 # build modules
480 %{l_make} %{l_mflags -O} \
481 CC="%{l_cc}" \
482 %if "%{with_sctp}" == "yes"
483 SCTP=1 \
484 %endif
485 %if "%{with_ssl}" == "yes"
486 TLS=1 \
487 %endif
488 include_modules="$modslist" \
489 skip_modules="" \
490 prefix=%{l_prefix} \
491 modules
493 # build rtpproxy extension
494 ( cd rtpproxy-%{V_rtpproxy}
495 export CC="%{l_cc}"
496 export CFLAGS="%{l_cflags -O}"
497 export LIBS=""
498 case "%{l_platform -t}" in
499 *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
500 esac
501 export GREP="grep"
502 ./configure
503 %{l_make} %{l_mflags -O}
504 ) || exit $?
506 %install
507 rm -rf $RPM_BUILD_ROOT
509 # select modules
510 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'
511 %if "%{with_croute}" == "yes"
512 modslist="$modslist carrierroute"
513 %endif
514 %if "%{with_json}" == "yes"
515 modslist="$modslist json"
516 %endif
517 %if "%{with_ldap}" == "yes"
518 modslist="$modslist h350 ldap"
519 %endif
520 %if "%{with_memcached}" == "yes"
521 modslist="$modslist memcached"
522 %endif
523 %if "%{with_osp}" == "yes"
524 modslist="$modslist osp"
525 %endif
526 %if "%{with_radius}" == "yes"
527 modslist="$modslist aaa_radius auth_aaa group uri"
528 %endif
529 %if "%{with_snmp}" == "yes"
530 modslist="$modslist snmpstats"
531 %endif
532 %if "%{with_bdb}" == "yes"
533 modslist="$modslist db_berkeley"
534 %endif
535 %if "%{with_mysql}" == "yes"
536 modslist="$modslist db_mysql"
537 %endif
538 %if "%{with_pgsql}" == "yes"
539 modslist="$modslist db_postgres"
540 %endif
541 %if "%{with_odbc}" == "yes"
542 modslist="$modslist db_unixodbc"
543 %endif
544 %if "%{with_geoip}" == "yes"
545 modslist="$modslist mmgeoip"
546 %endif
548 # install program, utils, and modules
549 %{l_make} %{l_mflags} \
550 INSTALL="%{l_shtool} install%{l_nil} -c" \
551 basedir=$RPM_BUILD_ROOT \
552 prefix=%{l_prefix} \
553 doc-dir=share/opensips/doc \
554 man-dir=man \
555 data-dir=share/opensips \
556 include_modules="$modslist" \
557 skip_modules="" \
558 install
560 # install rtpproxy software
561 %{l_shtool} install -c -s -m 755 \
562 rtpproxy-%{V_rtpproxy}/rtpproxy \
563 $RPM_BUILD_ROOT%{l_prefix}/sbin/rtpproxy
565 # strip down installation
566 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
568 # create installation hierarchy
569 %{l_shtool} mkdir -f -p -m 700 \
570 $RPM_BUILD_ROOT%{l_prefix}/var/opensips/acc \
571 $RPM_BUILD_ROOT%{l_prefix}/var/opensips/tmp
573 # install default configuration
574 %{l_shtool} mkdir -f -p -m 755 \
575 $RPM_BUILD_ROOT%{l_prefix}/etc/opensips
576 %{l_shtool} install -c -m 644 %{l_value -s -a} \
577 %{SOURCE opensips.cfg} \
578 $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/
580 # conditionally remove osipsconsole resources
581 %if "%{with_cons}" != "yes"
582 rm $RPM_BUILD_ROOT%{l_prefix}/sbin/osipsconsole
583 rm $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/osipsconsolerc
584 %endif
586 # install OSSP fsl configuration
587 %{l_shtool} mkdir -f -p -m 755 \
588 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
589 %{l_shtool} install -c -m 644 %{l_value -s -a} \
590 %{SOURCE fsl.opensips} \
591 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
593 # install runcommand script
594 %{l_shtool} mkdir -f -p -m 755 \
595 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
596 %{l_shtool} install -c -m 755 %{l_value -s -a} \
597 %{SOURCE rc.opensips} \
598 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
600 # determine installation files
601 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
602 %{l_files_std} \
603 '%not %dir %{l_prefix}/etc/fsl' \
604 '%config %{l_prefix}/etc/fsl/*' \
605 '%config %{l_prefix}/etc/opensips/*' \
606 '%doc %{l_prefix}/share/opensips/doc/*' \
607 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/opensips'
609 %files -f files
611 %clean
612 rm -rf $RPM_BUILD_ROOT
614 %post
615 # on install, setup database (osipsconsole db create /pfx/var/opensips/db)
616 if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then
617 %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \
618 $RPM_INSTALL_PREFIX/var/opensips/db
619 rm -f $RPM_INSTALL_PREFIX/share/opensips/dbtext/*.orig
620 %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \
621 $RPM_INSTALL_PREFIX/share/opensips/dbtext/* \
622 $RPM_INSTALL_PREFIX/var/opensips/db/
623 fi
625 # after upgrade, restart service
626 [ $1 -eq 2 ] || exit 0
627 eval `%{l_rc} opensips status 2>/dev/null`
628 [ ".$opensips_active" = .yes ] && %{l_rc} opensips restart
629 exit 0
631 %preun
632 # before erase, stop service and remove log files
633 [ $1 -eq 0 ] || exit 0
634 %{l_rc} opensips stop 2>/dev/null
635 rm -rf $RPM_INSTALL_PREFIX/var/opensips/db 2>/dev/null || true
636 rm -f $RPM_INSTALL_PREFIX/var/opensips/* 2>/dev/null || true
637 exit 0