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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Wed Feb 25 23:17:19 2009 UTC (10 years, 9 months ago) by rajiv
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
remove old asterisk ebuilds.
(Portage version: 2.1.6.7/cvs/Linux i686)

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

  ViewVC Help
Powered by ViewVC 1.1.20