Fri, 07 Oct 2011 16:34:24 +0200
Correct flawed path variables in build configuration.
michael@389 | 1 | ## |
michael@389 | 2 | ## kamailio.spec -- OpenPKG RPM Package Specification |
michael@389 | 3 | ## Copyright (c) 2011 Michael Schloh von Bennewitz <michael@schloh.com> |
michael@389 | 4 | ## |
michael@389 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@389 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@389 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@389 | 8 | ## copies. |
michael@389 | 9 | ## |
michael@389 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@389 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@389 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@389 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@389 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@389 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@389 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@389 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@389 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@389 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@389 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@389 | 21 | ## SUCH DAMAGE. |
michael@389 | 22 | ## |
michael@389 | 23 | |
michael@389 | 24 | # package information |
michael@389 | 25 | Name: kamailio |
michael@389 | 26 | Summary: Open Source SIP Server |
michael@389 | 27 | URL: http://www.kamailio.org/ |
michael@389 | 28 | Vendor: IPTelorg GmbH, Fraunhofer FOKUS, SIP Router Project |
michael@389 | 29 | Packager: Michael Schloh von Bennewitz |
michael@389 | 30 | Distribution: Europalab Networks Production |
michael@389 | 31 | Class: PLUS |
michael@389 | 32 | Group: VoIP |
michael@389 | 33 | License: GPL |
michael@389 | 34 | Version: 3.1.5 |
michael@391 | 35 | Release: 20111001 |
michael@389 | 36 | |
michael@389 | 37 | # package options |
michael@389 | 38 | %option with_cons yes |
michael@389 | 39 | %option with_fsl yes |
michael@389 | 40 | %option with_ssl yes |
michael@389 | 41 | %option with_sctp no |
michael@389 | 42 | %option with_croute no |
michael@389 | 43 | %option with_ldap no |
michael@389 | 44 | %option with_memcached no |
michael@389 | 45 | %option with_radius no |
michael@389 | 46 | %option with_snmp no |
michael@389 | 47 | %option with_bdb no |
michael@389 | 48 | %option with_mysql no |
michael@389 | 49 | %option with_osp no |
michael@389 | 50 | %option with_pgsql no |
michael@389 | 51 | %option with_odbc no |
michael@389 | 52 | %option with_geoip no |
michael@389 | 53 | %option with_lua no |
michael@389 | 54 | %option with_python no |
michael@389 | 55 | |
michael@389 | 56 | # list of sources |
michael@389 | 57 | Source0: http://www.kamailio.org/pub/kamailio/%{version}/src/kamailio-%{version}_src.tar.gz |
michael@389 | 58 | Source2: rc.kamailio |
michael@389 | 59 | Source3: fsl.kamailio |
michael@389 | 60 | |
michael@389 | 61 | # build information |
michael@389 | 62 | Prefix: %{l_prefix} |
michael@389 | 63 | BuildRoot: %{l_buildroot} |
michael@389 | 64 | BuildPreReq: OpenPKG, openpkg >= 20060823 |
michael@389 | 65 | PreReq: OpenPKG, openpkg >= 20060823 |
michael@389 | 66 | BuildPreReq: libxml, expat, curl, readline |
michael@389 | 67 | PreReq: libxml, expat, curl, readline |
michael@389 | 68 | BuildPreReq: make, gcc, flex, bison, sed, pkgconfig |
michael@389 | 69 | PreReq: bash |
michael@389 | 70 | %if "%{with_cons}" == "yes" |
michael@389 | 71 | PreReq: perl-dbi, perl-term |
michael@389 | 72 | %endif |
michael@389 | 73 | %if "%{with_fsl}" == "yes" |
michael@389 | 74 | BuildPreReq: fsl |
michael@389 | 75 | PreReq: fsl |
michael@389 | 76 | %endif |
michael@389 | 77 | %if "%{with_ssl}" == "yes" |
michael@389 | 78 | BuildPreReq: openssl |
michael@389 | 79 | PreReq: openssl |
michael@389 | 80 | %endif |
michael@389 | 81 | %if "%{with_croute}" == "yes" |
michael@389 | 82 | BuildPreReq: confuse |
michael@389 | 83 | PreReq: confuse |
michael@389 | 84 | %endif |
michael@389 | 85 | %if "%{with_ldap}" == "yes" |
michael@389 | 86 | BuildPreReq: openldap |
michael@389 | 87 | PreReq: openldap |
michael@389 | 88 | %endif |
michael@389 | 89 | %if "%{with_memcached}" == "yes" |
michael@389 | 90 | BuildPreReq: memcached |
michael@389 | 91 | PreReq: memcached |
michael@389 | 92 | %endif |
michael@389 | 93 | %if "%{with_osp}" == "yes" |
michael@389 | 94 | BuildPreReq: osptoolkit |
michael@389 | 95 | PreReq: osptoolkit |
michael@389 | 96 | %endif |
michael@389 | 97 | %if "%{with_radius}" == "yes" |
michael@389 | 98 | BuildPreReq: radiusclient |
michael@389 | 99 | PreReq: radiusclient |
michael@389 | 100 | %endif |
michael@389 | 101 | %if "%{with_snmp}" == "yes" |
michael@389 | 102 | BuildPreReq: snmp |
michael@389 | 103 | PreReq: snmp |
michael@389 | 104 | %endif |
michael@389 | 105 | %if "%{with_bdb}" == "yes" |
michael@389 | 106 | BuildPreReq: db |
michael@389 | 107 | PreReq: db |
michael@389 | 108 | %endif |
michael@389 | 109 | %if "%{with_mysql}" == "yes" |
michael@389 | 110 | BuildPreReq: mysql |
michael@389 | 111 | PreReq: mysql |
michael@389 | 112 | %endif |
michael@389 | 113 | %if "%{with_pgsql}" == "yes" |
michael@389 | 114 | BuildPreReq: postgresql |
michael@389 | 115 | PreReq: postgresql |
michael@389 | 116 | %endif |
michael@389 | 117 | %if "%{with_odbc}" == "yes" |
michael@389 | 118 | BuildPreReq: unixodbc |
michael@389 | 119 | PreReq: unixodbc |
michael@389 | 120 | %endif |
michael@389 | 121 | %if "%{with_geoip}" == "yes" |
michael@389 | 122 | BuildPreReq: geoip |
michael@389 | 123 | PreReq: geoip |
michael@389 | 124 | %endif |
michael@389 | 125 | %if "%{with_lua}" == "yes" |
michael@389 | 126 | BuildPreReq: lua |
michael@389 | 127 | PreReq: lua |
michael@389 | 128 | %endif |
michael@389 | 129 | %if "%{with_python}" == "yes" |
michael@389 | 130 | BuildPreReq: python |
michael@389 | 131 | PreReq: python |
michael@389 | 132 | %endif |
michael@389 | 133 | AutoReq: no |
michael@389 | 134 | AutoReqProv: no |
michael@389 | 135 | |
michael@389 | 136 | %description |
michael@389 | 137 | Kamailio is (beside Opensips) a successor to OpenSER, which in |
michael@389 | 138 | turn was spawned from FhG FOKUS's SIP Express Router (SER). It |
michael@389 | 139 | provides SIP (RFC3621) registrar, proxy and routing functionality. |
michael@389 | 140 | A C shell like scripting language provides for control over the |
michael@389 | 141 | server's behaviour. It's modular architecture allows for fine |
michael@389 | 142 | grained loading of required functionality. |
michael@389 | 143 | |
michael@389 | 144 | Kamailio can be used as a: Kamailio fits in scenarios: |
michael@389 | 145 | |
michael@389 | 146 | Registrar server SIP trunking |
michael@389 | 147 | Router, proxy SIP load balancing |
michael@389 | 148 | Redirect server SIP front end termination |
michael@389 | 149 | Presence agent Residential providers |
michael@389 | 150 | Back to back user agent white label solutions |
michael@389 | 151 | Instant messaging server Enterprise services |
michael@389 | 152 | SIP to SMS gateway LCR for multi gateways |
michael@389 | 153 | SIP to XMPP gateway |
michael@389 | 154 | Load balancer or dispatcher |
michael@389 | 155 | Front end for asterisk |
michael@389 | 156 | NAT traversal unit |
michael@389 | 157 | Application server |
michael@389 | 158 | |
michael@389 | 159 | %track |
michael@389 | 160 | prog kamailio = { |
michael@389 | 161 | version = %{version} |
michael@389 | 162 | url = http://www.kamailio.org/pub/kamailio/ |
michael@389 | 163 | regex = (\d+\.\d+\.\d+)/ |
michael@389 | 164 | url = http://www.kamailio.org/pub/kamailio/__NEWVER__/src/ |
michael@389 | 165 | regex = kamailio-(__VER__)_src\.tar\.gz |
michael@389 | 166 | } |
michael@389 | 167 | |
michael@389 | 168 | %prep |
michael@389 | 169 | %setup -q |
michael@389 | 170 | %{l_shtool} subst \ |
michael@389 | 171 | -e 's;\$(LOCALBASE)/[^/][^/]*/sctp.h;;g' \ |
michael@389 | 172 | -e 's;\$(LOCALBASE)/ssl/include;`%{l_prefix}/bin/pkg-config --cflags-only-I openssl`;g' \ |
michael@389 | 173 | -e 's;\$(LOCALBASE)/ssl/lib;`%{l_prefix}/bin/pkg-config --libs openssl`;g' \ |
michael@389 | 174 | -e 's;LOCALBASE *[\?:]*=.*;LOCALBASE = %{l_prefix};g' \ |
michael@391 | 175 | -e 's;\(data_dir\) *=.*;\1 = share/$(MAIN_NAME);g' \ |
michael@391 | 176 | -e 's;\(doc_dir\) *=.*;\1 = share/$(MAIN_NAME)/doc;g' \ |
michael@391 | 177 | -e 's;\(man_dir\) *=.*;\1 = man/;g' \ |
michael@389 | 178 | Makefile.defs |
michael@389 | 179 | %{l_shtool} subst \ |
michael@389 | 180 | -e 's;CFLAGS *= *$;CFLAGS = %{l_cflags -O};g' \ |
michael@389 | 181 | -e 's;LDFLAGS *= *$;LDFLAGS = %{l_ldflags};g' \ |
michael@389 | 182 | -e 's;C_INCLUDES *= *$;C_INCLUDES = %{l_cppflags};g' \ |
michael@389 | 183 | Makefile.defs |
michael@389 | 184 | %{l_shtool} subst \ |
michael@389 | 185 | -e 's;/usr/include/readline/readline.h;;g' \ |
michael@389 | 186 | utils/sercmd/Makefile |
michael@389 | 187 | %{l_shtool} subst \ |
michael@389 | 188 | -e 's;-I$(LOCALBASE)/Berkeley[^ ]* *;;g' \ |
michael@389 | 189 | -e 's;-I$(LOCALBASE)/include[^ ]* *;;g' \ |
michael@389 | 190 | -e 's;-I$(SYSBASE)/include[^ ]* *;;g' \ |
michael@389 | 191 | -e 's;LIBS=.*;LIBS=`%{l_prefix}/bin/pkg-config --libs db`;g' \ |
michael@389 | 192 | utils/db_berkeley/Makefile |
michael@389 | 193 | %{l_shtool} subst \ |
michael@391 | 194 | -e 's;\(\$(data_prefix)/\$(data_dir)/.*\)/kamailio;\1;g' \ |
michael@389 | 195 | utils/kamctl/Makefile |
michael@389 | 196 | %{l_shtool} subst \ |
michael@389 | 197 | -e 's;\(radiusclient\)-ng;\1;g' \ |
michael@389 | 198 | -e 's;/usr/local\(/etc/radiusclient/radiusclient.conf\);%{l_prefix}\1;' \ |
michael@389 | 199 | Makefile.radius \ |
michael@389 | 200 | lib/kcore/radius.h \ |
michael@389 | 201 | modules_s/avp_radius/avp_radius.c \ |
michael@389 | 202 | modules_s/uri_radius/checks.c \ |
michael@389 | 203 | modules_s/uri_radius/urirad_mod.c \ |
michael@389 | 204 | modules_s/acc_radius/acc_radius.c \ |
michael@389 | 205 | modules_s/auth_radius/authrad_mod.c \ |
michael@389 | 206 | modules_s/auth_radius/sterman.h |
michael@389 | 207 | %{l_shtool} subst \ |
michael@389 | 208 | -e 's;\(DEFS *[\?:+]*=[^\\]*\);\1 -D__EXTENSIONS__;g' \ |
michael@389 | 209 | modules/db_mysql/Makefile \ |
michael@389 | 210 | modules/xmlrpc/Makefile |
michael@389 | 211 | %{l_shtool} subst \ |
michael@389 | 212 | -e 's;\(-keyout.*\);\1 || true;' \ |
michael@389 | 213 | modules/tls/sip-router_cert.sh |
michael@389 | 214 | |
michael@389 | 215 | %build |
michael@389 | 216 | # select modules |
michael@389 | 217 | modslist='acc alias_db auth auth_identity avp avpops avp_db benchmark blst call_control cfgutils cfg_db cfg_rpc counters cpl-c ctl db_text db_flatstore db_ops debugger dialog dialplan dispatcher diversion domain domainpolicy drouting eval exec enum fifo gflags group htable identity imc kex lcr malloc_test mangler matrix maxfwd mi_datagram mi_fifo mi_rpc mediaproxy mqueue msilo mtree nathelper nat_traversal options path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route presence presence_conference presence_dialoginfo presence_mwi presence_xml privacy pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity seas siptrace siputils sl sms speeddial sqlops sst statistics textops textopsx timer tm tmx topoh uac uac_redirect uri uri_db userblacklist usrloc utils xcap xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp' |
michael@389 | 218 | %if "%{with_ssl}" == "yes" |
michael@389 | 219 | modslist="$modslist tls" |
michael@389 | 220 | %endif |
michael@389 | 221 | %if "%{with_croute}" == "yes" |
michael@389 | 222 | modslist="$modslist carrierroute" |
michael@389 | 223 | %endif |
michael@389 | 224 | %if "%{with_ldap}" == "yes" |
michael@389 | 225 | modslist="$modslist ldap h350" |
michael@389 | 226 | %endif |
michael@389 | 227 | %if "%{with_memcached}" == "yes" |
michael@389 | 228 | modslist="$modslist memcached" |
michael@389 | 229 | %endif |
michael@389 | 230 | %if "%{with_osp}" == "yes" |
michael@389 | 231 | modslist="$modslist osp" |
michael@389 | 232 | %endif |
michael@389 | 233 | %if "%{with_radius}" == "yes" |
michael@389 | 234 | modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius" |
michael@389 | 235 | %endif |
michael@389 | 236 | %if "%{with_snmp}" == "yes" |
michael@389 | 237 | modslist="$modslist snmpstats" |
michael@389 | 238 | %endif |
michael@389 | 239 | %if "%{with_bdb}" == "yes" |
michael@389 | 240 | modslist="$modslist db_berkeley" |
michael@389 | 241 | %endif |
michael@389 | 242 | %if "%{with_mysql}" == "yes" |
michael@389 | 243 | modslist="$modslist db_mysql" |
michael@389 | 244 | %endif |
michael@389 | 245 | %if "%{with_pgsql}" == "yes" |
michael@389 | 246 | modslist="$modslist db_postgres" |
michael@389 | 247 | %endif |
michael@389 | 248 | %if "%{with_odbc}" == "yes" |
michael@389 | 249 | modslist="$modslist db_unixodbc" |
michael@389 | 250 | %endif |
michael@389 | 251 | %if "%{with_lua}" == "yes" |
michael@389 | 252 | modslist="$modslist app_lua" |
michael@389 | 253 | %endif |
michael@389 | 254 | %if "%{with_python}" == "yes" |
michael@389 | 255 | modslist="$modslist app_python" |
michael@389 | 256 | %endif |
michael@389 | 257 | %if "%{with_geoip}" == "yes" |
michael@389 | 258 | modslist="$modslist geoip" |
michael@389 | 259 | %endif |
michael@389 | 260 | |
michael@389 | 261 | # build configuration |
michael@389 | 262 | %{l_make} %{l_mflags} \ |
michael@389 | 263 | CC="%{l_cc}" \ |
michael@389 | 264 | FLAVOUR=kamailio \ |
michael@389 | 265 | %if "%{with_sctp}" == "yes" |
michael@389 | 266 | SCTP=1 \ |
michael@389 | 267 | %endif |
michael@389 | 268 | %if "%{with_ssl}" == "yes" |
michael@389 | 269 | TLS_HOOKS=1 \ |
michael@389 | 270 | %endif |
michael@389 | 271 | prefix=%{l_prefix} \ |
michael@389 | 272 | cfg |
michael@389 | 273 | |
michael@389 | 274 | # build program |
michael@389 | 275 | %{l_make} %{l_mflags -O} \ |
michael@389 | 276 | CC="%{l_cc}" \ |
michael@389 | 277 | %if "%{with_sctp}" == "yes" |
michael@389 | 278 | SCTP=1 \ |
michael@389 | 279 | %endif |
michael@389 | 280 | %if "%{with_ssl}" == "yes" |
michael@389 | 281 | TLS_HOOKS=1 \ |
michael@389 | 282 | %endif |
michael@389 | 283 | prefix=%{l_prefix} \ |
michael@389 | 284 | kamailio |
michael@389 | 285 | |
michael@389 | 286 | # build utilities |
michael@389 | 287 | %{l_make} %{l_mflags -O} \ |
michael@389 | 288 | CC="%{l_cc}" \ |
michael@389 | 289 | %if "%{with_sctp}" == "yes" |
michael@389 | 290 | SCTP=1 \ |
michael@389 | 291 | %endif |
michael@389 | 292 | %if "%{with_ssl}" == "yes" |
michael@389 | 293 | TLS_HOOKS=1 \ |
michael@389 | 294 | %endif |
michael@389 | 295 | prefix=%{l_prefix} \ |
michael@389 | 296 | modules="$modslist" \ |
michael@389 | 297 | utils utils/kamctl |
michael@389 | 298 | |
michael@389 | 299 | # build modules |
michael@389 | 300 | %{l_make} %{l_mflags -O} \ |
michael@389 | 301 | CC="%{l_cc}" \ |
michael@389 | 302 | LD_RPATH=-Wl,-rpath, \ |
michael@389 | 303 | SER_RPATH_LST=%{l_prefix}/lib/kamailio \ |
michael@389 | 304 | %if "%{with_sctp}" == "yes" |
michael@389 | 305 | SCTP=1 \ |
michael@389 | 306 | %endif |
michael@389 | 307 | %if "%{with_ssl}" == "yes" |
michael@389 | 308 | TLS_HOOKS=1 \ |
michael@389 | 309 | %endif |
michael@389 | 310 | include_modules="$modslist" \ |
michael@389 | 311 | skip_modules="" \ |
michael@389 | 312 | prefix=%{l_prefix} \ |
michael@389 | 313 | every-module |
michael@389 | 314 | |
michael@389 | 315 | %install |
michael@389 | 316 | rm -rf $RPM_BUILD_ROOT |
michael@389 | 317 | |
michael@389 | 318 | # select modules |
michael@389 | 319 | modslist='acc alias_db auth auth_identity avp avpops avp_db benchmark blst call_control cfgutils cfg_db cfg_rpc counters cpl-c ctl db_text db_flatstore db_ops debugger dialog dialplan dispatcher diversion domain domainpolicy drouting eval exec enum fifo gflags group htable identity imc kex lcr malloc_test mangler matrix maxfwd mi_datagram mi_fifo mi_rpc mediaproxy mqueue msilo mtree nathelper nat_traversal options path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route presence presence_conference presence_dialoginfo presence_mwi presence_xml privacy pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp pv qos ratelimit regex registrar rr rls rtimer rtpproxy sanity seas siptrace siputils sl sms speeddial sqlops sst statistics textops textopsx timer tm tmx topoh uac uac_redirect uri uri_db userblacklist usrloc utils xcap xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp' |
michael@389 | 320 | %if "%{with_ssl}" == "yes" |
michael@389 | 321 | modslist="$modslist tls" |
michael@389 | 322 | %endif |
michael@389 | 323 | %if "%{with_croute}" == "yes" |
michael@389 | 324 | modslist="$modslist carrierroute" |
michael@389 | 325 | %endif |
michael@389 | 326 | %if "%{with_ldap}" == "yes" |
michael@389 | 327 | modslist="$modslist ldap h350" |
michael@389 | 328 | %endif |
michael@389 | 329 | %if "%{with_memcached}" == "yes" |
michael@389 | 330 | modslist="$modslist memcached" |
michael@389 | 331 | %endif |
michael@389 | 332 | %if "%{with_osp}" == "yes" |
michael@389 | 333 | modslist="$modslist osp" |
michael@389 | 334 | %endif |
michael@389 | 335 | %if "%{with_radius}" == "yes" |
michael@389 | 336 | modslist="$modslist acc_radius auth_radius avp_radius group misc_radius uri_radius" |
michael@389 | 337 | %endif |
michael@389 | 338 | %if "%{with_snmp}" == "yes" |
michael@389 | 339 | modslist="$modslist snmpstats" |
michael@389 | 340 | %endif |
michael@389 | 341 | %if "%{with_bdb}" == "yes" |
michael@389 | 342 | modslist="$modslist db_berkeley" |
michael@389 | 343 | %endif |
michael@389 | 344 | %if "%{with_mysql}" == "yes" |
michael@389 | 345 | modslist="$modslist db_mysql" |
michael@389 | 346 | %endif |
michael@389 | 347 | %if "%{with_pgsql}" == "yes" |
michael@389 | 348 | modslist="$modslist db_postgres" |
michael@389 | 349 | %endif |
michael@389 | 350 | %if "%{with_odbc}" == "yes" |
michael@389 | 351 | modslist="$modslist db_unixodbc" |
michael@389 | 352 | %endif |
michael@389 | 353 | %if "%{with_lua}" == "yes" |
michael@389 | 354 | modslist="$modslist app_lua" |
michael@389 | 355 | %endif |
michael@389 | 356 | %if "%{with_python}" == "yes" |
michael@389 | 357 | modslist="$modslist app_python" |
michael@389 | 358 | %endif |
michael@389 | 359 | %if "%{with_geoip}" == "yes" |
michael@389 | 360 | modslist="$modslist geoip" |
michael@389 | 361 | %endif |
michael@389 | 362 | |
michael@389 | 363 | # install program, utils, and modules |
michael@389 | 364 | %{l_make} %{l_mflags} \ |
michael@389 | 365 | INSTALL="%{l_shtool} install -c" \ |
michael@389 | 366 | INSTALL_CFG="%{l_shtool} install -c" \ |
michael@389 | 367 | INSTALL_BIN="%{l_shtool} install -c" \ |
michael@389 | 368 | INSTALL_SCRIPT="%{l_shtool} install -c" \ |
michael@389 | 369 | INSTALL_MODULES="%{l_shtool} install -c" \ |
michael@389 | 370 | INSTALL_LIB="%{l_shtool} install -c" \ |
michael@389 | 371 | INSTALL_DOC="%{l_shtool} install -c" \ |
michael@389 | 372 | INSTALL_MAN="%{l_shtool} install -c" \ |
michael@389 | 373 | INSTALL_SHARE="%{l_shtool} install -c" \ |
michael@389 | 374 | basedir=$RPM_BUILD_ROOT \ |
michael@389 | 375 | prefix=%{l_prefix} \ |
michael@389 | 376 | doc-dir=share/kamailio/doc \ |
michael@389 | 377 | man-dir=man \ |
michael@389 | 378 | data-dir=share/kamailio \ |
michael@389 | 379 | include_modules="$modslist" \ |
michael@389 | 380 | skip_modules="" \ |
michael@389 | 381 | install |
michael@389 | 382 | |
michael@389 | 383 | # strip down installation |
michael@389 | 384 | strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true |
michael@389 | 385 | |
michael@389 | 386 | # create installation hierarchy |
michael@389 | 387 | %{l_shtool} mkdir -f -p -m 700 \ |
michael@389 | 388 | $RPM_BUILD_ROOT%{l_prefix}/var/kamailio |
michael@389 | 389 | |
michael@389 | 390 | # install OSSP fsl configuration |
michael@389 | 391 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@389 | 392 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@389 | 393 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@389 | 394 | %{SOURCE fsl.kamailio} \ |
michael@389 | 395 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@389 | 396 | |
michael@389 | 397 | # install runcommand script |
michael@389 | 398 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@389 | 399 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@389 | 400 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@389 | 401 | %{SOURCE rc.kamailio} \ |
michael@389 | 402 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@389 | 403 | |
michael@389 | 404 | # determine installation files |
michael@389 | 405 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@389 | 406 | %{l_files_std} \ |
michael@389 | 407 | '%not %dir %{l_prefix}/etc/fsl' \ |
michael@389 | 408 | '%config %{l_prefix}/etc/fsl/*' \ |
michael@389 | 409 | '%config %{l_prefix}/etc/kamailio/*' \ |
michael@389 | 410 | '%doc %{l_prefix}/share/kamailio/doc/*' \ |
michael@389 | 411 | '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/kamailio' |
michael@389 | 412 | |
michael@389 | 413 | %files -f files |
michael@389 | 414 | |
michael@389 | 415 | %clean |
michael@389 | 416 | rm -rf $RPM_BUILD_ROOT |
michael@389 | 417 | |
michael@389 | 418 | %post |
michael@389 | 419 | # on install, setup database (kamctl db create /pfx/var/kamailio/db) |
michael@389 | 420 | if [ ! -d $RPM_INSTALL_PREFIX/var/kamailio/db ]; then |
michael@389 | 421 | %{l_shtool} mkdir -f -p -m 700 -o %{l_rusr} -g %{l_rgrp} \ |
michael@389 | 422 | $RPM_INSTALL_PREFIX/var/kamailio/db |
michael@389 | 423 | rm -f $RPM_INSTALL_PREFIX/share/kamailio/dbtext/*.orig |
michael@389 | 424 | %{l_shtool} install -c -m 600 -o %{l_rusr} -g %{l_rgrp} \ |
michael@389 | 425 | $RPM_INSTALL_PREFIX/share/kamailio/dbtext/* \ |
michael@389 | 426 | $RPM_INSTALL_PREFIX/var/kamailio/db/ |
michael@389 | 427 | fi |
michael@389 | 428 | |
michael@389 | 429 | # after upgrade, restart service |
michael@389 | 430 | [ $1 -eq 2 ] || exit 0 |
michael@389 | 431 | eval `%{l_rc} kamailio status 2>/dev/null` |
michael@389 | 432 | [ ".$kamailio_active" = .yes ] && %{l_rc} kamailio restart |
michael@389 | 433 | exit 0 |
michael@389 | 434 | |
michael@389 | 435 | %preun |
michael@389 | 436 | # before erase, stop service and remove log files |
michael@389 | 437 | [ $1 -eq 0 ] || exit 0 |
michael@389 | 438 | %{l_rc} kamailio stop 2>/dev/null |
michael@389 | 439 | rm -rf $RPM_INSTALL_PREFIX/var/kamailio/db 2>/dev/null || true |
michael@389 | 440 | rm -f $RPM_INSTALL_PREFIX/var/kamailio/* 2>/dev/null || true |
michael@389 | 441 | exit 0 |
michael@389 | 442 |