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