asterisk/asterisk.spec

changeset 311
263143ec0fb2
parent 310
73d852a30c9a
child 315
75d162df42e8
equal deleted inserted replaced
1:fc74db2a0bb6 2:f38eb6ab5738
1 ## 1 ##
2 ## asterisk.spec -- OpenPKG RPM Package Specification 2 ## asterisk.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/> 3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ## 4 ##
5 ## Permission to use, copy, modify, and distribute this software for 5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that 6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all 7 ## the above copyright notice and this permission notice appear in all
8 ## copies. 8 ## copies.
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE. 21 ## SUCH DAMAGE.
22 ## 22 ##
23 23
24 # package version 24 # package version
25 %define V_opkg 1.6.2.13 25 %define V_opkg 1.8.3.2
26 %define V_asterisk 1.6.2.13 26 %define V_asterisk 1.8.3.2
27 %define V_asterisk_addons 1.6.2.2 27 %define V_asterisk_fax_digium 1.8.0_1.3.0
28 %define V_asterisk_sounds_core_en 1.4.20 28 %define V_asterisk_sounds_core 1.4.20
29 %define V_asterisk_sounds_core_de current 29 %define V_asterisk_sounds_extra 1.4.11
30 %define V_asterisk_sounds_extra_en 1.4.11 30 %define V_asterisk_sounds_amoogab 1.4
31 %define V_chan_capi 1.1.5 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
32 40
33 # package information 41 # package information
34 Name: asterisk 42 Name: asterisk
35 Summary: Private Branch Exchange (PBX) 43 Summary: Private Branch Exchange (PBX)
36 URL: http://www.asterisk.org/ 44 URL: http://www.asterisk.org/
39 Distribution: OpenPKG Community 47 Distribution: OpenPKG Community
40 Class: BASE 48 Class: BASE
41 Group: VoIP 49 Group: VoIP
42 License: GPL 50 License: GPL
43 Version: %{V_opkg} 51 Version: %{V_opkg}
44 Release: 20101019 52 Release: 20110314
45 53
46 # package options 54 # package options
47 %option with_dahdi no 55 %option with_dahdi no
48 %option with_capi no 56 %option with_capi no
49 %option with_ogg no 57 %option with_ogg no
51 %option with_fax no 59 %option with_fax no
52 %option with_avcodec no 60 %option with_avcodec no
53 %option with_ldap no 61 %option with_ldap no
54 %option with_radius no 62 %option with_radius no
55 %option with_sqlite no 63 %option with_sqlite no
64 %option with_srtp no
65 %option with_pgsql no
56 %option with_lua no 66 %option with_lua no
57 %option with_jabber no 67 %option with_jabber no
58 %option with_imap no 68 %option with_imap no
59 %option with_odbc 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
60 75
61 # list of sources 76 # list of sources
62 Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz 77 Source0: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-%{V_asterisk}.tar.gz
63 Source1: http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-%{V_asterisk_addons}.tar.gz 78 Source1: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz
64 Source2: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-%{V_asterisk_sounds_core_en}.tar.gz 79 Source2: ftp://ftp.europalab.com/pub/sfw/machsnds/asterisk-moh-freeplay-sln16.tar.gz
65 Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-%{V_asterisk_sounds_extra_en}.tar.gz 80 Source3: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-sln16-%{V_asterisk_sounds_mohop}.tar.gz
66 Source4: http://www.amooma.de/asterisk/sprachbausteine/asterisk-core-sounds-de-gsm-%{V_asterisk_sounds_core_de}.tar.gz 81 Source4: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-en-sln16-%{V_asterisk_sounds_core}.tar.gz
67 Source5: ftp://ftp.chan-capi.org/chan-capi/chan_capi-%{V_chan_capi}.tar.gz 82 Source5: http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en_AU-sln16-current.tar.gz
68 Source6: asterisk.txt 83 Source6: http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-core-sounds-es-sln16-%{V_asterisk_sounds_core}.tar.gz
69 Source7: rc.asterisk 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
70 Patch0: asterisk.patch 103 Patch0: asterisk.patch
104 Patch1: asterisk.patch.xfersips
105 Patch2: asterisk.patch.proxymwi
71 106
72 # build information 107 # build information
73 BuildPreReq: OpenPKG, openpkg >= 20100101, bison, gcc, make, grep 108 Prefix: %{l_prefix}
74 PreReq: OpenPKG, openpkg >= 20100101, MTA 109 BuildRoot: %{l_buildroot}
75 BuildPreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 110 BuildPreReq: OpenPKG, openpkg >= 20040130, bison, gcc, make, grep
76 PreReq: zlib, curl, openssl, ncurses, speex, popt, gmime22 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
77 %if "%{with_ogg}" == "yes" 114 %if "%{with_ogg}" == "yes"
78 BuildPreReq: vorbis-libs 115 BuildPreReq: vorbis-libs
79 PreReq: vorbis-libs 116 PreReq: vorbis-libs
80 %endif 117 %endif
81 %if "%{with_mp3}" == "yes" 118 %if "%{with_mp3}" == "yes"
87 %endif 124 %endif
88 %if "%{with_sqlite}" == "yes" 125 %if "%{with_sqlite}" == "yes"
89 BuildPreReq: sqlite 126 BuildPreReq: sqlite
90 PreReq: sqlite 127 PreReq: sqlite
91 %endif 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
92 %if "%{with_lua}" == "yes" 137 %if "%{with_lua}" == "yes"
93 BuildPreReq: lua 138 BuildPreReq: lua
94 PreReq: lua 139 PreReq: lua
95 %endif 140 %endif
96 %if "%{with_fax}" == "yes"
97 BuildPreReq: spandsp, tiff, jpeg, zlib
98 PreReq: spandsp, tiff, jpeg, zlib
99 %endif
100 %if "%{with_avcodec}" == "yes" 141 %if "%{with_avcodec}" == "yes"
101 BuildPreReq: ffmpeg 142 BuildPreReq: ffmpeg
102 PreReq: ffmpeg 143 PreReq: ffmpeg
103 %endif 144 %endif
104 %if "%{with_ldap}" == "yes" 145 %if "%{with_ldap}" == "yes"
115 %endif 156 %endif
116 %if "%{with_odbc}" == "yes" 157 %if "%{with_odbc}" == "yes"
117 BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes 158 BuildPreReq: unixodbc, sqlite, sqlite::with_odbc = yes
118 PreReq: unixodbc, sqlite, sqlite::with_odbc = yes 159 PreReq: unixodbc, sqlite, sqlite::with_odbc = yes
119 %endif 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
120 170
121 %description 171 %description
122 Asterisk is a complete Private Branch Exchange (PBX) in software. 172 Asterisk is a complete Private Branch Exchange (PBX) in software.
123 It provides all of the features you would expect from a PBX and 173 It provides more than the features normally expected from a PBX,
124 more. Asterisk does Voice over IP (VoIP) in many protocols. Asterisk 174 and can transceive Voice over IP (VoIP) in many protocols. Asterisk
125 provides Voicemail services with Directory, Call Conferencing, 175 provides voicemail services with directory, call conferencing,
126 Interactive Voice Response and Call Queuing. It has support for 176 interactive voice response and call queuing as well. It has support
127 three-way calling, caller ID services, ADSI, SIP, etc. Asterisk 177 for three way calling, caller ID, ADSI, and SIP, and requires no
128 needs no additional hardware for VoIP. 178 additional hardware for VoIP applications.
179
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>.
186
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.
129 192
130 %track 193 %track
131 prog asterisk = { 194 prog asterisk = {
132 version = %{V_asterisk} 195 version = %{V_asterisk}
133 url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ 196 url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/
134 regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz 197 regex = asterisk-(\d+\.\d+(\.\d+)+)\.tar\.gz
135 } 198 }
136 prog asterisk:addons = { 199 prog asterisk:fax_digium_32 = {
137 version = %{V_asterisk_addons} 200 version = %{V_asterisk_fax_digium}
138 url = http://downloads.asterisk.org/pub/telephony/asterisk/releases/ 201 url = http://downloads.digium.com/pub/telephony/fax/res_fax_digium/asterisk-1.8.0/x86-32/
139 regex = asterisk-addons-(\d+\.\d+(\.\d+)+)\.tar\.gz 202 regex = res_fax_digium-(__VER__)-generic_32.tar.gz\.tar\.gz
140 } 203 }
141 prog asterisk:sounds_core_en = { 204 prog asterisk:fax_digium_64 = {
142 version = %{V_asterisk_sounds_core_en} 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}
143 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ 211 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
144 regex = asterisk-core-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz 212 regex = asterisk-core-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
145 } 213 }
146 prog asterisk:sounds_extra_en = { 214 prog asterisk:sounds_extra = {
147 version = %{V_asterisk_sounds_extra_en} 215 version = %{V_asterisk_sounds_extra}
148 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/ 216 url = http://downloads.asterisk.org/pub/telephony/sounds/releases/
149 regex = asterisk-extra-sounds-en-alaw-(\d+\.\d+(\.\d+)+)\.tar\.gz 217 regex = asterisk-extra-sounds-en-sln16-(\d+\.\d+(\.\d+)+)\.tar\.gz
150 } 218 }
151 prog asterisk:sounds_core_de = { 219 prog asterisk:sounds_amootts = {
152 version = %{V_asterisk_sounds_core_de} 220 version = %{V_asterisk_sounds_amootts}
153 url = http://www.amooma.de/asterisk/sprachbausteine/ 221 url = http://www.amooma.de/asterisk/sprachbausteine/
154 regex = asterisk-core-sounds-de-gsm-(__VER__)\.tar\.gz 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
155 } 243 }
156 prog asterisk:chan_capi = { 244 prog asterisk:chan_capi = {
157 version = %{V_chan_capi} 245 version = %{V_chan_capi}
158 url = ftp://ftp.chan-capi.org/chan-capi/ 246 url = ftp://ftp.chan-capi.org/chan-capi/
159 regex = chan_capi-(__VER__)\.tar\.gz 247 regex = chan_capi-(__VER__)\.tar\.gz
160 } 248 }
161 249
162 %prep 250 %prep
163 %setup -q -n asterisk-%{V_asterisk} 251 %setup -q -n asterisk-%{V_asterisk}
164 %setup -q -n asterisk-%{V_asterisk} -D -T -a 1 252 %setup -q -n asterisk-%{V_asterisk} -D -T -a 1
165 %setup -q -n asterisk-%{V_asterisk} -D -T -a 5 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 $?
166 %patch -p0 266 %patch -p0
167 exit 0 267 %if "%{with_xfersips}" == "yes"
168 cp %{SOURCE2} %{SOURCE3} sounds/ 268 %patch -p0 -P 1
169 %{l_shtool} subst \ 269 %endif
170 -e 's;\(CORE_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_core_en};' \ 270 %if "%{with_proxymwi}" == "yes"
171 -e 's;\(EXTRA_SOUNDS_VERSION\):=.*$;\1:=%{V_asterisk_sounds_extra_en};' \ 271 %patch -p0 -P 2
172 sounds/Makefile 272 %endif
173 %{l_shtool} subst \ 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' \
174 -e 's;-lradiusclient-ng;-lradiusclient;g' \ 283 -e 's;-lradiusclient-ng;-lradiusclient;g' \
175 -e 's;radiusclient-ng\.h;radiusclient.h;g' \ 284 -e 's;radiusclient-ng\.h;radiusclient.h;g' \
176 configure cdr/cdr_radius.c 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
177 359
178 %build 360 %build
179 # sanity check 361 # sanity check operating system
180 %if "%{with_dahdi}" == "yes" 362 %if "%{with_dahdi}" == "yes"
181 dahdi_prefix="" 363 dahdi_prefix=""
182 case "%{l_platform -t}" in 364 case "%{l_platform -t}" in
183 *-linux* ) 365 *-linux* )
184 if [ ! -f /usr/include/linux/dahdi.h ]; then 366 if [ ! -f /usr/include/dahdi/user.h ]; then
185 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1 367 echo "option \"with_dahdi\" requires DAHDI Linux drivers installed" 1>&2; exit 1
186 fi 368 fi
187 dahdi_prefix=/usr 369 dahdi_prefix=/usr
188 ;; 370 ;;
189 *-freebsd* ) 371 *-freebsd* )
190 if [ ! -f /usr/local/include/dahdi/dahdi.h ]; then 372 if [ ! -f /usr/local/include/dahdi/user.h ]; then
191 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1 373 echo "option \"with_dahdi\" requires DAHDI FreeBSD drivers installed" 1>&2; exit 1
192 fi 374 fi
193 dahdi_prefix=/usr/local 375 dahdi_prefix=/usr/local
194 ;; 376 ;;
195 * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;; 377 * ) echo "option \"with_dahdi\" supported under Linux and FreeBSD only" 1>&2; exit 1 ;;
196 esac 378 esac
197 %endif 379 %endif
198 380 # correct platform dependent build configuration
199 # re-configure music-on-hold to find mpg123 381 extflg=
382 case "%{l_platform -t}" in
383 *-linux* )
384 pthlibflg='-lpthread'
385 ;;
386 esac
387
388 # adapt buildconf to find mpg123 (for music on hold)
200 %if "%{with_mp3}" == "yes" 389 %if "%{with_mp3}" == "yes"
201 mpg123="%{l_prefix}/bin/mpg123" 390 mpg123="%{l_prefix}/bin/mpg123"
202 %else 391 %else
203 mpg123="`which false`" 392 mpg123="`which false`"
204 %endif 393 %endif
205 %{l_shtool} subst \ 394 %{l_shtool} subst \
206 -e "s;/usr/local/bin/mpg123;$mpg123;" \ 395 -e "s;/usr/local/bin/mpg123;$mpg123;" \
207 -e "s;/usr/bin/mpg123;$mpg123;" \ 396 -e "s;/usr/bin/mpg123;$mpg123;" \
208 res/res_musiconhold.c apps/app_mp3.c 397 res/res_musiconhold.c apps/app_mp3.c
209 398
210 # build program 399 # configure program
211 %{l_shtool} subst \
212 -e 's;-llua5\.1;-llua;' \
213 -e 's;lua5\.1/lua\.h;lua/lua.h;' \
214 -e 's;ffmpeg/avcodec\.h;libavcodec/avcodec.h;' \
215 configure
216 ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config" 400 ( echo "ac_cv_prog_CONFIG_GMIME=%{l_prefix}/bin/gmime-config"
217 ) >config.cache 401 ) >config.cache
218 cflags="%{l_cflags -O}" 402 cflags="%{l_cflags -O}"
219 cppflags="%{l_cppflags ncurses lua .}" 403 cppflags="%{l_cppflags ncurses lua}"
220 ldflags="%{l_ldflags}" 404 ldflags="%{l_ldflags}"
221 libs="" 405 libs=""
222 cppflags="$cppflags `pkg-config gmime-2.0 --cflags-only-I`" 406 cppflags="$cppflags `pkg-config gmime-2.4 --cflags-only-I`"
223 ldflags="$ldflags `pkg-config gmime-2.0 --libs-only-L`" 407 ldflags="$ldflags `pkg-config gmime-2.4 --libs-only-L`"
224 libs="$libs `pkg-config gmime-2.0 --libs-only-l`" 408 libs="$libs `pkg-config gmime-2.4 --libs-only-l` -lssl -lcrypto"
225 %if "%{with_ogg}" == "yes" 409 %if "%{with_ogg}" == "yes"
226 libs="$libs -logg -lm" 410 libs="$libs -logg -lm"
227 %endif 411 %endif
228 %if "%{with_avcodec}" == "yes" 412 %if "%{with_avcodec}" == "yes"
229 libs="$libs -lavcodec -lavutil" 413 libs="$libs -lavcodec -lavutil"
230 %endif 414 %endif
231 %if "%{with_ldap}" == "yes" 415 %if "%{with_ldap}" == "yes"
232 libs="$libs -lldap -llber -lssl -lcrypto" 416 libs="$libs -lldap -llber"
233 %endif 417 %endif
234 %if "%{with_dahdi}" == "yes" 418 %if "%{with_dahdi}" == "yes"
235 cppflags="$cppflags -I$dahdi_prefix/include" 419 cppflags="$cppflags -I$dahdi_prefix/include"
236 ldflags="$ldflags -L$dahdi_prefix/lib" 420 ldflags="$ldflags -L$dahdi_prefix/lib"
237 %endif 421 %endif
238 CC="%{l_cc}" \ 422 CC="%{l_cc}" \
239 CFLAGS="$cflags" \ 423 CFLAGS="$cflags" \
240 CPPFLAGS="$cppflags" \ 424 CPPFLAGS="$cppflags" \
241 LDFLAGS="$ldflags" \ 425 LDFLAGS="$ldflags" \
242 LIBS="$libs" \ 426 LIBS="$libs" \
427 INSTALL="%{l_shtool} install -c" \
428 PTHREAD_LIBS="$pthlibflg" \
243 ./configure \ 429 ./configure \
244 --cache-file=./config.cache \ 430 --cache-file=./config.cache \
245 --prefix=%{l_prefix} \ 431 --prefix=%{l_prefix} \
246 --mandir=%{l_prefix}/man \ 432 --mandir=%{l_prefix}/man \
247 --sysconfdir=%{l_prefix}/etc \ 433 --sysconfdir=%{l_prefix}/etc \
248 --localstatedir=%{l_prefix}/var/asterisk \ 434 --localstatedir=%{l_prefix}/var \
435 --datarootdir=%{l_prefix}/share/asterisk \
436 --with-crypto=%{l_prefix} \
249 --with-curl=%{l_prefix} \ 437 --with-curl=%{l_prefix} \
250 --with-ncurses \ 438 --with-ncurses=%{l_prefix} \
251 --with-gsm="internal" \ 439 --with-gsm="internal" \
252 --with-popt=%{l_prefix} \ 440 --with-popt=%{l_prefix} \
253 %if "%{with_sqlite}" == "yes" 441 %if "%{with_sqlite}" == "yes"
254 --with-sqlite3=%{l_prefix} \ 442 --with-sqlite3=%{l_prefix} \
255 %else 443 %else
256 --without-sqlite3 \ 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 \
257 %endif 455 %endif
258 --with-speex=%{l_prefix} \ 456 --with-speex=%{l_prefix} \
259 --with-speexdsp=%{l_prefix} \ 457 --with-speexdsp=%{l_prefix} \
260 --with-ssl=%{l_prefix} \ 458 --with-ssl=%{l_prefix} \
261 --with-gmime=%{l_prefix} \ 459 --with-gmime=%{l_prefix} \
299 %else 497 %else
300 --without-radius \ 498 --without-radius \
301 %endif 499 %endif
302 %if "%{with_imap}" == "yes" 500 %if "%{with_imap}" == "yes"
303 --with-imap=%{l_prefix} \ 501 --with-imap=%{l_prefix} \
502 --disable-largefile \
304 %else 503 %else
305 --without-imap \ 504 --without-imap \
306 %endif 505 %endif
307 %if "%{with_odbc}" == "yes" 506 %if "%{with_odbc}" == "yes"
308 --with-odbc=%{l_prefix} \ 507 --with-odbc=%{l_prefix} \
309 %else 508 %else
310 --without-odbc \ 509 --without-odbc \
311 %endif 510 %endif
511 %if "%{with_libpri}" == "yes"
512 --with-pri=%{l_prefix} \
513 %else
514 --without-pri \
515 %endif
516 --with-sounds-cache=no \
312 --without-netsnmp \ 517 --without-netsnmp \
313 --without-isdnnet \ 518 --without-isdnnet \
314 --without-misdn \ 519 --without-misdn \
315 --without-kde \
316 --without-nbs \ 520 --without-nbs \
317 --without-newt \ 521 --without-newt \
318 --without-asound \ 522 --without-asound \
319 --without-oss \ 523 --without-oss \
320 --without-qt \
321 --without-sqlite \ 524 --without-sqlite \
322 --without-postgres \
323 --without-tds \ 525 --without-tds \
324 --without-osptk \ 526 --without-osptk \
325 --without-pri \
326 --without-suppserv \ 527 --without-suppserv \
327 --without-vpb \ 528 --without-vpb \
328 --without-sdl \ 529 --without-sdl \
329 --without-x11 \ 530 --without-x11 \
330 --without-gtk \ 531 --without-gtk \
331 --without-gtk2 532 --without-gtk2
332 %{l_make} %{l_mflags} \ 533
333 CC="%{l_cc} $cflags -I. -I./include -I../include -I../../include $cppflags" 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
546
547 # build program
548 %{l_make} %{l_mflags -O} \
549 CC="%{l_cc} $cflags -I../include -I../../include $cppflags" NOISY_BUILD=yes
334 550
335 # build addon modules 551 # build addon modules
336 ( cd asterisk-addons-* 552 ( cd addons
337 ASTERISK_DIR="`pwd`/.." \ 553 %{l_make} %{l_mflags -O} \
338 CC="%{l_cc}" \ 554 CC="%{l_cc} %{l_cflags -O} -I../../include %{l_cppflags ncurses}" NOISY_BUILD=yes ASTTOPDIR=..
339 CFLAGS="%{l_cflags -O}" \
340 CPPFLAGS="%{l_cppflags ncurses tiff .}" \
341 LDFLAGS="%{l_ldflags}" \
342 %if "%{with_fax}" == "yes"
343 LIBS="-ltiff -ljpeg -lz -lm" \
344 %else
345 LIBS="-lm" \
346 %endif
347 ./configure \
348 --prefix=%{l_prefix} \
349 --mandir=%{l_prefix}/man \
350 --sysconfdir=%{l_prefix}/etc \
351 --localstatedir=%{l_prefix}/var/asterisk \
352 --with-ncurses \
353 --with-asterisk \
354 --without-mysqlclient \
355 %if "%{with_fax}" == "yes"
356 --with-spandsp=%{l_prefix}
357 %else
358 --without-spandsp
359 %endif
360 %{l_make} %{l_mflags} \
361 CC="%{l_cc} %{l_cflags -O} -I. %{l_cppflags ncurses tiff .}"
362 ) || exit $? 555 ) || exit $?
556
557 # build agi programs
558 ( cd agi && %{l_make} %{l_mflags -O}) || exit $?
559
363 %if "%{with_capi}" == "yes" 560 %if "%{with_capi}" == "yes"
561 # build capi channel
364 ( cd chan_capi-* 562 ( cd chan_capi-*
365 ln -s ../include/asterisk . 563 ln -s ../include/asterisk .
366 ln -s ../include/asterisk.h . 564 ln -s ../include/asterisk.h .
367 %{l_make} %{l_mflags} \ 565 %{l_make} %{l_mflags -O} V=1 \
368 INSTALL_PREFIX=%{l_prefix} \ 566 INSTALL_PREFIX=%{l_prefix} \
369 ASTERISK_HEADER_DIR="`pwd`" 567 ASTERISK_HEADER_DIR="`pwd`" \
370 ) || exit $? 568 ) || exit $?
371 %endif 569 %endif
372 570
373 %install 571 %install
374 # install program 572 # install program
573 rm -rf $RPM_BUILD_ROOT
375 %{l_make} %{l_mflags} install \ 574 %{l_make} %{l_mflags} install \
376 DESTDIR=$RPM_BUILD_ROOT \ 575 DESTDIR=$RPM_BUILD_ROOT \
377 INSTALL_PREFIX=%{l_prefix} 576 INSTALL_PREFIX=%{l_prefix}
378 577
379 # install addon modules 578 # install addon modules
380 ( cd asterisk-addons-* 579 ( cd addons
381 %{l_make} %{l_mflags} install \ 580 %{l_make} %{l_mflags} install \
581 ASTTOPDIR=.. \
382 DESTDIR=$RPM_BUILD_ROOT \ 582 DESTDIR=$RPM_BUILD_ROOT \
383 INSTALL_PREFIX=%{l_prefix} 583 INSTALL_PREFIX=%{l_prefix}
384 ) || exit $? 584 ) || exit $?
585
385 %if "%{with_capi}" == "yes" 586 %if "%{with_capi}" == "yes"
587 # install capi channel
386 ( cd chan_capi-* 588 ( cd chan_capi-*
387 %{l_make} %{l_mflags} install \ 589 %{l_make} %{l_mflags} install \
388 INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \ 590 INSTALL_PREFIX=$RPM_BUILD_ROOT%{l_prefix} \
389 INSTALL="%{l_shtool} install -c" \ 591 INSTALL="%{l_shtool} install -c" \
390 MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules' 592 MODULES_DIR='$(INSTALL_PREFIX)/lib/asterisk/modules'
391 ) || exit $? 593 ) || exit $?
392 %endif 594 %endif
393 595
394 # install addon sounds 596 %if "%{with_fax}" == "yes"
395 %{l_shtool} mkdir -f -p -m 755 \ 597 # install fax support
396 $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de 598 case "%{l_platform -t}" in
397 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/de 599 amd64*-* )
398 %{l_gzip} -d -c %{SOURCE4} | %{l_tar} xf - 600 %{l_shtool} install -c -m 755 \
399 ) || exit $? 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
622
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
653
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
658
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
667
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
671
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
682
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}
694
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
699
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
705
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
713
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)
400 721
401 # strip down installation 722 # strip down installation
402 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true 723 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/autosupport >/dev/null 2>&1 || true
403 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true 724 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/safe_asterisk >/dev/null 2>&1 || true
404 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true 725 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/autosupport.8 >/dev/null 2>&1 || true
405 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true 726 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/safe_asterisk.8 >/dev/null 2>&1 || true
406 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/firmware >/dev/null 2>&1 || true
407 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true 727 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/images >/dev/null 2>&1 || true
408 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/.asterisk* >/dev/null 2>&1 || true 728 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CREDIT* >/dev/null 2>&1 || true
409 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CREDIT* >/dev/null 2>&1 || true 729 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/moh/CHANGES* >/dev/null 2>&1 || true
410 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/en/CHANGES* >/dev/null 2>&1 || true 730 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CREDIT* >/dev/null 2>&1 || true
411 rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/es >/dev/null 2>&1 || true 731 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/*/CHANGES* >/dev/null 2>&1 || true
412 rmdir $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/sounds/fr >/dev/null 2>&1 || true
413 732
414 # create additional directories 733 # create additional directories
415 %{l_shtool} mkdir -f -p -m 755 \ 734 %{l_shtool} mkdir -f -p -m 755 \
416 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db 735 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/db \
417 736 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/lib/licenses \
418 # post-adjust installation 737 $RPM_BUILD_ROOT%{l_prefix}/var/asterisk/spool/outgoing
419 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 738
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
420 mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \ 744 mv $RPM_BUILD_ROOT%{l_prefix}/share/asterisk/agi-bin \
421 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin 745 $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin
746
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 $?
422 for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do 753 for bin in $RPM_BUILD_ROOT%{l_prefix}/lib/asterisk/agi-bin/*.*; do
423 mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'` 754 mv $bin `echo $bin | sed -e 's;\.[^.]*$;;'`
424 done 755 done
425 756
426 # install default configuration 757 # install default configuration
442 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name 773 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
443 %{l_shtool} install -c -m 644 %{l_value -s -a} \ 774 %{l_shtool} install -c -m 644 %{l_value -s -a} \
444 $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/ 775 $name $RPM_BUILD_ROOT%{l_prefix}/etc/asterisk/
445 done 776 done
446 777
447 # install run-command script 778 # install runcommand script
448 %{l_shtool} mkdir -f -p -m 755 \ 779 %{l_shtool} mkdir -f -p -m 755 \
449 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 780 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
450 %{l_shtool} install -c -m 755 %{l_value -s -a} \ 781 %{l_shtool} install -c -m 755 %{l_value -s -a} \
451 %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 782 %{SOURCE rc.asterisk} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
452 783
453 # determine installation files 784 # determine installation files
454 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 785 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
455 %{l_files_std} \ 786 %{l_files_std} \
787 '%config %{l_prefix}/var/asterisk/lib/licenses' \
456 '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \ 788 '%config %attr(640,%{l_mgrp},%{l_rgrp}) %{l_prefix}/etc/asterisk/*' \
457 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk' 789 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/asterisk'
458 790
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' \
794
459 %files -f files 795 %files -f files
460 796
461 %clean 797 %clean
798 rm -rf $RPM_BUILD_ROOT
462 799
463 %post 800 %post
464 %if "%{with_dahdi}" == "yes" 801 %if "%{with_dahdi}" == "yes"
465 if [ $1 -eq 1 ]; then 802 if [ $1 -eq 1 ]; then
466 case "%{l_platform -t}" in 803 case "%{l_platform -t}" in
493 echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b 830 echo "CREATE TABLE map (key TEXT, val TEXT);" | $RPM_INSTALL_PREFIX/bin/isql "asterisk-sqlite" -b
494 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true 831 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/asterisk/db/asterisk.sqlite >/dev/null 2>&1 || true
495 ) || exit $? 832 ) || exit $?
496 fi 833 fi
497 %endif 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
498 # after upgrade, restart service 845 # after upgrade, restart service
499 [ $1 -eq 2 ] || exit 0 846 [ $1 -eq 2 ] || exit 0
500 eval `%{l_rc} asterisk status 2>/dev/null` 847 eval `%{l_rc} asterisk status 2>/dev/null`
501 [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart 848 [ ".$asterisk_active" = .yes ] && %{l_rc} asterisk restart
502 exit 0 849 exit 0
507 %{l_rc} asterisk stop 2>/dev/null 854 %{l_rc} asterisk stop 2>/dev/null
508 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true 855 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/* >/dev/null 2>&1 || true
509 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true 856 rm -f $RPM_INSTALL_PREFIX/var/asterisk/log/cdr-*/* >/dev/null 2>&1 || true
510 rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true 857 rm -f $RPM_INSTALL_PREFIX/var/asterisk/run/* >/dev/null 2>&1 || true
511 rm -f $RPM_INSTALL_PREFIX/var/asterisk/spool/*/* >/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
512 rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true 860 rm -f $RPM_INSTALL_PREFIX/var/asterisk/db/* >/dev/null 2>&1 || true
513 %if "%{with_odbc}" == "yes" 861 %if "%{with_odbc}" == "yes"
514 # before erase, optionally unlink from ODBC and destroy database 862 # before erase, optionally unlink from ODBC and destroy database
515 $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true 863 $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "asterisk-sqlite" >/dev/null 2>&1 || true
516 %endif 864 %endif

mercurial