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