Fri, 30 Mar 2012 18:53:57 +0200
Update package version to upstream vendor new release.
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.11.0
26 %define V_asterisk 1.8.11.0
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.20120324
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: 20120330
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 >= 20060823, bison, gcc, make, grep, pkgconfig
117 PreReq: OpenPKG, openpkg >= 20060823, 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 -e 's;LIBXML2_INCLUDE="-I\${LIBXML2_DIR}/include";echo "Removing really buggy hard coded LibXML include defs.";' \
302 -e 's;\(for ver in 2\.0 2\.2 2\.4\);\1 2.6;' \
303 -e 's;\(\-lpq.*\-lz.*\)";\1 ${PTHREAD_LIBS}";g'\
304 configure
305 %{l_shtool} subst \
306 -e 's;\(sh\) \(bash\) ksh sh5;\2 \1;' \
307 configure
308 %{l_shtool} subst \
309 -e 's;^\(#define DEFAULT_DB .*\${ASTDBDIR}\)/astdb;\1/asterisk.db;' \
310 build_tools/make_defaults_h
311 %{l_shtool} subst \
312 -e 's;^\(_all:.* *\)cleantest *;\1;' \
313 -e 's; *-I/usr/local/ssl/include;;g' \
314 -e 's;/opt/ssl/include;%{l_prefix}/include;g' \
315 -e 's;/usr/local;%{l_prefix};g' \
316 Makefile
317 %{l_shtool} subst \
318 -e 's;\$(SUBMAKE);$(MAKE);g' \
319 -e 's;\$(SILENTMAKE);$(MAKE) --quiet --no-print-directory;g' \
320 -e 's;\$(MAKE_MENUSELECT); $(MAKE) -C menuselect;g' \
321 -e 's;-march=\$(PROC);-march=native;g' \
322 Makefile
323 %{l_shtool} subst \
324 -e 's; *-L/usr/local/ssl/lib;;g' \
325 -e 's;/opt/ssl/lib;%{l_prefix}/lib;g' \
326 -e 's;/usr/local;%{l_prefix};g' \
327 -e 's;\(ASTLINK=\)$;\1-Wl,--export-dynamic;g' \
328 -e 's;\( CFLAGS=\)"[^"]+";"%{l_cflags -O}";g' \
329 main/Makefile
330 %{l_shtool} subst \
331 -e 's;\(<defaultenabled>\)no\(</defaultenabled>\);\1yes\2;g' \
332 apps/app_ivrdemo.c \
333 apps/app_saycounted.c \
334 apps/app_rpt.c \
335 utils/utils.xml \
336 agi/agi.xml
337 %{l_shtool} subst \
338 -e 's;\(-DSOLARIS\);\1 -D__EXTENSIONS__=1;g' \
339 main/editline/Makefile.in \
340 main/db1-ast/Makefile
341 %{l_shtool} subst \
342 -e 's;^\(install:\).*;\1;' \
343 sounds/Makefile
344 %{l_shtool} subst \
345 -e 's;%s/astdb;%s/asterisk.db;g' \
346 main/asterisk.c
347 %{l_shtool} subst \
348 -e 's;u_int\([0-9]*\)_t;uint\1_t;g' \
349 main/db1-ast/hash/hash.h
350 %{l_shtool} subst \
351 -e 's;if \(((tmp = strchr(name\);while \1;g' \
352 main/abstract_jb.c
353 %{l_shtool} subst \
354 -e 's;if.*SSL_CTX_use_certificate_file.*;if (SSL_CTX_use_certificate_chain_file(cfg->ssl_ctx, cfg->certfile) == 0) {;' \
355 main/tcptls.c
356 %{l_shtool} subst \
357 -e 's;ast_random();rand();' \
358 main/strcompat.c
359 %{l_shtool} subst \
360 -e 's;\(/etc/radiusclient-ng/radiusclient.conf\);%{l_prefix}\1;g' \
361 -e 's;\(radiusclient\)-ng;\1;g' \
362 cdr/cdr_radius.c \
363 cel/cel_radius.c
364 %{l_shtool} subst \
365 -e 's;\(sqlite\)\(\.h\);\13\2;g' \
366 cdr/cdr_sqlite.c
367 %{l_shtool} subst \
368 -e 's;\(#define DEFAULT_POLLING_INTERVAL\) .*;\1 %{with_smdipoll};' \
369 res/res_smdi.c
370 %{l_shtool} subst \
371 -e 's;\(ASTERISK_HEADER_DIR=\).*;\1%{l_prefix}/include;g' \
372 -e 's;\(MODULES_DIR=\).*;\1%{l_prefix}/lib/asterisk/modules;g' \
373 -e 's;\(CONFIG_DIR=\).*;\1%{l_prefix}/etc/asterisk;g' \
374 -e 's;\(\$(MODULES_DIR)\);$(DESTDIR)\1;g' \
375 -e 's;\${CONFIG_DIR};$(DESTDIR)$(CONFIG_DIR);g' \
376 -e 's;^\(USE_OWN_LIBCAPI\)=yes;\1=no;' \
377 chan_capi-%{V_chan_capi}/Makefile
378 case "%{l_platform -t}" in
379 *-sunos* )
380 %{l_shtool} subst \
381 -e 's;SO_SUPPRESS_SYMBOLS=-Wl,--version-script,[a-zA-Z0-9@\-_,\.()\$ ][a-zA-Z0-9@\-_,\.()\$ ]*;LOCAL_NOOP=0;' \
382 -e 's;ASTLINK+=-Wl,--version-script,[a-zA-Z0-9\-_\.,][a-zA-Z0-9\-_\.,]*;LOCAL_NOOP=0;' \
383 -e 's;-Wl,--version-script=[^ ][^ ]* *;;' \
384 Makefile.rules \
385 main/Makefile \
386 main/db1-ast/Makefile
387 ;;
388 esac
390 %build
391 # sanity check operating system
392 %if "%{with_dahdi}" == "yes"
393 dahdi_prefix=""
394 case "%{l_platform -t}" in
395 *-linux* )
396 if [ ! -f /usr/include/dahdi/user.h ]; then
397 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
398 fi
399 dahdi_prefix=/usr
400 ;;
401 *-freebsd* )
402 if [ ! -f /usr/local/include/dahdi/user.h ]; then
403 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
404 fi
405 dahdi_prefix=/usr/local
406 ;;
407 * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
408 esac
409 %endif
410 # correct platform dependent build configuration
411 extflg=
412 loclibs="-lssl -lcrypto"
413 case "%{l_platform -t}" in
414 *-linux* )
415 pthlibflg='-lpthread'
416 ;;
417 *-sunos* )
418 loclibs="$loclibs -lsocket -lnsl"
419 ;;
420 esac
422 # adapt buildconf to find mpg123 (for music on hold)
423 %if "%{with_mp3}" == "yes"
424 mpg123="%{l_prefix}/bin/mpg123"
425 %else
426 mpg123="`which false`"
427 %endif
428 %{l_shtool} subst \
429 -e "s;/usr/local/bin/mpg123;$mpg123;" \
430 -e "s;/usr/bin/mpg123;$mpg123;" \
431 res/res_musiconhold.c apps/app_mp3.c
433 # configure program
434 cflags="%{l_cflags -O}"
435 cppflags="%{l_cppflags ncurses lua}"
436 ldflags="%{l_ldflags}"
437 cppflags="$cppflags"
438 ldflags="$ldflags"
439 %if "%{with_ogg}" == "yes"
440 loclibs="$loclibs -logg -lm"
441 %endif
442 %if "%{with_avcodec}" == "yes"
443 loclibs="$loclibs -lavcodec -lavutil"
444 %endif
445 %if "%{with_ldap}" == "yes"
446 loclibs="$loclibs -lldap -llber"
447 %endif
448 %if "%{with_dahdi}" == "yes"
449 cppflags="$cppflags -I$dahdi_prefix/include"
450 ldflags="$ldflags -L$dahdi_prefix/lib"
451 %endif
452 CC="%{l_cc}" \
453 CFLAGS="$cflags" \
454 CPPFLAGS="$cppflags" \
455 LDFLAGS="$ldflags" \
456 LIBS="$loclibs" \
457 INSTALL="%{l_shtool} install -c" \
458 PTHREAD_LIBS="$pthlibflg" \
459 ./configure \
460 --cache-file=./config.cache \
461 --prefix=%{l_prefix} \
462 --mandir=%{l_prefix}/man \
463 --sysconfdir=%{l_prefix}/etc \
464 --localstatedir=%{l_prefix}/var \
465 --datarootdir=%{l_prefix}/share/asterisk \
466 --with-crypto=%{l_prefix} \
467 --with-libcurl=%{l_prefix} \
468 --with-ncurses=%{l_prefix} \
469 --with-gsm="internal" \
470 --with-popt=%{l_prefix} \
471 %if "%{with_sqlite}" == "yes"
472 --with-sqlite3=%{l_prefix} \
473 %else
474 --without-sqlite3 \
475 %endif
476 %if "%{with_srtp}" == "yes"
477 --with-srtp=%{l_prefix} \
478 %else
479 --without-srtp \
480 %endif
481 %if "%{with_pgsql}" == "yes"
482 --with-postgres=%{l_prefix} \
483 %else
484 --with-postgres=no \
485 %endif
486 --with-speex=%{l_prefix} \
487 --with-speexdsp=%{l_prefix} \
488 --with-ssl=%{l_prefix} \
489 --with-gmime=%{l_prefix} \
490 --with-z=%{l_prefix} \
491 %if "%{with_ogg}" == "yes"
492 --with-ogg=%{l_prefix} \
493 --with-vorbis=%{l_prefix} \
494 %else
495 --without-ogg \
496 --without-vorbis \
497 %endif
498 %if "%{with_jabber}" == "yes"
499 --with-iksemel=%{l_prefix} \
500 %else
501 --without-iksemel \
502 %endif
503 %if "%{with_lua}" == "yes"
504 --with-lua=%{l_prefix} \
505 %else
506 --without-lua \
507 %endif
508 %if "%{with_dahdi}" == "yes"
509 --with-dahdi=$dahdi_prefix \
510 --with-tonezone=$dahdi_prefix \
511 %else
512 --without-dahdi \
513 --without-tonezone \
514 %endif
515 %if "%{with_avcodec}" == "yes"
516 --with-avcodec=%{l_prefix} \
517 %else
518 --without-avcodec \
519 %endif
520 %if "%{with_ldap}" == "yes"
521 --with-ldap=%{l_prefix} \
522 %else
523 --without-ldap \
524 %endif
525 %if "%{with_radius}" == "yes"
526 --with-radius=%{l_prefix} \
527 %else
528 --without-radius \
529 %endif
530 %if "%{with_imap}" == "yes"
531 --with-imap=%{l_prefix} \
532 --disable-largefile \
533 %else
534 --without-imap \
535 %endif
536 --without-iodbc \
537 %if "%{with_odbc}" == "yes"
538 --with-unixodbc=%{l_prefix} \
539 %else
540 --without-unixodbc \
541 %endif
542 %if "%{with_libpri}" == "yes"
543 --with-pri=%{l_prefix} \
544 %else
545 --without-pri \
546 %endif
547 --with-sounds-cache=%_sourcedir \
548 --with-libxml2=%{l_prefix} \
549 --without-netsnmp \
550 --without-isdnnet \
551 --without-misdn \
552 --without-nbs \
553 --without-newt \
554 --without-asound \
555 --without-oss \
556 --without-sqlite \
557 --without-tds \
558 --without-osptk \
559 --without-suppserv \
560 --without-vpb \
561 --without-sdl \
562 --without-x11 \
563 --without-gtk2
565 # build menuselect
566 %{l_make} %{l_mflags -O} menuselect.makeopts
567 menuselect/menuselect \
568 --enable format_mp3 --enable app_fax --enable codec_ilbc \
569 --enable RADIO_RELAX --enable G711_NEW_ALGORITHM \
570 --enable G711_REDUCED_BRANCHING --enable CORE-SOUNDS-EN-SLN16 \
571 --enable CORE-SOUNDS-ES-SLN16 --enable CORE-SOUNDS-FR-SLN16 \
572 --enable CORE-SOUNDS-EN_AU-SLN16 --enable CORE-SOUNDS-RU-SLN16 \
573 --enable MOH-OPSOUND-SLN16 --enable EXTRA-SOUNDS-EN-SLN16 \
574 --enable EXTRA-SOUNDS-FR-SLN16 \
575 menuselect.makeopts
576 menuselect/menuselect \
577 --disable CORE-SOUNDS-EN-GSM \
578 --disable MOH-OPSOUND-WAV \
579 menuselect.makeopts
580 %if "%{with_imap}" == "yes"
581 menuselect/menuselect --enable IMAP_STORAGE menuselect.makeopts
582 %endif
584 # build program
585 %{l_make} %{l_mflags -O} \
586 CC="%{l_cc} $cflags -I../include $cppflags" NOISY_BUILD=yes
588 %if "%{with_capi}" == "yes"
589 # build capi channel
590 ( cd chan_capi-*
591 ln -s ../include/asterisk .
592 ln -s ../include/asterisk.h .
593 %{l_make} %{l_mflags -O} V=1 \
594 INSTALL_PREFIX=%{l_prefix} \
595 ASTERISK_HEADER_DIR="`pwd`" \
596 ) || exit $?
597 %endif
599 %install
600 # install program
601 rm -rf $RPM_BUILD_ROOT
602 %{l_make} %{l_mflags} install \
603 DESTDIR=$RPM_BUILD_ROOT \
604 INSTALL_PREFIX=%{l_prefix}
606 %if "%{with_capi}" == "yes"
607 # install capi channel
608 ( cd chan_capi-*
609 %{l_make} %{l_mflags} install \
610 INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
611 INSTALL="%{l_shtool} install -c" \
612 MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
613 ) || exit $?
614 %endif
616 %if "%{with_fax}" == "yes"
617 # install fax support
618 case "%{l_platform -t}" in
619 amd64*-* )
620 %{l_shtool} install -c -m 755 \
621 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/res_*.so \
622 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
623 %{l_shtool} install -c -m 640 \
624 res_fax_digium-%{V_asterisk_fax_digium}-generic_64/*.conf \
625 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
626 ;;
627 i?86-* )
628 %{l_shtool} install -c -m 755 \
629 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/res_*.so \
630 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/
631 %{l_shtool} install -c -m 640 \
632 res_fax_digium-%{V_asterisk_fax_digium}-generic_32/*.conf \
633 $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
634 ;;
635 *-* )
636 echo "Error determining hardware architecture." \
637 | %{l_rpmtool} msg -b -t warn
638 exit 1;
639 ;;
640 esac
641 %endif
643 ( echo 'Start of sound installation block (OpenPKG)'
644 %if "%{with_esounds}" == "yes"
645 # create sound directory hierarchy
646 for sndir in en es fr ru en_AU moh; do
647 %{l_shtool} mkdir -f -p -m 755 \
648 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/$sndir
649 done
650 # install freeswitch sound prompt files, expecting
651 # identical sound filenames to be overwritten later
652 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en
653 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-en-us-callie-48000-%{V_fswitch_sounds_en}.tar.gz
654 subs=`( cd en/us/callie && find * -type d -prune )`
655 for subdir in $subs; do
656 mkdir $subdir
657 mv -f en/us/callie/$subdir/*/* ${subdir}/
658 done
659 rm -rf en
660 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es
661 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-es-mx-maria-44100.tar.gz
662 subs=`( cd es/mx/maria && find * -type d -prune )`
663 for subdir in $subs; do
664 mkdir $subdir
665 mv -f es/mx/maria/$subdir/*/* ${subdir}/
666 done
667 rm -rf es
668 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ru
669 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-ru-RU-elena-48000-%{V_fswitch_sounds_ru}.tar.gz
670 subs=`( cd ru/RU/elena && find * -type d -prune )`
671 for subdir in $subs; do
672 mkdir $subdir
673 mv -f ru/RU/elena/$subdir/*/* ${subdir}/
674 done
675 rm -rf ru
677 # install freeswitch music on hold files
678 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
679 %{l_tar} zxf %{_sourcedir}/freeswitch-sounds-music-48000-%{V_fswitch_music}.tar.gz
680 mv -f music/48000/* . && rm -rf music
682 # convert freeswitch 48000 and 441000 KHz to 8000 Khz
683 # ffmpeg -i <in> -ar 8000 -ac 1 -acodec pcm_s16le -f s16le <out>
684 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk
685 for highfile in `find . -name '*.wav'`; do
686 lowfile=`echo $highfile | sed -e 's;\(.*\)\.wav;\1.sln16;'`
687 %{l_prefix}/bin/sox $highfile -t raw -r 16000 -s -2 -c 1 $lowfile
688 rm $highfile
689 done
690 %endif
692 # install main sound prompt files
693 #for codec in alaw ulaw g722 g729 gsm; do
694 for lang in en en_AU es fr; do
695 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
696 %{l_tar} zxf %{_sourcedir}/asterisk-core-sounds-${lang}-sln16-%{V_asterisk_sounds_core}.tar.gz
697 done
698 for lang in en fr; do
699 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/${lang}
700 %{l_tar} zxf %{_sourcedir}/asterisk-extra-sounds-${lang}-sln16-%{V_asterisk_sounds_extra}.tar.gz
701 done
703 # install special case sound files
704 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
705 #%{l_tar} jxf %{SOURCE de-digits-%{V_asterisk_sounds_custom}.tar.bz2}
706 #( cd de && %{l_tar} zxf %{SOURCE asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_amootts}.tar.gz} ) || exit $?
707 #%{l_tar} zxf %{SOURCE asterisk-%{V_asterisk_sounds_amoogab}-de-prompts.tar.gz}
708 #mv -f dictate/de/* de/dictate/ && rm -rf dictate/de
709 #mv -f digits/de/* de/digits/ && rm -rf digits/de
710 #mv -f letters/de/* de/letters/ && rm -rf letters/de
711 #mv -f phonetic/de/* de/phonetic/ && rm -rf phonetic/de
712 %{l_tar} jxf %{SOURCE astmultisnds-de-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
713 %{l_tar} jxf %{SOURCE msvbsnds-sln16-%{V_asterisk_sounds_custom}.tar.bz2}
714 mv msvbsnds-sln16-%{V_asterisk_sounds_custom} msvb
716 # install additional asterisk music on hold
717 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh
718 %{l_tar} zxf %{_sourcedir}/asterisk-moh-freeplay-sln16.tar.gz
719 %{l_tar} zxf %{_sourcedir}/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
721 # correct sound permissions
722 find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type f \
723 | xargs chmod 644
724 find $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/ -type d \
725 | xargs chmod 755
727 # apply provisional workaround for bug 0016104
728 # https://issues.asterisk.org/view.php?id=16104
729 cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds
730 cd en && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
731 cd ../es && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
732 cd ../de && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
733 cd ../fr && ln -s vm-INBOX.sln16 vm-Voicemail.sln16
735 # # install nonstandard voicemail prompts
736 # %{l_shtool} mkdir -f -p -m 755 \
737 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail
738 # %{l_shtool} install -c -m 660 \
739 # %{_sourcedir}/ansage-%{V_ansage}.wav} \
740 # $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/voicemail/default/%{exten}/unavail.wav
741 ) || exit $? # End of sound installation block (RPM)
743 # strip down installation
744 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
745 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
746 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
747 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
748 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
749 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/.asterisk* >/dev/null 2>&1 || true
750 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true
751 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true
752 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/LICENSE* >/dev/null 2>&1 || true
753 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true
754 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true
755 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/.asterisk* >/dev/null 2>&1 || true
757 # create additional directories
758 %{l_shtool} mkdir -f -p -m 755 \
759 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \
760 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/rx \
761 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/facsimile/tx \
762 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing \
763 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/licenses
765 # postadjust installation
766 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
767 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/modules/* \
768 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin/* \
769 >/dev/null 2>&1 || true
770 mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
771 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
773 # install AGI progs
774 ( cd agi
775 %{l_shtool} install -c -m 755 %{l_value -s -a} \
776 DialAnMp3.agi fastagi-test numeralize %{SOURCE wakeup.agi} \
777 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/
778 ) || exit $?
779 for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
780 mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
781 done
783 # install default configuration
784 for name in `grep "^<file" %{SOURCE asterisk.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
785 %if "%{with_dahdi}" == "no"
786 [ ".$name" = ".chan_dahdi.conf" ] && continue
787 %endif
788 %if "%{with_capi}" == "no"
789 [ ".$name" = ".capi.conf" ] && continue
790 %endif
791 %if "%{with_gtalk}" == "no"
792 [ ".$name" = ".gtalk.conf" ] && continue
793 %endif
794 %if "%{with_jabber}" == "no"
795 [ ".$name" = ".jabber.conf" ] && continue
796 %endif
797 %if "%{with_sqlite}" == "no"
798 [ ".$name" = ".cdr_sqlite3_custom.conf" ] && continue
799 %endif
800 %if "%{with_odbc}" == "no"
801 [ ".$name" = ".res_odbc.conf" ] && continue
802 [ ".$name" = ".func_odbc.conf" ] && continue
803 %endif
804 (echo ""; cat %{SOURCE asterisk.txt}; echo "") |\
805 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
806 %{l_shtool} install -c -m 644 %{l_value -s -a} \
807 $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
808 done
810 # install runcommand script
811 %{l_shtool} mkdir -f -p -m 755 \
812 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
813 %{l_shtool} install -c -m 755 %{l_value -s -a} \
814 %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
816 # determine installation files
817 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
818 %{l_files_std} \
819 '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
820 '%config %attr(-,%{l_mgrp},%{l_mgrp}) %{l_prefix}/share/asterisk/licenses' \
821 '%attr(750,%{l_rgrp},%{l_rgrp}) %{l_prefix}/var/asterisk/spool/facsimile' \
822 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
824 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/es/vm-Voicemail.sln16' \
825 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/de/vm-Voicemail.sln16' \
826 # '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/asterisk/sounds/fr/vm-Voicemail.sln16' \
828 %files -f files
830 %clean
831 rm -rf $RPM_BUILD_ROOT
833 %post
834 %if "%{with_dahdi}" == "yes"
835 if [ $1 -eq 1 ]; then
836 case "%{l_platform -t}" in
837 *-freebsd* )
838 ( echo "To allow Asterisk to use the DAHDI /dev/dahdi/pseudo device(s)"
839 echo "you have add the following entry to /etc/devfs.rules:"
840 echo ""
841 echo "[openpkg_asterisk=10]"
842 echo "add path 'dahdi/pseudo*' mode 0664 user %{l_rusr} group %{l_rgrp}"
843 echo ""
844 ) | %{l_rpmtool} msg -b -t notice
845 ;;
846 esac
847 fi
848 %endif
849 %if "%{with_odbc}" == "yes"
850 # after install, optionally link into ODBC and create database
851 if $RPM_INSTALL_PREFIX/bin/odbcinst -q -s -n "asterisk-sqlite" >/dev/null 2>&1; then
852 :
853 else
854 ( echo "[asterisk-sqlite]"
855 echo "Description = Asterisk SQLite Database"
856 echo "Driver = SQLite3"
857 echo "Database = $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite"
858 echo "Timeout = 2000"
859 ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "asterisk-sqlite" -r >/dev/null 2>&1 || true
860 fi
861 if [ ! -f $RPM_INSTALL_PREFIX/var/asterisk/run/asterisk.db ]; then
862 ( umask 007
863 echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
864 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
865 ) || exit $?
866 fi
867 %endif
868 %if "%{with_fax}" == "yes"
869 ( echo "Asterisk has been installed with proprietary Digium fax support."
870 echo "The responsible module is called res_fax_digium and requires a"
871 echo "valid license. The license must be found in the directory"
872 echo "'licenses' which in turn must be found in %{l_prefix}/share/asterisk"
873 echo "or wherever astvarlibdir has been configured in 'asterisk.conf'."
874 echo ""
875 echo "Please see http://downloads.digium.com/pub/telephony/fax/ for information."
876 ) | %{l_rpmtool} msg -b -t notice
877 %endif
878 # after upgrade, restart service
879 [ $1 -eq 2 ] || exit 0
880 eval `%{l_rc} asterisk status 2>/dev/null`
881 [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
882 exit 0
884 %preun
885 # before erase, stop service and remove log files
886 [ $1 -eq 0 ] || exit 0
887 %{l_rc} asterisk stop 2>/dev/null
888 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true
889 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
890 rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true
891 rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/dev/null 2>&1 || true
892 rm -f $RPM_INSTALL_PREFIX/var/asterisk/lib/* >/dev/null 2>&1 || true
893 rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true
894 %if "%{with_odbc}" == "yes"
895 # before erase, optionally unlink from ODBC and destroy database
896 $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
897 %endif
898 exit 0