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