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

Contents of /net-misc/asterisk/asterisk-1.2.33-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Sep 4 13:06:59 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). Set missing define for the LPC10 codec so prototypes are compiled in. Removed non-stable vulnerable 1.2 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.2.33-r1.ebuild,v 1.1 2009/08/04 17:29:04 chainsaw Exp $
4
5 EAPI=2
6 inherit eutils multilib toolchain-funcs
7
8 IUSE="alsa curl debug doc gtk h323 hardened lowmem mmx nosamples \
9 odbc osp postgres pri sqlite ssl speex zaptel elibc_uclibc"
10
11 AST_PATCHES="1.2.27-patches-1.0"
12
13 MY_P="${P/_p/.}"
14
15 DESCRIPTION="Asterisk: A Modular Open Source PBX System"
16 HOMEPAGE="http://www.asterisk.org/"
17 SRC_URI="http://downloads.digium.com/pub/asterisk/releases/${MY_P}.tar.gz
18 mirror://gentoo/${PN}-${AST_PATCHES}.tar.bz2"
19
20 S="${WORKDIR}/${MY_P}"
21
22 SLOT="0"
23 LICENSE="GPL-2"
24 KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"
25
26 RDEPEND="dev-libs/newt
27 media-sound/sox
28 ssl? ( dev-libs/openssl )
29 gtk? ( =x11-libs/gtk+-1.2* )
30 pri? ( >=net-libs/libpri-1.2.5[-bri] )
31 h323? ( >=dev-libs/pwlib-1.8.3
32 >=net-libs/openh323-1.15.0 )
33 alsa? ( media-libs/alsa-lib )
34 curl? ( net-misc/curl )
35 odbc? ( dev-db/unixODBC )
36 speex? ( media-libs/speex )
37 sqlite? ( <dev-db/sqlite-3.0.0 )
38 zaptel? ( >=net-misc/zaptel-1.2.16 )
39 postgres? ( virtual/postgresql-base )
40 osp? ( >=net-libs/osptoolkit-3.3.4 )"
41
42 DEPEND="${RDEPEND}
43 sys-devel/flex
44 sys-devel/bison
45 doc? ( app-doc/doxygen )
46 virtual/logger"
47
48 #asterisk uses special mpg123 functions and does not work with mpeg321, bug #42703
49 PDEPEND="|| ( media-sound/mpg123 net-misc/asterisk-addons )"
50
51 QA_TEXTRELS_x86="usr/lib/asterisk/modules/codec_gsm.so"
52 QA_EXECSTACK_x86="usr/lib/asterisk/modules/codec_gsm.so"
53
54 #
55 # List of modules to ignore during scan (because they have been removed in 1.2.x)
56 #
57 SCAN_IGNORE_MODS="
58 app_qcall
59 chan_modem
60 chan_modem_i4l
61 chan_modem_bestdata
62 chan_modme_aopen"
63
64 #
65 # shortcuts
66 #
67 is_ast10update() {
68 return $(has_version "=net-misc/asterisk-1.0*")
69 }
70
71 is_astupdate() {
72 if ! is_ast10update; then
73 return $(has_version "<net-misc/asterisk-${PV}")
74 fi
75 return 0
76 }
77
78 #
79 # Scan for asterisk-1.0.x modules that will have to be updated
80 #
81 scan_modules() {
82 local modules_list=""
83 local n
84
85 for x in $(ls -1 "${ROOT}"usr/$(get_libdir)/asterisk/modules/*.so); do
86 echo -en "Scanning.... $(basename ${x}) \r"
87
88 # skip blacklisted modules
89 hasq $(basename ${x//.so}) ${SCAN_IGNORE_MODS} && continue
90
91 if $(readelf -s "${x}" | grep -q "\(ast_load\|ast_destroy\)$"); then
92 modules_list="${modules_list} $(basename ${x//.so})"
93 fi
94 done
95
96 if [[ -n "${modules_list}" ]]; then
97 echo " ========================================================"
98 ewarn "Please update or unmerge the following modules:"
99 echo
100
101 n=0
102 for x in ${modules_list}; do
103 ewarn " - ${x}"
104 (( n++ ))
105 done
106
107 echo
108 ewarn "Warning: $n outdated module(s) found!"
109 ewarn "Warning: asterisk may not work if you don't update them!"
110 echo " ========================================================"
111 echo
112 einfo "You can use the \"asterisk-updater\" script to update the modules"
113 epause
114 echo
115 return 1
116 else
117 einfo "No asterisk-1.0.x modules found!"
118 return 0
119 fi
120 }
121
122 pkg_setup() {
123 local checkfailed=0 waitaftermsg=0
124
125 if is_ast10update; then
126 ewarn " Asterisk UPGRADE Warning"
127 ewarn ""
128 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.gz after the installation!"
129 ewarn ""
130 ewarn " Asterisk UPGRADE Warning"
131 echo
132 waitaftermsg=1
133 fi
134
135 #
136 # Regular checks
137 #
138 einfo "Running some pre-flight checks..."
139 echo
140
141 }
142
143 src_prepare() {
144 #
145 # gentoo patchset
146 #
147 for x in $(grep -v "^#\| \+" "${WORKDIR}"/patches/patches.list); do
148 epatch "${WORKDIR}"/patches/${x}
149 done
150
151 if use mmx; then
152 if ! use hardened; then
153 einfo "Enabling mmx optimization"
154 sed -i -e "s:^#\(K6OPT[\t ]\+= -DK6OPT\):\1:" \
155 Makefile
156 else
157 ewarn "Hardened use-flag is set, not enabling mmx optimization for codec_gsm!"
158 fi
159 fi
160
161 if ! use debug; then
162 einfo "Disabling debug support"
163 sed -i -e "s:^\(DEBUG=\):#\1:" \
164 Makefile
165 fi
166
167 if ! use ssl; then
168 einfo "Disabling crypto support"
169 sed -i -e 's:^#\(NOCRYPTO=yes\):\1:' \
170 -e '/^LIBS+=-lssl/d' Makefile || die
171 fi
172
173 epatch "${FILESDIR}/1.2.0/${PN}-1.2.21.1-h323-dumb-makefile.diff"
174
175 #
176 # uclibc patch
177 #
178 if use elibc_uclibc; then
179 einfo "Patching asterisk for uclibc..."
180 epatch "${FILESDIR}"/1.0.0/${PN}-1.0.5-uclibc-dns.diff
181 epatch "${FILESDIR}"/1.2.0/${PN}-1.2.1-uclibc-getloadavg.diff
182 fi
183
184 #
185 # Disable AEL, security bug #171884
186 # Re-enable at your own risk (no USE since it can be critical)
187 #
188 sed -i -e 's/pbx_ael.so//' pbx/Makefile || die
189
190 # codecs/Makefile does not add -lspeexdsp needed for speex 1.2, bug #206463
191 if use speex && has_version ">=media-libs/speex-1.2"; then
192 sed -i -e "s/-lspeex/-lspeex -lspeexdsp/" codecs/Makefile \
193 || die "patching codecs/Makefile failed"
194 fi
195 }
196
197 src_compile() {
198 local myopts
199
200 use lowmem && \
201 myopts="-DLOW_MEMORY"
202
203 if use h323; then
204 einfo "Building H.323 wrapper lib..."
205 make -C channels/h323 \
206 NOTRACE=1 \
207 PWLIBDIR=/usr/share/pwlib \
208 OPENH323DIR=/usr/share/openh323 \
209 libchanh323.a Makefile.ast || die "Make h323 failed"
210 fi
211
212 einfo "Building Asterisk..."
213 if use debug; then
214 unset CFLAGS
215 make \
216 CC=$(tc-getCC) \
217 NOTRACE=1 \
218 PWLIBDIR=/usr/share/pwlib \
219 OPENH323DIR=/usr/share/openh323 \
220 OPTIONS="${myopts}" \
221 dont-optimize=1 || die "Make failed"
222 else
223 make \
224 CC=$(tc-getCC) \
225 NOTRACE=1 \
226 OPTIMIZE="${CFLAGS}" \
227 PWLIBDIR=/usr/share/pwlib \
228 OPENH323DIR=/usr/share/openh323 \
229 OPTIONS="${myopts}" || die "Make failed"
230 fi
231
232 # create api docs
233 use doc && \
234 make progdocs
235 }
236
237 src_install() {
238
239 # install asterisk
240 make DESTDIR="${D}" ASTLIBDIR="\$(INSTALL_PREFIX)/usr/$(get_libdir)/asterisk" install || die "Make install failed"
241 make DESTDIR="${D}" ASTLIBDIR="\$(INSTALL_PREFIX)/usr/$(get_libdir)/asterisk" samples || die "Failed to create sample files"
242
243 # remove installed sample files if nosamples flag is set
244 if use nosamples; then
245 einfo "Skipping installation of sample files..."
246 rm -rf "${D}"var/spool/asterisk/voicemail/default
247 rm -f "${D}"var/lib/asterisk/mohmp3/*
248 rm -f "${D}"var/lib/asterisk/sounds/demo-*
249 rm -f "${D}"var/lib/asterisk/agi-bin/*
250 else
251 einfo "Sample files have been installed"
252 keepdir /var/spool/asterisk/voicemail/default/1234/INBOX
253 fi
254
255 # move sample configuration files to doc directory
256 if is_ast10update; then
257 elog "Updating from old (pre-1.2) asterisk version, new configuration files have been installed"
258 elog "into "${ROOT}"etc/asterisk, use etc-update or dispatch-conf to update them"
259 elif has_version "net-misc/asterisk"; then
260 elog "Configuration samples have been moved to: $ROOT/usr/share/doc/${PF}/conf"
261 insinto /usr/share/doc/${PF}/conf
262 doins "${D}"etc/asterisk/*.conf*
263 rm -f "${D}"etc/asterisk/*.conf* 2>/dev/null
264 fi
265
266 # don't delete these directories, even if they are empty
267 for x in voicemail meetme system dictate monitor tmp; do
268 keepdir /var/spool/asterisk/${x}
269 done
270 keepdir /var/lib/asterisk/sounds/priv-callerintros
271 keepdir /var/lib/asterisk/mohmp3
272 keepdir /var/lib/asterisk/agi-bin
273 keepdir /var/log/asterisk/cdr-csv
274 keepdir /var/log/asterisk/cdr-custom
275 keepdir /var/run/asterisk
276
277 # install astxs
278 dobin contrib/scripts/astxs
279
280 newinitd "${FILESDIR}"/1.2.0/asterisk.rc6 asterisk
281 newconfd "${FILESDIR}"/1.2.0/asterisk.confd asterisk
282
283 # install standard docs...
284 dodoc BUGS CREDITS ChangeLog HARDWARE README README.fpm
285 dodoc SECURITY doc/CODING-GUIDELINES doc/linkedlists.README UPGRADE.txt
286 dodoc doc/README.*
287 dodoc doc/*.txt
288
289 docinto scripts
290 dodoc contrib/scripts/*
291
292 docinto utils
293 dodoc contrib/utils/*
294
295 docinto configs
296 dodoc configs/*
297
298 # install api docs
299 if use doc; then
300 insinto /usr/share/doc/${PF}/api/html
301 doins doc/api/html/*
302 fi
303
304 insinto /usr/share/doc/${PF}/cgi
305 doins contrib/scripts/vmail.cgi
306 doins images/*.gif
307
308 # install asterisk-updater
309 dosbin "${FILESDIR}"/1.2.0/asterisk-updater
310
311 # install asterisk.h, a lot of external modules need this
312 insinto /usr/include/asterisk
313 doins include/asterisk.h
314
315 # make sure misdn/capi stuff is not installed, provided by asterisk-chan_..
316 rm -f "${D}"/etc/asterisk/misdn.conf "${D}"/usr/lib/asterisk/modules/chan_misdn.so \
317 "${D}"/usr/share/doc/${PF}/{conf/misdn.conf,configs/misdn.conf.sample.gz,README.misdn.gz}
318 rm -f "${D}"/usr/include/asterisk/chan_capi{,_app}.h \
319 "${D}"/usr/share/doc/${PF}/{conf/capi.conf,configs/capi.conf.sample.gz}
320
321 # make sure the broken speex support does not keep Asterisk from starting up
322 # bug #206463 if you care about this. solution needs to work with --as-needed
323 rm -f "${D}"usr/$(get_libdir)/asterisk/modules/codec_speex.so || die "Unable to remove fatally flawed codec_speex.so"
324 }
325
326 pkg_preinst() {
327 enewgroup asterisk
328 enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
329 }
330
331 pkg_postinst() {
332 einfo "Fixing permissions"
333 chown -R asterisk:asterisk "${ROOT}"var/log/asterisk
334 chmod -R u=rwX,g=rX,o= "${ROOT}"var/log/asterisk
335
336 for x in lib run spool; do
337 chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
338 chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
339 done
340
341 chown asterisk:asterisk "${ROOT}"etc/asterisk/
342 chown asterisk:asterisk "${ROOT}"etc/asterisk/*.adsi
343 chown asterisk:asterisk "${ROOT}"etc/asterisk/extensions.ael
344 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/
345 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/*.adsi
346 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/extensions.ael
347 echo
348
349 #
350 # Announcements, warnings, reminders...
351 #
352 einfo "Asterisk has been installed"
353 einfo ""
354 elog "If you want to know more about asterisk, visit these sites:"
355 elog "http://www.asteriskdocs.org/"
356 elog "http://www.voip-info.org/wiki-Asterisk"
357 elog
358 elog "http://www.automated.it/guidetoasterisk.htm"
359 elog
360 elog "Gentoo VoIP IRC Channel:"
361 elog "#gentoo-voip @ irc.freenode.net"
362 elog
363 elog "Please note that AEL is no longer built because of security bugs"
364 elog "See http://bugs.gentoo.org/show_bug.cgi?id=171884"
365 elog
366 echo
367 echo
368
369 #
370 # Warning about 1.0 -> 1.2 changes...
371 #
372 if is_ast10update; then
373 ewarn ""
374 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.gz before continuing"
375 ewarn ""
376 fi
377
378 if is_astupdate; then
379 ewarn ""
380 ewarn " - The initgroups patch has been dropped, please update your"
381 ewarn " \"conf.d/asterisk\" and \"init.d/asterisk\" file!"
382 ewarn ""
383 fi
384
385 # scan for old modules
386 if is_ast10update; then
387 einfo "Asterisk has been updated from pre-1.2.x, scanning for old modules"
388 scan_modules
389 fi
390 }
391
392 pkg_config() {
393 einfo "Do you want to reset file permissions and ownerships (y/N)?"
394
395 read tmp
396 tmp="$(echo $tmp | tr [:upper:] [:lower:])"
397
398 if [[ "$tmp" = "y" ]] ||\
399 [[ "$tmp" = "yes" ]]
400 then
401 einfo "Resetting permissions to defaults..."
402
403 for x in spool run lib log; do
404 chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
405 chmod -R u=rwX,g=rX,o= "${ROOT}"var/${x}/asterisk
406 done
407
408 chown -R root:asterisk "${ROOT}"etc/asterisk
409 chmod -R u=rwX,g=rX,o= "${ROOT}"etc/asterisk
410
411 einfo "done"
412 else
413 einfo "skipping"
414 fi
415 }

  ViewVC Help
Powered by ViewVC 1.1.20