asterisk/asterisk.spec

Mon, 01 Sep 2014 21:57:20 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 01 Sep 2014 21:57:20 +0200
changeset 798
4ef5d37e8bb2
parent 760
bafc40b5f634
permissions
-rw-r--r--

Update to new vendor version and adjust patch logic accordingly.

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

mercurial