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