asterisk/asterisk.spec

Thu, 22 Mar 2012 21:33:42 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Mar 2012 21:33:42 +0100
changeset 411
e4385d1fd937
parent 405
375c04ff28ba
child 414
fd611cde817f
permissions
-rw-r--r--

Correct nasty intermediate cert open flaw and make requirements consistent.

michael@202 1 ##
michael@202 2 ## asterisk.spec -- OpenPKG RPM Package Specification
michael@311 3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@202 4 ##
michael@202 5 ## Permission to use, copy, modify, and distribute this software for
michael@202 6 ## any purpose with or without fee is hereby granted, provided that
michael@202 7 ## the above copyright notice and this permission notice appear in all
michael@202 8 ## copies.
michael@202 9 ##
michael@202 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@202 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@202 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@202 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@202 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@202 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@202 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@202 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@202 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@202 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@202 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@202 21 ## SUCH DAMAGE.
michael@202 22 ##
michael@202 23
michael@310 24 # package version
michael@405 25 %define V_opkg 1.8.10.1
michael@405 26 %define V_asterisk 1.8.10.1
michael@347 27 %define V_asterisk_fax_subdir 1.8.4
michael@347 28 %define V_asterisk_fax_digium 1.8.4_1.3.0
michael@398 29 %define V_asterisk_sounds_core 1.4.22
michael@311 30 %define V_asterisk_sounds_extra 1.4.11
michael@311 31 %define V_asterisk_sounds_amoogab 1.4
michael@311 32 %define V_asterisk_sounds_amootts current
michael@311 33 %define V_asterisk_sounds_custom 1.0
michael@311 34 %define V_asterisk_sounds_mohop 2.03
michael@311 35 %define V_asterisk_addons_mp3dec 1
michael@362 36 %define V_fswitch_sounds_en 1.0.16
michael@398 37 %define V_fswitch_sounds_fr 1.0.14
michael@362 38 %define V_fswitch_sounds_ru 1.0.13
michael@311 39 %define V_fswitch_music 1.0.8
michael@311 40 %define V_asterisk_codecs_ilbc 20110104
michael@362 41 %define V_chan_capi 1.1.5.20110914
michael@202 42
michael@202 43 # package information
michael@202 44 Name: asterisk
michael@310 45 Summary: Private Branch Exchange (PBX)
michael@202 46 URL: http://www.asterisk.org/
michael@202 47 Vendor: Mark Spencer et al.
michael@310 48 Packager: OpenPKG Foundation e.V.
michael@310 49 Distribution: OpenPKG Community
michael@310 50 Class: BASE
michael@202 51 Group: VoIP
michael@202 52 License: GPL
michael@310 53 Version: %{V_opkg}
michael@411 54 Release: 20120320
michael@202 55
michael@202 56 # package options
michael@310 57 %option with_dahdi no
michael@310 58 %option with_capi no
michael@310 59 %option with_ogg no
michael@310 60 %option with_mp3 no
michael@310 61 %option with_fax no
michael@310 62 %option with_avcodec no
michael@310 63 %option with_ldap no
michael@310 64 %option with_radius no
michael@310 65 %option with_sqlite no
michael@311 66 %option with_srtp no
michael@311 67 %option with_pgsql no
michael@310 68 %option with_lua no
michael@399 69 %option with_gtalk no
michael@310 70 %option with_jabber no
michael@310 71 %option with_imap no
michael@310 72 %option with_odbc no
michael@311 73 %option with_libpri no
michael@311 74 %option with_esounds no
michael@311 75 %option with_xfersips yes
michael@311 76 %option with_proxymwi yes
michael@311 77 %option with_smdipoll 10
michael@202 78
michael@202 79 # list of sources
michael@310 80 Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
michael@311 81 Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
michael@311 82 Source2: ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz
michael@362 83
michael@311 84 Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
michael@400 85 Source4: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@400 86 Source5: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@405 87 Source6: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en_AU-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@400 88 Source7: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-fr-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@405 89 Source8: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-ru-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@400 90 Source9: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-sln16-%{V_asterisk_sounds_extra}.tar.gz
michael@400 91 Source10: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-fr-sln16-%{V_asterisk_sounds_extra}.tar.gz
michael@400 92 Source11: http://www.amooma.de/asterisk/sprachbausteine/asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz
michael@400 93 Source12: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-current.tar.gz
michael@400 94 Source13: ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/de-digits-%{V_asterisk_sounds_custom}.tar.bz2
michael@400 95 Source14: ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2
michael@400 96 Source15: ftp://ftp.europalab.com/pub/sfw/machsnds/msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2
michael@400 97 Source16: http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
michael@400 98 Source17: http://files.freeswitch.org/freeswitch-sounds-es-mx-maria-44100.tar.gz
michael@400 99 Source18: http://files.freeswitch.org/freeswitch-sounds-fr-ca-june-48000-%{V_fswitch_sounds_fr}.tar.gz
michael@400 100 Source19: http://files.freeswitch.org/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
michael@400 101 Source20: http://files.freeswitch.org/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
michael@400 102 Source21: http://svn.digium.com/svn/thirdparty/mp3/trunk/addons/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
michael@400 103 Source22: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-64/res_fax_digium-%{V_asterisk_fax_digium}-generic_64.tar.gz
michael@400 104 Source23: http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-%{V_asterisk_fax_subdir}/x86-32/res_fax_digium-%{V_asterisk_fax_digium}-generic_32.tar.gz
michael@400 105 Source24: ilbc-20110104.tar.gz
michael@400 106 Source25: asterisk.txt
michael@400 107 Source26: rc.asterisk
michael@400 108 Source27: wakeup.agi
michael@202 109 Patch0: asterisk.patch
michael@311 110 Patch1: asterisk.patch.xfersips
michael@311 111 Patch2: asterisk.patch.proxymwi
michael@202 112
michael@202 113 # build information
michael@311 114 Prefix: %{l_prefix}
michael@311 115 BuildRoot: %{l_buildroot}
michael@411 116 BuildPreReq: OpenPKG, openpkg >= 20060823, bison, gcc, make, grep, pkgconfig
michael@411 117 PreReq: OpenPKG, openpkg >= 20060823, MTA
michael@311 118 BuildPreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
michael@311 119 PreReq: zlib, curl, openssl, ncurses, speex, sox, popt, gmime, libxml
michael@310 120 %if "%{with_ogg}" == "yes"
michael@310 121 BuildPreReq: vorbis-libs
michael@310 122 PreReq: vorbis-libs
michael@310 123 %endif
michael@310 124 %if "%{with_mp3}" == "yes"
michael@310 125 PreReq: mpg123
michael@310 126 %endif
michael@310 127 %if "%{with_imap}" == "yes"
michael@310 128 BuildPreReq: imap
michael@310 129 PreReq: imap
michael@310 130 %endif
michael@310 131 %if "%{with_sqlite}" == "yes"
michael@310 132 BuildPreReq: sqlite
michael@310 133 PreReq: sqlite
michael@310 134 %endif
michael@311 135 %if "%{with_srtp}" == "yes"
michael@311 136 BuildPreReq: srtp
michael@311 137 PreReq: srtp
michael@311 138 %endif
michael@311 139 %if "%{with_pgsql}" == "yes"
michael@311 140 BuildPreReq: postgresql
michael@311 141 PreReq: postgresql
michael@311 142 %endif
michael@310 143 %if "%{with_lua}" == "yes"
michael@310 144 BuildPreReq: lua
michael@310 145 PreReq: lua
michael@310 146 %endif
michael@310 147 %if "%{with_avcodec}" == "yes"
michael@310 148 BuildPreReq: ffmpeg
michael@310 149 PreReq: ffmpeg
michael@310 150 %endif
michael@310 151 %if "%{with_ldap}" == "yes"
michael@310 152 BuildPreReq: openldap
michael@310 153 PreReq: openldap
michael@202 154 %endif
michael@202 155 %if "%{with_radius}" == "yes"
michael@202 156 BuildPreReq: radiusclient
michael@202 157 PreReq: radiusclient
michael@202 158 %endif
michael@399 159 %if "%{with_gtalk}" == "yes"
michael@399 160 %define with_jabber yes
michael@399 161 %endif
michael@310 162 %if "%{with_jabber}" == "yes"
michael@310 163 BuildPreReq: iksemel
michael@310 164 PreReq: iksemel
michael@202 165 %endif
michael@310 166 %if "%{with_odbc}" == "yes"
michael@310 167 BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes
michael@310 168 PreReq: unixodbc, sqlite, sqlite::with_odbc = yes
michael@202 169 %endif
michael@311 170 %if "%{with_libpri}" == "yes"
michael@311 171 BuildPreReq: libpri > 1.4.11.5
michael@311 172 PreReq: libpri > 1.4.11.5
michael@311 173 %endif
michael@311 174 %if "%{with_esounds}" == "yes"
michael@311 175 BuildPreReq: sox
michael@311 176 %endif
michael@311 177 AutoReq: no
michael@311 178 AutoReqProv: no
michael@202 179
michael@202 180 %description
michael@202 181 Asterisk is a complete Private Branch Exchange (PBX) in software.
michael@311 182 It provides more than the features normally expected from a PBX,
michael@311 183 and can transceive Voice over IP (VoIP) in many protocols. Asterisk
michael@311 184 provides voicemail services with directory, call conferencing,
michael@311 185 interactive voice response and call queuing as well. It has support
michael@311 186 for three way calling, caller ID, ADSI, and SIP, and requires no
michael@311 187 additional hardware for VoIP applications.
michael@311 188
michael@311 189 This copy of Asterisk is optionally patched to allow the asterisk
michael@311 190 server to respond to SIP/TLS transfer requests using the Transfer()
michael@311 191 application. Should this option be chosen, the asterisk server
michael@311 192 successfully dispatches all transfer destinations using 'SIPS'
michael@311 193 technology by means of the standard SIP/2.0 302 Moved Temporarily
michael@311 194 message, with a URI resembling <sips:extension@hostname.tld:port>.
michael@311 195
michael@311 196 This copy of Asterisk is optionally patched as well to enclose the
michael@311 197 correct user name in NOTIFY messages when MWI logic detects changes
michael@311 198 in the state of Messages-Waiting. Asterisk will send NOTIFY messages
michael@311 199 with the URI 'user@hostname' instead of simply 'hostname'. This can
michael@311 200 be used by a external SIP proxy to route the MWI to the correct phone.
michael@202 201
michael@202 202 %track
michael@202 203 prog asterisk = {
michael@310 204 version = %{V_asterisk}
michael@310 205 url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
michael@310 206 regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
michael@310 207 }
michael@311 208 prog asterisk:fax_digium_32 = {
michael@311 209 version = %{V_asterisk_fax_digium}
michael@311 210 url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/
michael@311 211 regex = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz
michael@310 212 }
michael@311 213 prog asterisk:fax_digium_64 = {
michael@311 214 version = %{V_asterisk_fax_digium}
michael@311 215 url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-64/
michael@311 216 regex = res_fax_digium-(__VER__)-generic_64.tar.gz\.tar\.gz
michael@311 217 }
michael@311 218 prog asterisk:sounds_core = {
michael@311 219 version = %{V_asterisk_sounds_core}
michael@310 220 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
michael@311 221 regex = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
michael@310 222 }
michael@311 223 prog asterisk:sounds_extra = {
michael@311 224 version = %{V_asterisk_sounds_extra}
michael@310 225 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
michael@311 226 regex = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
michael@310 227 }
michael@311 228 prog asterisk:sounds_amootts = {
michael@311 229 version = %{V_asterisk_sounds_amootts}
michael@310 230 url = http://www.amooma.de/asterisk/sprachbausteine/
michael@310 231 regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz
michael@310 232 }
michael@311 233 prog asterisk:sounds_amoogab = {
michael@311 234 version = %{V_asterisk_sounds_amoogab}
michael@311 235 url = http://www.amooma.de/asterisk/sprachbausteine/
michael@311 236 regex = asterisk-(__VER__)-de-prompts\.tar\.gz
michael@311 237 }
michael@311 238 prog asterisk:sounds_digits = {
michael@311 239 version = %{V_asterisk_sounds_custom}
michael@311 240 url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-digits/
michael@311 241 regex = de-digits-(__VER__)\.tar\.bz2
michael@311 242 }
michael@311 243 prog asterisk:sounds_custom = {
michael@311 244 version = %{V_asterisk_sounds_custom}
michael@311 245 url = ftp://ftp.europalab.com/pub/sfw/machsnds/de-sounds/
michael@311 246 regex = astmultisnds-de-sln16-(__VER__)\.tar\.bz2
michael@311 247 }
michael@311 248 prog asterisk:sounds_mohop = {
michael@311 249 version = %{V_asterisk_sounds_mohop}
michael@311 250 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
michael@311 251 regex = asterisk-moh-opsound-sln16-(__VER__)\.tar\.gz
michael@311 252 }
michael@310 253 prog asterisk:chan_capi = {
michael@310 254 version = %{V_chan_capi}
michael@310 255 url = ftp://ftp.chan-capi.org/chan-capi/
michael@310 256 regex = chan_capi-(__VER__)\.tar\.gz
michael@202 257 }
michael@202 258
michael@202 259 %prep
michael@399 260 %if "%{with_capi}" == "yes"
michael@399 261 ( echo "Note that the system header files capi20.h, capicmd.h, and capiutils.h might"
michael@399 262 echo "need adjusting in accordance withthe CAPI hardware vendor's kernel driver."
michael@399 263 ) | %{l_rpmtool} msg -b -t warn
michael@399 264 %endif
michael@310 265 %setup -q -n asterisk-%{V_asterisk}
michael@310 266 %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
michael@311 267 %setup -q -n asterisk-%{V_asterisk} -D -T -a 2
michael@311 268 %if "%{with_fax}" == "yes"
michael@400 269 %setup -q -n asterisk-%{V_asterisk} -D -T -a 22
michael@400 270 %setup -q -n asterisk-%{V_asterisk} -D -T -a 23
michael@311 271 %endif
michael@311 272 ( cd addons
michael@311 273 %{l_tar} zxf %{_sourcedir}/mp3-%{V_asterisk_addons_mp3dec}.tar.gz
michael@311 274 ) || exit $?
michael@311 275 ( cd codecs
michael@311 276 %{l_tar} zxf %{_sourcedir}/ilbc-%{V_asterisk_codecs_ilbc}.tar.gz
michael@311 277 mv ilbc-%{V_asterisk_codecs_ilbc}/* ilbc/
michael@311 278 rmdir ilbc-%{V_asterisk_codecs_ilbc}
michael@311 279 ) || exit $?
michael@202 280 %patch -p0
michael@311 281 %if "%{with_xfersips}" == "yes"
michael@311 282 %patch -p0 -P 1
michael@311 283 %endif
michael@311 284 %if "%{with_proxymwi}" == "yes"
michael@311 285 %patch -p0 -P 2
michael@311 286 %endif
michael@310 287 %{l_shtool} subst \
michael@311 288 -e 's;\(astdatadir=.*\)\${astvarlibdir};\1${datadir};' \
michael@311 289 -e 's;\(astvarlibdir=.*\)/lib/asterisk;\1/asterisk/lib;' \
michael@399 290 -e 's;\(astdbdir=.*\)\${astvarlibdir};\1${localstatedir}/asterisk/db;' \
michael@311 291 -e 's;\(dir=.*{localstatedir}\)/\([^/][^/]*\)/asterisk;\1/asterisk/\2;g' \
michael@311 292 configure
michael@311 293 %{l_shtool} subst \
michael@311 294 -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
michael@311 295 -e 's;\(sqlite\)\(_exec\);\13\2;g' \
michael@311 296 -e 's;-lradiusclient-ng;-lradiusclient;g' \
michael@311 297 -e 's;radiusclient-ng\.h;radiusclient.h;g' \
michael@398 298 -e 's;lua5\.1;lua;g' \
michael@311 299 -e 's;-I${IMAP_TK_DIR}/c-client;-DUSE_SYSTEM_IMAP -I${IMAP_TK_DIR}/include/imap;g' \
michael@311 300 -e 's;${IMAP_TK_DIR}/c-client/c-client\.a;-limap -lssl -lcrypto -lcrypt;g' \
michael@311 301 configure
michael@311 302 %{l_shtool} subst \
michael@311 303 -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \
michael@311 304 configure
michael@311 305 %{l_shtool} subst \
michael@311 306 -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \
michael@311 307 build_tools/make_defaults_h
michael@311 308 %{l_shtool} subst \
michael@362 309 -e 's;^\(_all:.* *\)cleantest *;\1;' \
michael@311 310 -e 's; *-I/usr/local/ssl/include;;g' \
michael@311 311 -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
michael@311 312 -e 's;/usr/local;%{l_prefix};g' \
michael@311 313 Makefile
michael@311 314 %{l_shtool} subst \
michael@311 315 -e 's;\$(SUBMAKE);$(MAKE);g' \
michael@311 316 -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \
michael@311 317 -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \
michael@311 318 Makefile
michael@311 319 %{l_shtool} subst \
michael@311 320 -e 's; *-L/usr/local/ssl/lib;;g' \
michael@311 321 -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
michael@311 322 -e 's;/usr/local;%{l_prefix};g' \
michael@311 323 -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
michael@311 324 -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \
michael@311 325 main/Makefile
michael@311 326 %{l_shtool} subst \
michael@311 327 -e 's;\(<defaultenabled>\)no\(</defaultenabled>\);\1yes\2;g' \
michael@362 328 apps/app_ivrdemo.c \
michael@362 329 apps/app_saycounted.c \
michael@362 330 apps/app_rpt.c \
michael@311 331 utils/utils.xml \
michael@311 332 agi/agi.xml
michael@311 333 %{l_shtool} subst \
michael@311 334 -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \
michael@311 335 main/editline/Makefile.in \
michael@311 336 main/db1-ast/Makefile
michael@311 337 %{l_shtool} subst \
michael@311 338 -e 's;%s/astdb;%s/asterisk.db;g' \
michael@311 339 main/asterisk.c
michael@311 340 %{l_shtool} subst \
michael@311 341 -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
michael@311 342 main/db1-ast/hash/hash.h
michael@311 343 %{l_shtool} subst \
michael@311 344 -e 's;if \(((tmp = strchr(name\);while \1;g' \
michael@311 345 main/abstract_jb.c
michael@311 346 %{l_shtool} subst \
michael@311 347 -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
michael@311 348 -e 's;\(radiusclient\)-ng;\1;g' \
michael@311 349 cdr/cdr_radius.c \
michael@311 350 cel/cel_radius.c
michael@311 351 %{l_shtool} subst \
michael@311 352 -e 's;\(sqlite\)\(\.h\);\13\2;g' \
michael@311 353 cdr/cdr_sqlite.c
michael@311 354 %{l_shtool} subst \
michael@311 355 -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \
michael@311 356 res/res_smdi.c
michael@311 357 %{l_shtool} subst \
michael@311 358 -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
michael@311 359 -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
michael@311 360 -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
michael@311 361 -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
michael@311 362 -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
michael@311 363 -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \
michael@311 364 chan_capi-%{V_chan_capi}/Makefile
michael@411 365 %{l_shtool} subst \
michael@411 366 -e 's;if.*SSL_CTX_use_certificate_file.*;if (SSL_CTX_use_certificate_chain_file(cfg->ssl_ctx, cfg->certfile) == 0) {;' \
michael@411 367 main/tcptls.c
michael@310 368
michael@310 369 %build
michael@311 370 # sanity check operating system
michael@310 371 %if "%{with_dahdi}" == "yes"
michael@310 372 dahdi_prefix=""
michael@310 373 case "%{l_platform -t}" in
michael@310 374 *-linux* )
michael@311 375 if [ ! -f /usr/include/dahdi/user.h ]; then
michael@310 376 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
michael@310 377 fi
michael@310 378 dahdi_prefix=/usr
michael@310 379 ;;
michael@310 380 *-freebsd* )
michael@311 381 if [ ! -f /usr/local/include/dahdi/user.h ]; then
michael@310 382 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
michael@310 383 fi
michael@310 384 dahdi_prefix=/usr/local
michael@310 385 ;;
michael@310 386 * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
michael@310 387 esac
michael@202 388 %endif
michael@311 389 # correct platform dependent build configuration
michael@311 390 extflg=
michael@311 391 case "%{l_platform -t}" in
michael@311 392 *-linux* )
michael@311 393 pthlibflg='-lpthread'
michael@311 394 ;;
michael@311 395 esac
michael@202 396
michael@311 397 # adapt buildconf to find mpg123 (for music on hold)
michael@310 398 %if "%{with_mp3}" == "yes"
michael@310 399 mpg123="%{l_prefix}/bin/mpg123"
michael@310 400 %else
michael@310 401 mpg123="`which false`"
michael@310 402 %endif
michael@310 403 %{l_shtool} subst \
michael@310 404 -e "s;/usr/local/bin/mpg123;$mpg123;" \
michael@310 405 -e "s;/usr/bin/mpg123;$mpg123;" \
michael@310 406 res/res_musiconhold.c apps/app_mp3.c
michael@202 407
michael@311 408 # configure program
michael@310 409 ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config"
michael@310 410 ) >config.cache
michael@310 411 cflags="%{l_cflags -O}"
michael@311 412 cppflags="%{l_cppflags ncurses lua}"
michael@310 413 ldflags="%{l_ldflags}"
michael@310 414 libs=""
michael@311 415 cppflags="$cppflags `pkg-config gmime-2.4 --cflags-only-I`"
michael@311 416 ldflags="$ldflags `pkg-config gmime-2.4 --libs-only-L`"
michael@311 417 libs="$libs `pkg-config gmime-2.4 --libs-only-l` -lssl -lcrypto"
michael@310 418 %if "%{with_ogg}" == "yes"
michael@310 419 libs="$libs -logg -lm"
michael@202 420 %endif
michael@310 421 %if "%{with_avcodec}" == "yes"
michael@310 422 libs="$libs -lavcodec -lavutil"
michael@202 423 %endif
michael@310 424 %if "%{with_ldap}" == "yes"
michael@311 425 libs="$libs -lldap -llber"
michael@202 426 %endif
michael@310 427 %if "%{with_dahdi}" == "yes"
michael@310 428 cppflags="$cppflags -I$dahdi_prefix/include"
michael@310 429 ldflags="$ldflags -L$dahdi_prefix/lib"
michael@202 430 %endif
michael@202 431 CC="%{l_cc}" \
michael@310 432 CFLAGS="$cflags" \
michael@310 433 CPPFLAGS="$cppflags" \
michael@310 434 LDFLAGS="$ldflags" \
michael@202 435 LIBS="$libs" \
michael@311 436 INSTALL="%{l_shtool} install -c" \
michael@311 437 PTHREAD_LIBS="$pthlibflg" \
michael@202 438 ./configure \
michael@310 439 --cache-file=./config.cache \
michael@202 440 --prefix=%{l_prefix} \
michael@202 441 --mandir=%{l_prefix}/man \
michael@310 442 --sysconfdir=%{l_prefix}/etc \
michael@311 443 --localstatedir=%{l_prefix}/var \
michael@311 444 --datarootdir=%{l_prefix}/share/asterisk \
michael@311 445 --with-crypto=%{l_prefix} \
michael@362 446 --with-libcurl=%{l_prefix} \
michael@311 447 --with-ncurses=%{l_prefix} \
michael@310 448 --with-gsm="internal" \
michael@310 449 --with-popt=%{l_prefix} \
michael@310 450 %if "%{with_sqlite}" == "yes"
michael@310 451 --with-sqlite3=%{l_prefix} \
michael@202 452 %else
michael@310 453 --without-sqlite3 \
michael@202 454 %endif
michael@311 455 %if "%{with_srtp}" == "yes"
michael@311 456 --with-srtp=%{l_prefix} \
michael@311 457 %else
michael@311 458 --without-srtp \
michael@311 459 %endif
michael@311 460 %if "%{with_pgsql}" == "yes"
michael@311 461 --with-postgres=%{l_prefix} \
michael@311 462 %else
michael@311 463 --with-postgres=no \
michael@311 464 %endif
michael@310 465 --with-speex=%{l_prefix} \
michael@310 466 --with-speexdsp=%{l_prefix} \
michael@202 467 --with-ssl=%{l_prefix} \
michael@310 468 --with-gmime=%{l_prefix} \
michael@310 469 --with-z=%{l_prefix} \
michael@310 470 %if "%{with_ogg}" == "yes"
michael@310 471 --with-ogg=%{l_prefix} \
michael@310 472 --with-vorbis=%{l_prefix} \
michael@310 473 %else
michael@310 474 --without-ogg \
michael@310 475 --without-vorbis \
michael@310 476 %endif
michael@310 477 %if "%{with_jabber}" == "yes"
michael@310 478 --with-iksemel=%{l_prefix} \
michael@310 479 %else
michael@310 480 --without-iksemel \
michael@310 481 %endif
michael@310 482 %if "%{with_lua}" == "yes"
michael@310 483 --with-lua=%{l_prefix} \
michael@310 484 %else
michael@310 485 --without-lua \
michael@310 486 %endif
michael@310 487 %if "%{with_dahdi}" == "yes"
michael@310 488 --with-dahdi=$dahdi_prefix \
michael@310 489 --with-tonezone=$dahdi_prefix \
michael@310 490 %else
michael@310 491 --without-dahdi \
michael@310 492 --without-tonezone \
michael@310 493 %endif
michael@310 494 %if "%{with_avcodec}" == "yes"
michael@310 495 --with-avcodec=%{l_prefix} \
michael@310 496 %else
michael@310 497 --without-avcodec \
michael@310 498 %endif
michael@310 499 %if "%{with_ldap}" == "yes"
michael@310 500 --with-ldap=%{l_prefix} \
michael@310 501 %else
michael@310 502 --without-ldap \
michael@310 503 %endif
michael@202 504 %if "%{with_radius}" == "yes"
michael@202 505 --with-radius=%{l_prefix} \
michael@202 506 %else
michael@310 507 --without-radius \
michael@202 508 %endif
michael@202 509 %if "%{with_imap}" == "yes"
michael@202 510 --with-imap=%{l_prefix} \
michael@311 511 --disable-largefile \
michael@202 512 %else
michael@310 513 --without-imap \
michael@202 514 %endif
michael@362 515 --without-iodbc \
michael@310 516 %if "%{with_odbc}" == "yes"
michael@362 517 --with-unixodbc=%{l_prefix} \
michael@202 518 %else
michael@362 519 --without-unixodbc \
michael@202 520 %endif
michael@311 521 %if "%{with_libpri}" == "yes"
michael@311 522 --with-pri=%{l_prefix} \
michael@311 523 %else
michael@311 524 --without-pri \
michael@311 525 %endif
michael@362 526 --with-sounds-cache=%_sourcedir \
michael@310 527 --without-netsnmp \
michael@310 528 --without-isdnnet \
michael@310 529 --without-misdn \
michael@310 530 --without-nbs \
michael@310 531 --without-newt \
michael@310 532 --without-asound \
michael@310 533 --without-oss \
michael@310 534 --without-sqlite \
michael@310 535 --without-tds \
michael@310 536 --without-osptk \
michael@310 537 --without-suppserv \
michael@310 538 --without-vpb \
michael@310 539 --without-sdl \
michael@310 540 --without-x11 \
michael@310 541 --without-gtk2
michael@311 542
michael@311 543 # build menuselect
michael@311 544 %{l_make} %{l_mflags -O} menuselect.makeopts
michael@362 545 menuselect/menuselect \
michael@362 546 --enable format_mp3 --enable app_fax --enable codec_ilbc \
michael@362 547 --enable RADIO_RELAX --enable G711_NEW_ALGORITHM \
michael@362 548 --enable G711_REDUCED_BRANCHING --enable CORE-SOUNDS-EN-SLN16 \
michael@362 549 --enable CORE-SOUNDS-ES-SLN16 --enable CORE-SOUNDS-FR-SLN16 \
michael@362 550 --enable CORE-SOUNDS-EN_AU-SLN16 --enable CORE-SOUNDS-RU-SLN16 \
michael@362 551 --enable MOH-OPSOUND-SLN16 --enable EXTRA-SOUNDS-EN-SLN16 \
michael@362 552 --enable EXTRA-SOUNDS-FR-SLN16 \
michael@362 553 menuselect.makeopts
michael@362 554 menuselect/menuselect \
michael@362 555 --disable CORE-SOUNDS-EN-GSM \
michael@362 556 --disable MOH-OPSOUND-WAV \
michael@311 557 menuselect.makeopts
michael@311 558 %if "%{with_imap}" == "yes"
michael@362 559 menuselect/menuselect --enable IMAP_STORAGE menuselect.makeopts
michael@311 560 %endif
michael@311 561
michael@311 562 # build program
michael@311 563 %{l_make} %{l_mflags -O} \
michael@311 564 CC="%{l_cc} $cflags -I../include -I../../include $cppflags" NOISY_BUILD=yes
michael@202 565
michael@202 566 %if "%{with_capi}" == "yes"
michael@311 567 # build capi channel
michael@310 568 ( cd chan_capi-*
michael@310 569 ln -s ../include/asterisk .
michael@310 570 ln -s ../include/asterisk.h .
michael@311 571 %{l_make} %{l_mflags -O} V=1 \
michael@310 572 INSTALL_PREFIX=%{l_prefix} \
michael@311 573 ASTERISK_HEADER_DIR="`pwd`" \
michael@202 574 ) || exit $?
michael@202 575 %endif
michael@202 576
michael@202 577 %install
michael@310 578 # install program
michael@311 579 rm -rf $RPM_BUILD_ROOT
michael@310 580 %{l_make} %{l_mflags} install \
michael@310 581 DESTDIR=$RPM_BUILD_ROOT \
michael@310 582 INSTALL_PREFIX=%{l_prefix}
michael@202 583
michael@202 584 %if "%{with_capi}" == "yes"
michael@311 585 # install capi channel
michael@310 586 ( cd chan_capi-*
michael@310 587 %{l_make} %{l_mflags} install \
michael@310 588 INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
michael@310 589 INSTALL="%{l_shtool} install -c" \
michael@310 590 MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
michael@202 591 ) || exit $?
michael@202 592 %endif
michael@202 593
michael@311 594 %if "%{with_fax}" == "yes"
michael@311 595 # install fax support
michael@311 596 case "%{l_platform -t}" in
michael@311 597 amd64*-* )
michael@311 598 %{l_shtool} install -c -m 755 \
michael@311 599 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \
michael@311 600 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
michael@311 601 %{l_shtool} install -c -m 640 \
michael@311 602 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \
michael@311 603 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
michael@311 604 ;;
michael@311 605 i?86-* )
michael@311 606 %{l_shtool} install -c -m 755 \
michael@311 607 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \
michael@311 608 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
michael@311 609 %{l_shtool} install -c -m 640 \
michael@311 610 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \
michael@311 611 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
michael@311 612 ;;
michael@318 613 *-* )
michael@311 614 echo "Error determining hardware architecture." \
michael@311 615 | %{l_rpmtool} msg -b -t warn
michael@311 616 exit 1;
michael@311 617 ;;
michael@311 618 esac
michael@311 619 %endif
michael@311 620
michael@311 621 ( echo 'Start of sound installation block (RPM)'
michael@311 622 %if "%{with_esounds}" == "yes"
michael@311 623 # install freeswitch sound prompt files, expecting
michael@311 624 # identical sound filenames to be overwritten later
michael@311 625 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
michael@311 626 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
michael@311 627 subs=`( cd en/us/callie && find * -type d -prune )`
michael@311 628 for subdir in $subs; do
michael@311 629 mkdir $subdir
michael@311 630 mv -f en/us/callie/$subdir/*/* ${subdir}/
michael@311 631 done
michael@311 632 rm -rf en
michael@311 633 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es
michael@311 634 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz
michael@311 635 subs=`( cd es/mx/maria && find * -type d -prune )`
michael@311 636 for subdir in $subs; do
michael@311 637 mkdir $subdir
michael@311 638 mv -f es/mx/maria/$subdir/*/* ${subdir}/
michael@311 639 done
michael@311 640 rm -rf es
michael@311 641 %{l_shtool} mkdir -f -p -m 755 \
michael@311 642 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
michael@311 643 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
michael@311 644 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
michael@311 645 subs=`( cd ru/RU/elena && find * -type d -prune )`
michael@311 646 for subdir in $subs; do
michael@311 647 mkdir $subdir
michael@311 648 mv -f ru/RU/elena/$subdir/*/* ${subdir}/
michael@311 649 done
michael@311 650 rm -rf ru
michael@311 651
michael@311 652 # install freeswitch music on hold files
michael@311 653 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
michael@311 654 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
michael@311 655 mv -f music/48000/* . && rm -rf music
michael@311 656
michael@311 657 # convert freeswitch 48000 and 441000 KHz to 8000 Khz
michael@347 658 # ffmpeg -i <in> -ar 8000 -ac 1 -acodec pcm_s16le -f s16le <out>
michael@311 659 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk
michael@311 660 for highfile in `find . -name '*.wav'`; do
michael@311 661 lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'`
michael@311 662 %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile
michael@311 663 rm $highfile
michael@311 664 done
michael@311 665 %endif
michael@311 666
michael@311 667 # install australian nonversioned sound prompt files
michael@311 668 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en_AU
michael@405 669 %{l_tar} zxf %%{_sourcedir}/asterisk-core-sounds-en_AU-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@311 670
michael@311 671 # install main sound prompt files
michael@311 672 #for codec in alaw ulaw g722 g729 gsm; do
michael@311 673 for lang in en es fr; do
michael@311 674 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
michael@311 675 %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz
michael@311 676 done
michael@311 677 for lang in en fr; do
michael@311 678 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
michael@311 679 %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz
michael@311 680 done
michael@311 681
michael@311 682 # install special case sound files
michael@311 683 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
michael@311 684 #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2}
michael@311 685 #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $?
michael@311 686 #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz}
michael@311 687 #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de
michael@311 688 #mv -f digits/de/* de/digits/ && rm -rf digits/de
michael@311 689 #mv -f letters/de/* de/letters/ && rm -rf letters/de
michael@311 690 #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de
michael@311 691 %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
michael@311 692 %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
michael@347 693 mv msvbsnds-sln16-%{V_asterisk_sounds_custom} msvb
michael@311 694
michael@311 695 # install additional asterisk music on hold
michael@311 696 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
michael@311 697 %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz
michael@311 698 %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
michael@311 699
michael@311 700 # correct sound permissions
michael@311 701 find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \
michael@311 702 | xargs chmod 644
michael@311 703 find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \
michael@311 704 | xargs chmod 755
michael@311 705
michael@311 706 # apply provisional workaround for bug 0016104
michael@311 707 # https://issues.asterisk.org/view.php?id=16104
michael@311 708 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
michael@311 709 cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311 710 cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311 711 cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311 712 cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
michael@311 713
michael@311 714 # # install nonstandard voicemail prompts
michael@311 715 # %{l_shtool} mkdir -f -p -m 755 \
michael@311 716 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
michael@311 717 # %{l_shtool} install -c -m 660 \
michael@311 718 # %{_sourcedir}/ansage-%{V_ansage}.wav} \
michael@311 719 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
michael@311 720 ) || exit $? # End of sound installation block (RPM)
michael@310 721
michael@310 722 # strip down installation
michael@310 723 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
michael@310 724 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
michael@310 725 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
michael@310 726 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
michael@310 727 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
michael@362 728 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/.asterisk* >/dev/null 2>&1 || true
michael@311 729 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true
michael@311 730 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true
michael@362 731 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/LICENSE* >/dev/null 2>&1 || true
michael@311 732 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true
michael@311 733 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true
michael@362 734 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/.asterisk* >/dev/null 2>&1 || true
michael@310 735
michael@310 736 # create additional directories
michael@310 737 %{l_shtool} mkdir -f -p -m 755 \
michael@311 738 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \
michael@362 739 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/rx \
michael@362 740 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/tx \
michael@347 741 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing \
michael@347 742 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/licenses
michael@310 743
michael@311 744 # postadjust installation
michael@311 745 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
michael@311 746 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
michael@311 747 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
michael@311 748 >/dev/null 2>&1 || true
michael@310 749 mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
michael@310 750 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
michael@311 751
michael@311 752 # install AGI progs
michael@311 753 ( cd agi
michael@311 754 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@311 755 DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \
michael@311 756 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/
michael@311 757 ) || exit $?
michael@310 758 for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
michael@310 759 mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
michael@202 760 done
michael@202 761
michael@310 762 # install default configuration
michael@310 763 for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
michael@310 764 %if "%{with_dahdi}" == "no"
michael@310 765 [ ".$name" = ".chan_dahdi.conf" ] && continue
michael@310 766 %endif
michael@310 767 %if "%{with_capi}" == "no"
michael@310 768 [ ".$name" = ".capi.conf" ] && continue
michael@310 769 %endif
michael@399 770 %if "%{with_gtalk}" == "no"
michael@399 771 [ ".$name" = ".gtalk.conf" ] && continue
michael@399 772 %endif
michael@399 773 %if "%{with_jabber}" == "no"
michael@399 774 [ ".$name" = ".jabber.conf" ] && continue
michael@399 775 %endif
michael@310 776 %if "%{with_sqlite}" == "no"
michael@310 777 [ ".$name" = ".cdr_sqlite3_custom.conf" ] && continue
michael@310 778 %endif
michael@310 779 %if "%{with_odbc}" == "no"
michael@310 780 [ ".$name" = ".res_odbc.conf" ] && continue
michael@310 781 [ ".$name" = ".func_odbc.conf" ] && continue
michael@310 782 %endif
michael@310 783 (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
michael@310 784 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
michael@310 785 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@310 786 $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
michael@310 787 done
michael@202 788
michael@311 789 # install runcommand script
michael@202 790 %{l_shtool} mkdir -f -p -m 755 \
michael@202 791 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@202 792 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@202 793 %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@202 794
michael@202 795 # determine installation files
michael@310 796 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@310 797 %{l_files_std} \
michael@362 798 '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
michael@347 799 '%config %attr(-,%{l_mgrp},%{l_mgrp}) %{l_prefix}/share/asterisk/licenses' \
michael@362 800 '%attr(750,%{l_rgrp},%{l_rgrp}) %{l_prefix}/var/asterisk/spool/facsimile' \
michael@310 801 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
michael@202 802
michael@311 803 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \
michael@311 804 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \
michael@311 805 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \
michael@311 806
michael@202 807 %files -f files
michael@202 808
michael@202 809 %clean
michael@311 810 rm -rf $RPM_BUILD_ROOT
michael@202 811
michael@202 812 %post
michael@310 813 %if "%{with_dahdi}" == "yes"
michael@310 814 if [ $1 -eq 1 ]; then
michael@310 815 case "%{l_platform -t}" in
michael@310 816 *-freebsd* )
michael@310 817 ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
michael@310 818 echo "you have add the following entry to /etc/devfs.rules:"
michael@310 819 echo ""
michael@310 820 echo "[openpkg_asterisk=10]"
michael@310 821 echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
michael@310 822 echo ""
michael@310 823 ) | %{l_rpmtool} msg -b -t notice
michael@310 824 ;;
michael@310 825 esac
michael@310 826 fi
michael@310 827 %endif
michael@310 828 %if "%{with_odbc}" == "yes"
michael@310 829 # after install, optionally link into ODBC and create database
michael@310 830 if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
michael@310 831 :
michael@310 832 else
michael@310 833 ( echo "[asterisk-sqlite]"
michael@310 834 echo "Description = Asterisk SQLite Database"
michael@310 835 echo "Driver = SQLite3"
michael@310 836 echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
michael@310 837 echo "Timeout = 2000"
michael@310 838 ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
michael@310 839 fi
michael@310 840 if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
michael@310 841 ( umask 007
michael@310 842 echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
michael@310 843 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
michael@310 844 ) || exit $?
michael@310 845 fi
michael@310 846 %endif
michael@311 847 %if "%{with_fax}" == "yes"
michael@311 848 ( echo "Asterisk has been installed with proprietary Digium fax support."
michael@311 849 echo "The responsible module is called res_fax_digium and requires a"
michael@311 850 echo "valid license. The license must be found in the directory"
michael@362 851 echo "'licenses' which in turn must be found in %{l_prefix}/share/asterisk"
michael@311 852 echo "or wherever astvarlibdir has been configured in 'asterisk.conf'."
michael@311 853 echo ""
michael@311 854 echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information."
michael@311 855 ) | %{l_rpmtool} msg -b -t notice
michael@311 856 %endif
michael@202 857 # after upgrade, restart service
michael@202 858 [ $1 -eq 2 ] || exit 0
michael@202 859 eval `%{l_rc} asterisk status 2>/dev/null`
michael@202 860 [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
michael@202 861 exit 0
michael@202 862
michael@202 863 %preun
michael@202 864 # before erase, stop service and remove log files
michael@202 865 [ $1 -eq 0 ] || exit 0
michael@202 866 %{l_rc} asterisk stop 2>/dev/null
michael@310 867 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true
michael@310 868 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
michael@310 869 rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true
michael@310 870 rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true
michael@311 871 rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true
michael@310 872 rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true
michael@310 873 %if "%{with_odbc}" == "yes"
michael@310 874 # before erase, optionally unlink from ODBC and destroy database
michael@310 875 $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
michael@310 876 %endif
michael@202 877 exit 0
michael@202 878

mercurial