Gentoo Archives: gentoo-commits

From: "Tony Vroon (chainsaw)" <chainsaw@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/asterisk: ChangeLog asterisk-1.6.2.5.ebuild asterisk-1.6.1.17.ebuild asterisk-1.6.1.16.ebuild asterisk-1.6.2.4.ebuild
Date: Mon, 01 Mar 2010 22:07:51
Message-Id: E1NmDmF-0004Qc-Mm@stork.gentoo.org
1 chainsaw 10/03/01 22:07:47
2
3 Modified: ChangeLog
4 Added: asterisk-1.6.2.5.ebuild asterisk-1.6.1.17.ebuild
5 Removed: asterisk-1.6.1.16.ebuild asterisk-1.6.2.4.ebuild
6 Log:
7 Security update AST-2010-003 on the 1.6.1 & 1.6.2 branches. This addresses invalid parsing of ACL rules. Removed vulnerable ebuilds.
8 (Portage version: 2.2_rc63/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.251 net-misc/asterisk/ChangeLog
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/ChangeLog?rev=1.251&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/ChangeLog?rev=1.251&content-type=text/plain
15 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/ChangeLog?r1=1.250&r2=1.251
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v
20 retrieving revision 1.250
21 retrieving revision 1.251
22 diff -u -r1.250 -r1.251
23 --- ChangeLog 21 Feb 2010 21:44:08 -0000 1.250
24 +++ ChangeLog 1 Mar 2010 22:07:46 -0000 1.251
25 @@ -1,6 +1,15 @@
26 # ChangeLog for net-misc/asterisk
27 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.250 2010/02/21 21:44:08 chainsaw Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/ChangeLog,v 1.251 2010/03/01 22:07:46 chainsaw Exp $
30 +
31 +*asterisk-1.6.2.5 (01 Mar 2010)
32 +*asterisk-1.6.1.17 (01 Mar 2010)
33 +
34 + 01 Mar 2010; <chainsaw@g.o> -asterisk-1.6.1.16.ebuild,
35 + +asterisk-1.6.1.17.ebuild, -asterisk-1.6.2.4.ebuild,
36 + +asterisk-1.6.2.5.ebuild:
37 + Security update AST-2010-003 on the 1.6.1 & 1.6.2 branches. This addresses
38 + invalid parsing of ACL rules. Removed vulnerable ebuilds.
39
40 *asterisk-1.2.40 (21 Feb 2010)
41
42
43
44
45 1.1 net-misc/asterisk/asterisk-1.6.2.5.ebuild
46
47 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/asterisk-1.6.2.5.ebuild?rev=1.1&view=markup
48 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/asterisk-1.6.2.5.ebuild?rev=1.1&content-type=text/plain
49
50 Index: asterisk-1.6.2.5.ebuild
51 ===================================================================
52 # Copyright 1999-2010 Gentoo Foundation
53 # Distributed under the terms of the GNU General Public License v2
54 # $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.6.2.5.ebuild,v 1.1 2010/03/01 22:07:46 chainsaw Exp $
55
56 EAPI=1
57 inherit eutils autotools linux-info
58
59 MY_P="${PN}-${PV/_/-}"
60
61 DESCRIPTION="Asterisk: A Modular Open Source PBX System"
62 HOMEPAGE="http://www.asterisk.org/"
63 SRC_URI="http://downloads.digium.com/pub/telephony/asterisk/releases/${MY_P}.tar.gz"
64 LICENSE="GPL-2"
65 SLOT="0"
66 KEYWORDS="~amd64 ~x86"
67
68 IUSE="alsa +caps curl dahdi debug freetds iconv jabber ldap keepsrc misdn newt nosamples oss postgres radius snmp span speex ssl sqlite static vorbis"
69
70 RDEPEND="sys-libs/ncurses
71 dev-libs/popt
72 sys-libs/zlib
73 alsa? ( media-libs/alsa-lib )
74 caps? ( sys-libs/libcap )
75 curl? ( net-misc/curl )
76 dahdi? ( >=net-libs/libpri-1.4.7
77 net-misc/dahdi-tools )
78 freetds? ( dev-db/freetds )
79 iconv? ( virtual/libiconv )
80 jabber? ( dev-libs/iksemel )
81 ldap? ( net-nds/openldap )
82 misdn? ( net-dialup/misdnuser )
83 newt? ( dev-libs/newt )
84 postgres? ( virtual/postgresql-base )
85 radius? ( net-dialup/radiusclient-ng )
86 snmp? ( net-analyzer/net-snmp )
87 span? ( media-libs/spandsp )
88 speex? ( media-libs/speex )
89 sqlite? ( dev-db/sqlite )
90 ssl? ( dev-libs/openssl )
91 vorbis? ( media-libs/libvorbis )"
92
93 DEPEND="${RDEPEND}
94 !<net-misc/asterisk-addons-1.6
95 !net-misc/asterisk-chan_unistim
96 !net-misc/zaptel"
97
98 S="${WORKDIR}/${MY_P}"
99
100 get_available_modules() {
101 local modules mod x
102
103 # build list of available modules...
104 for x in app cdr codec format func pbx res; do
105
106 for mod in $(find "${S}" -type f -name "${x}_*.c*" -print)
107 do
108 modules="${modules} $(basename ${mod/%.c*})"
109 done
110 done
111
112 echo "${modules}"
113 }
114
115 pkg_setup() {
116 if [[ -n "${ASTERISK_MODULES}" ]] ; then
117 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."
118 fi
119 CONFIG_CHECK="~!NF_CONNTRACK_SIP"
120 local WARNING_NF_CONNTRACK_SIP="SIP (NAT) connection tracking is a module written for a single SIP client talking to a
121 remote server. It is not able to track multiple remote SIP clients registering with
122 a local server. Critical SIP packets may be dropped."
123 check_extra_config
124 }
125
126 src_unpack() {
127 unpack ${A}
128 cd "${S}"
129
130 #
131 # fix gsm codec cflags (e.g. i586 core epias) and disable
132 # assembler optimizations
133 #
134 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-gsm-pic.patch || die "patch failed"
135
136 #
137 # add missing LIBS for uclibc
138 #
139 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-uclibc.patch || die "patch failed"
140
141 #
142 # make sure FXO ports are usable immediately, without requiring an inbound call first
143 # https://issues.asterisk.org/view.php?id=14577
144 #
145 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-fxsks-hookstate.patch || die "patch failed"
146
147 #
148 # do not ignore alarm-cleared event while V23 caller ID detection is in progress
149 # otherwise automated British Telecom line test causes permanent red alarm
150 # https://issues.asterisk.org/view.php?id=14163
151 #
152 epatch "${FILESDIR}"/1.6.2/${PN}-1.6.2.0-bt-line-test.patch || die "patch failed"
153
154 #
155 # sprinkle some plus signs in strategic locations for maximum parallel make happiness
156 # https://issues.asterisk.org/view.php?id=16489
157 #
158 epatch "${FILESDIR}"/1.6.2/${PN}-1.6.2.2-parallel-make.patch || die "patch failed"
159
160 #
161 # do not segfault when asked to restart gracefully
162 # https://issues.asterisk.org/view.php?id=16062
163 # https://issues.asterisk.org/view.php?id=16470
164 #
165 epatch "${FILESDIR}"/1.6.2/${PN}-1.6.2.2-graceful-restart-segfault.patch
166
167 #
168 # add special playback with fax detection
169 # Code by NewMan telecom, patch scavenged
170 # by Cory Coager
171 # http://bugs.gentoo.org/show_bug.cgi?id=298328
172 #
173 epatch "${FILESDIR}"/1.6.2/${PN}-1.6.2.2-nv-faxdetect.patch
174
175 AT_M4DIR=autoconf eautoreconf
176
177 # parse modules list
178 if [[ -n "${ASTERISK_MODULES}" ]]; then
179 local x modules="$(get_available_modules)"
180
181 einfo "Custom list of modules specified, checking..."
182
183 use debug && {
184 einfo "Available modules: ${modules}"
185 einfo " Selected modules: ${ASTERISK_MODULES}"
186 }
187
188 for x in ${ASTERISK_MODULES}; do
189 if [[ "${x}" = "-*" ]]; then
190 MODULES_LIST=""
191 else
192 if has ${x} ${modules}
193 then
194 MODULES_LIST="${MODULES_LIST} ${x}"
195 else
196 eerror "Unknown module: ${x}"
197 fi
198 fi
199 done
200
201 export MODULES_LIST
202 fi
203 }
204
205 src_compile() {
206 #
207 # start with configure
208 #
209 econf \
210 --libdir="/usr/$(get_libdir)" \
211 --localstatedir="/var" \
212 --with-gsm=internal \
213 --with-popt \
214 --with-z \
215 $(use_with alsa asound) \
216 $(use_with caps cap) \
217 $(use_with curl) \
218 $(use_with dahdi pri) \
219 $(use_with dahdi tonezone) \
220 $(use_with dahdi) \
221 $(use_with freetds tds) \
222 $(use_with iconv) \
223 $(use_with jabber iksemel) \
224 $(use_with misdn isdnnet) \
225 $(use_with misdn suppserv) \
226 $(use_with misdn) \
227 $(use_with newt) \
228 $(use_with oss) \
229 $(use_with postgres) \
230 $(use_with radius) \
231 $(use_with snmp netsnmp) \
232 $(use_with span spandsp) \
233 $(use_with speex) \
234 $(use_with speex speexdsp) \
235 $(use_with sqlite sqlite3) \
236 $(use_with ssl crypto) \
237 $(use_with ssl) \
238 $(use_with vorbis ogg) \
239 $(use_with vorbis) || die "econf failed"
240
241 #
242 # custom module filter
243 # run menuselect to evaluate the list of modules
244 # and rewrite the list afterwards
245 #
246 if [[ -n "${MODULES_LIST}" ]]
247 then
248 local mod category tmp_list failed_list
249
250 ###
251 # run menuselect
252
253 emake menuselect.makeopts || die "emake menuselect.makeopts failed"
254
255 ###
256 # get list of modules with failed dependencies
257
258 failed_list="$(awk -F= '/^MENUSELECT_DEPSFAILED=/{ print $3 }' menuselect.makeopts)"
259
260 ###
261 # traverse our list of modules
262
263 for category in app cdr codec format func pbx res; do
264 tmp_list=""
265
266 # search list of modules for matching ones first...
267 for mod in ${MODULES_LIST}; do
268 # module is from current category?
269 if [[ "${mod/%_*}" = "${category}" ]]
270 then
271 # check menuselect thinks the dependencies are met
272 if has ${mod} ${failed_list}
273 then
274 eerror "${mod}: dependencies required to build this module are not met, NOT BUILDING!"
275 else
276 tmp_list="${tmp_list} ${mod}"
277 fi
278 fi
279 done
280
281 use debug && echo "${category} tmp: ${tmp_list}"
282
283 # replace the module list for $category with our custom one
284 if [[ -n "${tmp_list}" ]]
285 then
286 category="$(echo ${category} | tr '[:lower:]' '[:upper:]')"
287 sed -i -e "s:^\(MENUSELECT_${category}S?\):\1=${tmp_list}:" \
288 menuselect.makeopts || die "failed to set list of ${category} applications"
289 fi
290 done
291 fi
292
293 ASTLDFLAGS="${LDFLAGS}" emake || die "emake failed"
294 }
295
296 src_install() {
297 # setup directory structure
298 #
299 mkdir -p "${D}"usr/lib/pkgconfig
300
301 emake DESTDIR="${D}" install || die "emake install failed"
302 emake DESTDIR="${D}" samples || die "emake samples failed"
303
304 # remove installed sample files if nosamples flag is set
305 if use nosamples; then
306 einfo "Skipping installation of sample files..."
307 rm -f "${D}"var/lib/asterisk/mohmp3/*
308 rm -f "${D}"var/lib/asterisk/sounds/demo-*
309 rm -f "${D}"var/lib/asterisk/agi-bin/*
310 else
311 einfo "Sample files have been installed"
312 fi
313 rm -rf "${D}"var/spool/asterisk/voicemail/default
314
315 einfo "Configuration samples have been moved to: "${ROOT}"/usr/share/doc/${PF}/conf"
316 insinto /usr/share/doc/${PF}/conf
317 doins "${D}"etc/asterisk/*.conf*
318
319 cd "${D}"
320 for conffile in etc/asterisk/*.*
321 do
322 fowners asterisk:asterisk $conffile
323 fperms 0660 $conffile
324 done
325 cd "${S}"
326
327 # keep directories
328 diropts -m 0770 -o asterisk -g asterisk
329 keepdir /etc/asterisk
330 keepdir /var/lib/asterisk
331 keepdir /var/run/asterisk
332 keepdir /var/spool/asterisk
333 keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail}
334 diropts -m 0750 -o asterisk -g asterisk
335 keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
336
337 newinitd "${FILESDIR}"/1.6.1/asterisk.initd3 asterisk
338 newconfd "${FILESDIR}"/1.6.0/asterisk.confd asterisk
339
340 # some people like to keep the sources around for custom patching
341 # copy the whole source tree to /usr/src/asterisk-${PVF} and run make clean there
342 if use keepsrc
343 then
344 dodir /usr/src
345
346 ebegin "Copying sources into /usr/src"
347 cp -dPR "${S}" "${D}"/usr/src/${PF} || die "Unable to copy sources"
348 eend $?
349
350 ebegin "Cleaning source tree"
351 emake -C "${D}"/usr/src/${PF} clean &>/dev/null || die "Unable to clean sources"
352 eend $?
353
354 einfo "Clean sources are available in "${ROOT}"usr/src/${PF}"
355 fi
356
357 # install the upgrade documentation
358 #
359 dodoc README UPGRADE* BUGS CREDITS
360
361 # install snmp mib files
362 #
363 if use snmp
364 then
365 insinto /usr/share/snmp/mibs/
366 doins doc/digium-mib.txt doc/asterisk-mib.txt
367 fi
368 }
369
370 pkg_preinst() {
371 enewgroup asterisk
372 enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
373 }
374
375 pkg_postinst() {
376 #
377 # Announcements, warnings, reminders...
378 #
379 einfo "Asterisk has been installed"
380 echo
381 elog "If you want to know more about asterisk, visit these sites:"
382 elog "http://www.asteriskdocs.org/"
383 elog "http://www.voip-info.org/wiki-Asterisk"
384 echo
385 elog "http://www.automated.it/guidetoasterisk.htm"
386 echo
387 elog "Gentoo VoIP IRC Channel:"
388 elog "#gentoo-voip @ irc.freenode.net"
389 echo
390 echo
391 elog "1.6.1 -> 1.6.2 changes that you may care about:"
392 elog "canreinvite -> directmedia (sip.conf)"
393 elog "extensive T.38 (fax) changes"
394 elog "http://svn.asterisk.org/svn/${PN}/tags/${PV}/UPGRADE.txt"
395 elog "or: bzless ${ROOT}usr/share/doc/${PF}/UPGRADE.txt.bz2"
396 }
397
398 pkg_config() {
399 einfo "Do you want to reset file permissions and ownerships (y/N)?"
400
401 read tmp
402 tmp="$(echo $tmp | tr '[:upper:]' '[:lower:]')"
403
404 if [[ "$tmp" = "y" ]] ||\
405 [[ "$tmp" = "yes" ]]
406 then
407 einfo "Resetting permissions to defaults..."
408
409 for x in spool run lib log; do
410 chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
411 chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
412 done
413
414 chown -R root:asterisk "${ROOT}"etc/asterisk
415 chmod -R u=rwX,g=rwX,o= "${ROOT}"etc/asterisk
416
417 einfo "done"
418 else
419 einfo "skipping"
420 fi
421 }
422
423
424
425 1.1 net-misc/asterisk/asterisk-1.6.1.17.ebuild
426
427 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/asterisk-1.6.1.17.ebuild?rev=1.1&view=markup
428 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/asterisk/asterisk-1.6.1.17.ebuild?rev=1.1&content-type=text/plain
429
430 Index: asterisk-1.6.1.17.ebuild
431 ===================================================================
432 # Copyright 1999-2010 Gentoo Foundation
433 # Distributed under the terms of the GNU General Public License v2
434 # $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk/asterisk-1.6.1.17.ebuild,v 1.1 2010/03/01 22:07:46 chainsaw Exp $
435
436 EAPI=1
437 inherit eutils autotools
438
439 MY_P="${PN}-${PV/_/-}"
440
441 DESCRIPTION="Asterisk: A Modular Open Source PBX System"
442 HOMEPAGE="http://www.asterisk.org/"
443 SRC_URI="http://downloads.digium.com/pub/telephony/asterisk/releases/${MY_P}.tar.gz"
444 LICENSE="GPL-2"
445 SLOT="0"
446 KEYWORDS="~amd64 ~x86"
447
448 IUSE="alsa +caps curl dahdi debug freetds iconv jabber ldap keepsrc misdn newt nosamples odbc oss postgres radius snmp span speex ssl sqlite static vorbis"
449
450 RDEPEND="sys-libs/ncurses
451 dev-libs/popt
452 sys-libs/zlib
453 alsa? ( media-libs/alsa-lib )
454 caps? ( sys-libs/libcap )
455 curl? ( net-misc/curl )
456 dahdi? ( >=net-libs/libpri-1.4.7
457 net-misc/dahdi-tools )
458 freetds? ( dev-db/freetds )
459 iconv? ( virtual/libiconv )
460 jabber? ( dev-libs/iksemel )
461 ldap? ( net-nds/openldap )
462 misdn? ( net-dialup/misdnuser )
463 newt? ( dev-libs/newt )
464 odbc? ( dev-db/unixODBC )
465 postgres? ( virtual/postgresql-base )
466 radius? ( net-dialup/radiusclient-ng )
467 snmp? ( net-analyzer/net-snmp )
468 span? ( media-libs/spandsp )
469 speex? ( media-libs/speex )
470 sqlite? ( dev-db/sqlite )
471 ssl? ( dev-libs/openssl )
472 vorbis? ( media-libs/libvorbis )"
473
474 DEPEND="${RDEPEND}
475 !<net-misc/asterisk-addons-1.6
476 !net-misc/asterisk-chan_unistim
477 !net-misc/zaptel"
478
479 S="${WORKDIR}/${MY_P}"
480
481 #
482 # shortcuts
483 #
484
485 # update from asterisk-1.0.x
486 is_ast10update() {
487 return $(has_version "=net-misc/asterisk-1.0*")
488 }
489
490 # update from asterisk-1.2.x
491 is_ast12update() {
492 return $(has_version "=net-misc/asterisk-1.2*")
493 }
494
495 # update from asterisk 1.4.x
496 is_ast14update() {
497 return $(has_version "=net-misc/asterisk-1.4*")
498 }
499
500 # update in the asterisk-1.6.x line
501 is_astupdate() {
502 if ! is_ast10update && ! is_ast12update && !is_ast14update; then
503 return $(has_version "<net-misc/asterisk-${PV}")
504 fi
505 return 0
506 }
507
508 get_available_modules() {
509 local modules mod x
510
511 # build list of available modules...
512 for x in app cdr codec format func pbx res; do
513
514 for mod in $(find "${S}" -type f -name "${x}_*.c*" -print)
515 do
516 modules="${modules} $(basename ${mod/%.c*})"
517 done
518 done
519
520 echo "${modules}"
521 }
522
523 pkg_setup() {
524 local checkfailed=0 waitaftermsg=0
525
526 if is_ast12update ; then
527 ewarn "Please note that the configuration style (particularly the dial plan) has changed significantly."
528 ewarn "sip.conf: insecure=very -> insecure=port,invite"
529 ewarn "asterisk.conf: please familiarise yourself with [compat]"
530 ewarn "extensions.conf: use comma instead of pipe as a separator"
531 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 after the installation!"
532 echo
533 waitaftermsg=1
534 fi
535
536 if [[ $waitaftermsg -eq 1 ]]; then
537 einfo "Press Ctrl+C to abort"
538 echo
539 ebeep 10
540 fi
541
542 #
543 # Regular checks
544 #
545 einfo "Running some pre-flight checks..."
546 echo
547
548 if [[ -n "${ASTERISK_MODULES}" ]] ; then
549 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."
550 fi
551 }
552
553 src_unpack() {
554 unpack ${A}
555 cd "${S}"
556
557 #
558 # put pid file(s) into /var/run/asterisk
559 #
560 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-var_rundir.patch || die "patch failed"
561
562 #
563 # fix gsm codec cflags (e.g. i586 core epias) and disable
564 # assembler optimizations
565 #
566 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-gsm-pic.patch || die "patch failed"
567
568 #
569 # add missing LIBS for uclibc
570 #
571 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-uclibc.patch || die "patch failed"
572
573 #
574 # make sure FXO ports are usable immediately, without requiring an inbound call first
575 # https://issues.asterisk.org/view.php?id=14577
576 #
577 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-fxsks-hookstate.patch || die "patch failed"
578
579 #
580 # do not ignore alarm-cleared event while V23 caller ID detection is in progress
581 # otherwise automated British Telecom line test causes permanent red alarm
582 # https://issues.asterisk.org/view.php?id=14163
583 #
584 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-bt-line-test.patch || die "patch failed"
585
586 #
587 # sprinkle some plus signs in strategic locations for maximum parallel make happiness
588 # https://issues.asterisk.org/view.php?id=16489
589 #
590 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.14-parallel-make.patch || die "patch failed"
591
592 #
593 # do not segfault when asked to restart gracefully
594 # https://issues.asterisk.org/view.php?id=16062
595 # https://issues.asterisk.org/view.php?id=16470
596 #
597 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.14-graceful-restart-segfault.patch
598
599 #
600 # add special playback with fax detection
601 # Code by NewMan telecom, patch scavenged
602 # by Cory Coager
603 # http://bugs.gentoo.org/show_bug.cgi?id=298328
604 #
605 epatch "${FILESDIR}"/1.6.2/${PN}-1.6.2.2-nv-faxdetect.patch
606
607 AT_M4DIR=autoconf eautoreconf
608
609 # parse modules list
610 if [[ -n "${ASTERISK_MODULES}" ]]; then
611 local x modules="$(get_available_modules)"
612
613 einfo "Custom list of modules specified, checking..."
614
615 use debug && {
616 einfo "Available modules: ${modules}"
617 einfo " Selected modules: ${ASTERISK_MODULES}"
618 }
619
620 for x in ${ASTERISK_MODULES}; do
621 if [[ "${x}" = "-*" ]]; then
622 MODULES_LIST=""
623 else
624 if has ${x} ${modules}
625 then
626 MODULES_LIST="${MODULES_LIST} ${x}"
627 else
628 eerror "Unknown module: ${x}"
629 fi
630 fi
631 done
632
633 export MODULES_LIST
634 fi
635 }
636
637 src_compile() {
638 #
639 # start with configure
640 #
641 econf \
642 --libdir="/usr/$(get_libdir)" \
643 --localstatedir="/var" \
644 --with-gsm=internal \
645 --with-popt \
646 --with-z \
647 $(use_with alsa asound) \
648 $(use_with caps cap) \
649 $(use_with curl) \
650 $(use_with dahdi pri) \
651 $(use_with dahdi tonezone) \
652 $(use_with dahdi) \
653 $(use_with freetds tds) \
654 $(use_with iconv) \
655 $(use_with jabber iksemel) \
656 $(use_with misdn isdnnet) \
657 $(use_with misdn suppserv) \
658 $(use_with misdn) \
659 $(use_with newt) \
660 $(use_with odbc) \
661 $(use_with oss) \
662 $(use_with postgres) \
663 $(use_with radius) \
664 $(use_with snmp netsnmp) \
665 $(use_with span spandsp) \
666 $(use_with speex) \
667 $(use_with speex speexdsp) \
668 $(use_with sqlite sqlite3) \
669 $(use_with ssl crypto) \
670 $(use_with ssl) \
671 $(use_with vorbis ogg) \
672 $(use_with vorbis) || die "econf failed"
673
674 #
675 # custom module filter
676 # run menuselect to evaluate the list of modules
677 # and rewrite the list afterwards
678 #
679 if [[ -n "${MODULES_LIST}" ]]
680 then
681 local mod category tmp_list failed_list
682
683 ###
684 # run menuselect
685
686 emake menuselect.makeopts || die "emake menuselect.makeopts failed"
687
688 ###
689 # get list of modules with failed dependencies
690
691 failed_list="$(awk -F= '/^MENUSELECT_DEPSFAILED=/{ print $3 }' menuselect.makeopts)"
692
693 ###
694 # traverse our list of modules
695
696 for category in app cdr codec format func pbx res; do
697 tmp_list=""
698
699 # search list of modules for matching ones first...
700 for mod in ${MODULES_LIST}; do
701 # module is from current category?
702 if [[ "${mod/%_*}" = "${category}" ]]
703 then
704 # check menuselect thinks the dependencies are met
705 if has ${mod} ${failed_list}
706 then
707 eerror "${mod}: dependencies required to build this module are not met, NOT BUILDING!"
708 else
709 tmp_list="${tmp_list} ${mod}"
710 fi
711 fi
712 done
713
714 use debug && echo "${category} tmp: ${tmp_list}"
715
716 # replace the module list for $category with our custom one
717 if [[ -n "${tmp_list}" ]]
718 then
719 category="$(echo ${category} | tr '[:lower:]' '[:upper:]')"
720 sed -i -e "s:^\(MENUSELECT_${category}S?\):\1=${tmp_list}:" \
721 menuselect.makeopts || die "failed to set list of ${category} applications"
722 fi
723 done
724 fi
725
726 ASTLDFLAGS="${LDFLAGS}" emake || die "emake failed"
727 }
728
729 src_install() {
730 # setup directory structure
731 #
732 mkdir -p "${D}"usr/lib/pkgconfig
733
734 emake DESTDIR="${D}" install || die "emake install failed"
735 emake DESTDIR="${D}" samples || die "emake samples failed"
736
737 # remove installed sample files if nosamples flag is set
738 if use nosamples; then
739 einfo "Skipping installation of sample files..."
740 rm -f "${D}"var/lib/asterisk/mohmp3/*
741 rm -f "${D}"var/lib/asterisk/sounds/demo-*
742 rm -f "${D}"var/lib/asterisk/agi-bin/*
743 else
744 einfo "Sample files have been installed"
745 fi
746 rm -rf "${D}"var/spool/asterisk/voicemail/default
747
748 # move sample configuration files to doc directory
749 if is_ast10update || is_ast12update || is_ast14update; then
750 einfo "Updating from old (pre-1.6) asterisk version, new configuration files have been installed"
751 einfo "into "${ROOT}"etc/asterisk, use etc-update or dispatch-conf to update them"
752 fi
753
754 einfo "Configuration samples have been moved to: "${ROOT}"/usr/share/doc/${PF}/conf"
755 insinto /usr/share/doc/${PF}/conf
756 doins "${D}"etc/asterisk/*.conf*
757
758 cd "${D}"
759 for conffile in etc/asterisk/*.*
760 do
761 fowners asterisk:asterisk $conffile
762 fperms 0660 $conffile
763 done
764 cd "${S}"
765
766 # keep directories
767 diropts -m 0770 -o asterisk -g asterisk
768 keepdir /etc/asterisk
769 keepdir /var/lib/asterisk
770 keepdir /var/run/asterisk
771 keepdir /var/spool/asterisk
772 keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail}
773 diropts -m 0750 -o asterisk -g asterisk
774 keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
775
776 newinitd "${FILESDIR}"/1.6.1/asterisk.initd3 asterisk
777 newconfd "${FILESDIR}"/1.6.0/asterisk.confd asterisk
778
779 # some people like to keep the sources around for custom patching
780 # copy the whole source tree to /usr/src/asterisk-${PVF} and run make clean there
781 if use keepsrc
782 then
783 einfo "keepsrc useflag enabled, copying source..."
784 dodir /usr/src
785
786 cp -dPR "${S}" "${D}"/usr/src/${PF} || die "copying source tree failed"
787
788 ebegin "running make clean..."
789 emake -C "${D}"/usr/src/${PF} clean >/dev/null || die "make clean failed"
790 eend $?
791
792 einfo "Source files have been saved to "${ROOT}"usr/src/${PF}"
793 fi
794
795 # install the upgrade documentation
796 #
797 dodoc README UPGRADE* BUGS CREDITS
798
799 # install snmp mib files
800 #
801 if use snmp
802 then
803 insinto /usr/share/snmp/mibs/
804 doins doc/digium-mib.txt doc/asterisk-mib.txt
805 fi
806 }
807
808 pkg_preinst() {
809 enewgroup asterisk
810 enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
811 }
812
813 pkg_postinst() {
814 #
815 # Announcements, warnings, reminders...
816 #
817 einfo "Asterisk has been installed"
818 echo
819 elog "If you want to know more about asterisk, visit these sites:"
820 elog "http://www.asteriskdocs.org/"
821 elog "http://www.voip-info.org/wiki-Asterisk"
822 echo
823 elog "http://www.automated.it/guidetoasterisk.htm"
824 echo
825 elog "Gentoo VoIP IRC Channel:"
826 elog "#gentoo-voip @ irc.freenode.net"
827 echo
828 echo
829
830 #
831 # Warning about 1.x -> 1.6 changes...
832 #
833 if is_ast10update || is_ast12update || is_ast14update; then
834 ewarn ""
835 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 before continuing"
836 ewarn ""
837 fi
838 }
839
840 pkg_config() {
841 einfo "Do you want to reset file permissions and ownerships (y/N)?"
842
843 read tmp
844 tmp="$(echo $tmp | tr '[:upper:]' '[:lower:]')"
845
846 if [[ "$tmp" = "y" ]] ||\
847 [[ "$tmp" = "yes" ]]
848 then
849 einfo "Resetting permissions to defaults..."
850
851 for x in spool run lib log; do
852 chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
853 chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
854 done
855
856 chown -R root:asterisk "${ROOT}"etc/asterisk
857 chmod -R u=rwX,g=rwX,o= "${ROOT}"etc/asterisk
858
859 einfo "done"
860 else
861 einfo "skipping"
862 fi
863 }