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