/[gentoo-x86]/net-misc/asterisk/asterisk-1.6.1.5.ebuild
Gentoo

Contents of /net-misc/asterisk/asterisk-1.6.1.5.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Sep 4 11:51:31 2009 UTC (10 years, 3 months ago) by chainsaw
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Version bump, security fix for IAX2 denial of service (AST-2009-006). Patch by Oskar Ellström to cope with non-standard LUA header location closes bug #283231 by Thomas Stein. Removing vulnerable 1.6 series ebuilds.
(Portage version: 2.1.6.13/cvs/Linux x86_64)

1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.6.1.5.ebuild,v 1.1 2009/08/29 22:53:20 chainsaw Exp $
4
5 EAPI=1
6 inherit eutils autotools
7
8 MY_P="${PN}-${PV/_/-}"
9
10 DESCRIPTION="Asterisk: A Modular Open Source PBX System"
11 HOMEPAGE="http://www.asterisk.org/"
12 SRC_URI="http://downloads.digium.com/pub/asterisk/releases/${MY_P}.tar.gz"
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16
17 IUSE="alsa +caps curl dahdi debug freetds h323 iconv imap jabber ldap keepsrc misdn newt nosamples odbc oss postgres radius snmp span speex ssl sqlite static vorbis"
18
19 RDEPEND="virtual/libc
20 sys-libs/ncurses
21 dev-libs/popt
22 sys-libs/zlib
23 alsa? ( media-libs/alsa-lib )
24 caps? ( sys-libs/libcap )
25 curl? ( net-misc/curl )
26 dahdi? ( >=net-libs/libpri-1.4.7
27 net-misc/dahdi-tools )
28 freetds? ( dev-db/freetds )
29 h323? ( dev-libs/pwlib
30 net-libs/openh323 )
31 iconv? ( virtual/libiconv )
32 imap? ( virtual/imap-c-client )
33 jabber? ( dev-libs/iksemel )
34 ldap? ( net-nds/openldap )
35 misdn? ( net-dialup/misdnuser )
36 newt? ( dev-libs/newt )
37 odbc? ( dev-db/unixODBC )
38 postgres? ( virtual/postgresql-base )
39 radius? ( net-dialup/radiusclient-ng )
40 snmp? ( net-analyzer/net-snmp )
41 span? ( media-libs/spandsp )
42 speex? ( media-libs/speex )
43 sqlite? ( dev-db/sqlite )
44 ssl? ( dev-libs/openssl )
45 vorbis? ( media-libs/libvorbis )"
46
47 DEPEND="${RDEPEND}
48 !<net-misc/asterisk-addons-1.6"
49
50 S="${WORKDIR}/${MY_P}"
51
52 #
53 # shortcuts
54 #
55
56 # update from asterisk-1.0.x
57 is_ast10update() {
58 return $(has_version "=net-misc/asterisk-1.0*")
59 }
60
61 # update from asterisk-1.2.x
62 is_ast12update() {
63 return $(has_version "=net-misc/asterisk-1.2*")
64 }
65
66 # update from asterisk 1.4.x
67 is_ast14update() {
68 return $(has_version "=net-misc/asterisk-1.4*")
69 }
70
71 # update in the asterisk-1.6.x line
72 is_astupdate() {
73 if ! is_ast10update && ! is_ast12update && !is_ast14update; then
74 return $(has_version "<net-misc/asterisk-${PV}")
75 fi
76 return 0
77 }
78
79 get_available_modules() {
80 local modules mod x
81
82 # build list of available modules...
83 for x in app cdr codec format func pbx res; do
84
85 for mod in $(find "${S}" -type f -name "${x}_*.c*" -print)
86 do
87 modules="${modules} $(basename ${mod/%.c*})"
88 done
89 done
90
91 echo "${modules}"
92 }
93
94 pkg_setup() {
95 local checkfailed=0 waitaftermsg=0
96
97 if is_ast10update || is_ast12update || is_ast14update ; then
98 ewarn " Asterisk UPGRADE Warning"
99 ewarn ""
100 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 after the installation!"
101 ewarn ""
102 ewarn " Asterisk UPGRADE Warning"
103 echo
104 waitaftermsg=1
105 fi
106
107 if [[ $waitaftermsg -eq 1 ]]; then
108 einfo "Press Ctrl+C to abort"
109 echo
110 ebeep 10
111 fi
112
113 #
114 # Regular checks
115 #
116 einfo "Running some pre-flight checks..."
117 echo
118
119 # imap requires ssl if imap-c-client was built with ssl,
120 # conversely if ssl and imap are both on then imap-c-client needs ssl
121 if use imap; then
122 if use ssl && ! built_with_use virtual/imap-c-client ssl; then
123 eerror
124 eerror "IMAP with SSL requested, but your IMAP C-Client libraries"
125 eerror "are built without SSL!"
126 eerror
127 die "Please recompile the IMAP C-Client libraries with SSL support enabled"
128 elif ! use ssl && built_with_use virtual/imap-c-client ssl; then
129 eerror
130 eerror "IMAP without SSL requested, but your IMAP C-Client"
131 eerror "libraries are built with SSL!"
132 eerror
133 die "Please recompile the IMAP C-Client libraries without SSL support enabled"
134 fi
135 fi
136
137 if [[ -n "${ASTERISK_MODULES}" ]] ; then
138 ewarn "You are overriding ASTERISK_MODULES. We will assume you know what you are doing. There is no support for this option, try without if you see breakage."
139 fi
140 }
141
142 src_unpack() {
143 unpack ${A}
144 cd "${S}"
145
146 #
147 # comment about h323 issues
148 #
149 if use h323 ; then
150 ewarn "h323 useflag: It is known that the h323 module doesn't compile
151 the \"normal\" way: For a workaround, asterisk will be built two times
152 without cleaning the build dir."
153 fi
154
155 #
156 # put pid file(s) into /var/run/asterisk
157 #
158 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-var_rundir.patch || die "patch failed"
159
160 #
161 # fix gsm codec cflags (e.g. i586 core epias) and disable
162 # assembler optimizations
163 #
164 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-gsm-pic.patch || die "patch failed"
165
166 #
167 # add missing LIBS for uclibc
168 #
169 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-uclibc.patch || die "patch failed"
170
171 #
172 # link UW-IMAP with Kerberos5 if necessary
173 #
174 epatch "${FILESDIR}"/1.6.1/asterisk-1.6.1-imap-kerberos.patch || die "patch failed"
175
176 AT_M4DIR=autoconf eautoreconf
177
178 # parse modules list
179 if [[ -n "${ASTERISK_MODULES}" ]]; then
180 local x modules="$(get_available_modules)"
181
182 einfo "Custom list of modules specified, checking..."
183
184 use debug && {
185 einfo "Available modules: ${modules}"
186 einfo " Selected modules: ${ASTERISK_MODULES}"
187 }
188
189 for x in ${ASTERISK_MODULES}; do
190 if [[ "${x}" = "-*" ]]; then
191 MODULES_LIST=""
192 else
193 if has ${x} ${modules}
194 then
195 MODULES_LIST="${MODULES_LIST} ${x}"
196 else
197 eerror "Unknown module: ${x}"
198 fi
199 fi
200 done
201
202 export MODULES_LIST
203 fi
204 }
205
206 src_compile() {
207 #
208 # start with configure
209 #
210 econf \
211 --libdir="/usr/$(get_libdir)" \
212 --localstatedir="/var" \
213 --with-gsm=internal \
214 --with-popt \
215 --with-z \
216 $(use_with alsa asound) \
217 $(use_with caps cap) \
218 $(use_with curl) \
219 $(use_with dahdi pri) \
220 $(use_with dahdi tonezone) \
221 $(use_with dahdi) \
222 $(use_with freetds tds) \
223 $(use_with h323 h323 "/usr/share/openh323") \
224 $(use_with h323 pwlib "/usr/share/pwlib") \
225 $(use_with iconv) \
226 $(use_with imap) \
227 $(use_with jabber iksemel) \
228 $(use_with misdn isdnnet) \
229 $(use_with misdn suppserv) \
230 $(use_with misdn) \
231 $(use_with newt) \
232 $(use_with odbc) \
233 $(use_with oss) \
234 $(use_with postgres) \
235 $(use_with radius) \
236 $(use_with snmp netsnmp) \
237 $(use_with span spandsp) \
238 $(use_with speex) \
239 $(use_with speex speexdsp) \
240 $(use_with sqlite sqlite3) \
241 $(use_with ssl crypto) \
242 $(use_with ssl) \
243 $(use_with vorbis ogg) \
244 $(use_with vorbis) || die "econf failed"
245
246 #
247 # custom module filter
248 # run menuselect to evaluate the list of modules
249 # and rewrite the list afterwards
250 #
251 if [[ -n "${MODULES_LIST}" ]]
252 then
253 local mod category tmp_list failed_list
254
255 ###
256 # run menuselect
257
258 emake menuselect.makeopts || die "emake menuselect.makeopts failed"
259
260 ###
261 # get list of modules with failed dependencies
262
263 failed_list="$(awk -F= '/^MENUSELECT_DEPSFAILED=/{ print $3 }' menuselect.makeopts)"
264
265 ###
266 # traverse our list of modules
267
268 for category in app cdr codec format func pbx res; do
269 tmp_list=""
270
271 # search list of modules for matching ones first...
272 for mod in ${MODULES_LIST}; do
273 # module is from current category?
274 if [[ "${mod/%_*}" = "${category}" ]]
275 then
276 # check menuselect thinks the dependencies are met
277 if has ${mod} ${failed_list}
278 then
279 eerror "${mod}: dependencies required to build this module are not met, NOT BUILDING!"
280 else
281 tmp_list="${tmp_list} ${mod}"
282 fi
283 fi
284 done
285
286 use debug && echo "${category} tmp: ${tmp_list}"
287
288 # replace the module list for $category with our custom one
289 if [[ -n "${tmp_list}" ]]
290 then
291 category="$(echo ${category} | tr '[:lower:]' '[:upper:]')"
292 sed -i -e "s:^\(MENUSELECT_${category}S?\):\1=${tmp_list}:" \
293 menuselect.makeopts || die "failed to set list of ${category} applications"
294 fi
295 done
296 fi
297
298 #
299 # fasten your seatbelts (and start praying)
300 #
301 if use h323 ; then
302 # emake one time to get h323 to make.... yea not "clean" but works
303 emake
304 fi
305
306 emake || die "emake failed"
307 }
308
309 src_install() {
310 # setup directory structure
311 #
312 mkdir -p "${D}"usr/lib/pkgconfig
313
314 emake DESTDIR="${D}" install || die "emake install failed"
315 emake DESTDIR="${D}" samples || die "emake samples failed"
316
317 # remove installed sample files if nosamples flag is set
318 if use nosamples; then
319 einfo "Skipping installation of sample files..."
320 rm -f "${D}"var/lib/asterisk/mohmp3/*
321 rm -f "${D}"var/lib/asterisk/sounds/demo-*
322 rm -f "${D}"var/lib/asterisk/agi-bin/*
323 else
324 einfo "Sample files have been installed"
325 fi
326 rm -rf "${D}"var/spool/asterisk/voicemail/default
327
328 # move sample configuration files to doc directory
329 if is_ast10update || is_ast12update || is_ast14update; then
330 einfo "Updating from old (pre-1.6) asterisk version, new configuration files have been installed"
331 einfo "into "${ROOT}"etc/asterisk, use etc-update or dispatch-conf to update them"
332 fi
333
334 einfo "Configuration samples have been moved to: "${ROOT}"/usr/share/doc/${PF}/conf"
335 insinto /usr/share/doc/${PF}/conf
336 doins "${D}"etc/asterisk/*.conf*
337
338 # keep directories
339 keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail}
340 keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
341
342 newinitd "${FILESDIR}"/1.6.1/asterisk.rc6 asterisk
343 newconfd "${FILESDIR}"/1.6.0/asterisk.confd asterisk
344
345 # some people like to keep the sources around for custom patching
346 # copy the whole source tree to /usr/src/asterisk-${PVF} and run make clean there
347 if use keepsrc
348 then
349 einfo "keepsrc useflag enabled, copying source..."
350 dodir /usr/src
351
352 cp -dPR "${S}" "${D}"/usr/src/${PF} || die "copying source tree failed"
353
354 ebegin "running make clean..."
355 emake -C "${D}"/usr/src/${PF} clean >/dev/null || die "make clean failed"
356 eend $?
357
358 einfo "Source files have been saved to "${ROOT}"usr/src/${PF}"
359 fi
360
361 # install the upgrade documentation
362 #
363 dodoc README UPGRADE* BUGS CREDITS
364
365 # install snmp mib files
366 #
367 if use snmp
368 then
369 insinto /usr/share/snmp/mibs/
370 doins doc/digium-mib.txt doc/asterisk-mib.txt
371 fi
372 }
373
374 pkg_preinst() {
375 enewgroup asterisk
376 enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
377 }
378
379 pkg_postinst() {
380 ebegin "Fixing up permissions"
381 chown -R asterisk:asterisk "${ROOT}"var/log/asterisk
382 chmod -R u=rwX,g=rX,o= "${ROOT}"var/log/asterisk
383
384 for x in lib run spool; do
385 chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
386 chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
387 done
388
389 chown asterisk:asterisk "${ROOT}"etc/asterisk/
390 chown asterisk:asterisk "${ROOT}"etc/asterisk/*.adsi
391 chown asterisk:asterisk "${ROOT}"etc/asterisk/extensions.ael
392 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/
393 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/*.adsi
394 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/extensions.ael
395 eend $?
396
397 #
398 # Announcements, warnings, reminders...
399 #
400 einfo "Asterisk has been installed"
401 echo
402 elog "If you want to know more about asterisk, visit these sites:"
403 elog "http://www.asteriskdocs.org/"
404 elog "http://www.voip-info.org/wiki-Asterisk"
405 echo
406 elog "http://www.automated.it/guidetoasterisk.htm"
407 echo
408 elog "Gentoo VoIP IRC Channel:"
409 elog "#gentoo-voip @ irc.freenode.net"
410 echo
411 echo
412
413 #
414 # Warning about 1.x -> 1.6 changes...
415 #
416 if is_ast10update || is_ast12update || is_ast14update; then
417 ewarn ""
418 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 before continuing"
419 ewarn ""
420 fi
421 }
422
423 pkg_config() {
424 einfo "Do you want to reset file permissions and ownerships (y/N)?"
425
426 read tmp
427 tmp="$(echo $tmp | tr '[:upper:]' '[:lower:]')"
428
429 if [[ "$tmp" = "y" ]] ||\
430 [[ "$tmp" = "yes" ]]
431 then
432 einfo "Resetting permissions to defaults..."
433
434 for x in spool run lib log; do
435 chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
436 chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
437 done
438
439 chown -R root:asterisk "${ROOT}"etc/asterisk
440 chmod -R u=rwX,g=rwX,o= "${ROOT}"etc/asterisk
441
442 einfo "done"
443 else
444 einfo "skipping"
445 fi
446 }

  ViewVC Help
Powered by ViewVC 1.1.20