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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20