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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Mon Apr 24 17:25:02 2006 UTC (13 years, 7 months ago) by stkn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
FILE REMOVED
Security revision bump; asterisk-1.0.x: add fix for CVS-2006-1827: Integer sigendness error in format-jpeg.c (bug #131096); dropping affected asterisk-1.2.x ebuilds.
(Portage version: 2.0.54)

1 # Copyright 1999-2006 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.4.ebuild,v 1.4 2006/03/13 21:53:22 stkn Exp $
4
5 inherit eutils
6
7 IUSE="alsa bri curl debug doc gtk h323 hardened lowmem mmx mysql \
8 nosamples odbc osp postgres pri speex sqlite ssl ukcid zaptel"
9
10 BRI_VERSION="0.3.0-PRE-1h"
11 AST_PATCHES="1.2.1-patches-1.0"
12
13 ## TODO:
14 #
15 # - uclibc patch still needed? (still applies)
16 # - test nosamples
17 # - add some more use flags...
18 # recent additions: osp, lowmem, curl, ukcid
19 # - cleanup
20
21 MY_P="${P/_/-}"
22
23 DESCRIPTION="Asterisk: A Modular Open Source PBX System"
24 HOMEPAGE="http://www.asterisk.org/"
25 SRC_URI="http://ftp.digium.com/pub/asterisk/old-releases/${MY_P}.tar.gz
26 http://www.netdomination.org/pub/asterisk/${PN}-${AST_PATCHES}.tar.bz2
27 bri? ( http://www.netdomination.org/pub/asterisk/asterisk-${PV}-bristuff-${BRI_VERSION}.diff.gz
28 http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )"
29 # bri? ( http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )"
30
31 RESTRICT="nomirror"
32
33 S="${WORKDIR}/${MY_P}"
34 S_BRI="${WORKDIR}/bristuff-${BRI_VERSION}"
35
36 SLOT="0"
37 LICENSE="GPL-2"
38 KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"
39
40 RDEPEND="dev-libs/newt
41 media-sound/sox
42 media-sound/mpg123
43 ssl? ( dev-libs/openssl )
44 gtk? ( =x11-libs/gtk+-1.2* )
45 pri? ( >=net-libs/libpri-1.2.0 )
46 h323? ( >=dev-libs/pwlib-1.8.3
47 >=net-libs/openh323-1.15.0 )
48 alsa? ( media-libs/alsa-lib )
49 curl? ( net-misc/curl )
50 odbc? ( dev-db/unixODBC )
51 mysql? ( dev-db/mysql )
52 speex? ( media-libs/speex )
53 sqlite? ( <dev-db/sqlite-3.0.0 )
54 zaptel? ( >=net-misc/zaptel-1.2.0 )
55 postgres? ( dev-db/postgresql )
56 osp? ( >=net-libs/osptoolkit-3.3.4 )
57 bri? ( >=net-libs/libpri-1.2.2
58 >=net-misc/zaptel-1.2.3 )"
59
60 DEPEND="${RDEPEND}
61 sys-devel/flex
62 sys-devel/bison
63 doc? ( app-doc/doxygen )"
64
65 pkg_setup() {
66 ewarn " Asterisk UPGRADE Warning"
67 ewarn ""
68 ewarn "!!! Read ${ROOT}usr/share/doc/${PF}/UPGRADE.txt.gz after installation !!!"
69 ewarn ""
70 ewarn " Asterisk UPGRADE Warning"
71 echo
72 einfo "Press Ctrl+C to abort"
73 echo
74 ebeep
75
76 n=10
77 while [[ $n -gt 0 ]]; do
78 echo -en " Waiting $n seconds...\r"
79 sleep 1
80 (( n-- ))
81 done
82
83 #
84 # Regular checks
85 #
86 einfo "Running some pre-flight checks..."
87
88 # check if zaptel and libpri have been built with bri enabled
89 if use bri; then
90 if ! built_with_use net-misc/zaptel bri; then
91 eerror "Re-emerge zaptel with bri use-flag enabled!"
92 die "Zaptel without bri support detected"
93 fi
94
95 if ! built_with_use net-libs/libpri bri; then
96 eerror "Re-emerge libpri with bri use-flag enabled!"
97 die "Libpri without bri support detected"
98 fi
99 fi
100
101 }
102
103 src_unpack() {
104 unpack ${A}
105 cd ${S}
106
107 #
108 # gentoo patchset
109 #
110 for x in $(grep -v "^#\| \+" ${WORKDIR}/patches/patches.list); do
111 epatch ${WORKDIR}/patches/${x}
112 done
113
114 if use mmx; then
115 if ! use hardened; then
116 einfo "Enabling mmx optimization"
117 sed -i -e "s:^#\(K6OPT[\t ]\+= -DK6OPT\):\1:" \
118 Makefile
119 else
120 ewarn "Hardened use-flag is set, not enabling mmx optimization for codec_gsm!"
121 fi
122 fi
123
124 if ! use debug; then
125 einfo "Disabling debug support"
126 sed -i -e "s:^\(DEBUG=\):#\1:" \
127 Makefile
128 fi
129
130 if ! use ssl; then
131 einfo "Disabling crypto support"
132 sed -i -e "s:^#\(NOCRYPTO=yes\):\1:" \
133 Makefile
134 fi
135
136 #
137 # uclibc patch
138 #
139 if use elibc_uclibc; then
140 einfo "Patching asterisk for uclibc..."
141 epatch ${FILESDIR}/1.0.0/${PN}-1.0.5-uclibc-dns.diff
142 epatch ${FILESDIR}/1.2.0/${PN}-1.2.1-uclibc-getloadavg.diff
143 fi
144
145 #
146 # ukcid patch from http://www.lusyn.com/asterisk/
147 #
148 if use ukcid; then
149 einfo "Patching asterisk for UK Callerid..."
150 epatch ${FILESDIR}/1.2.0/${PN}-1.2.0_beta-ukcid.patch
151 fi
152
153 #
154 # BRI patches
155 #
156 if use bri; then
157 einfo "Patching asterisk w/ BRI stuff"
158 # epatch ${S_BRI}/patches/asterisk.patch
159 epatch ${WORKDIR}/asterisk-${PV}-bristuff-${BRI_VERSION}.diff
160 fi
161 }
162
163 src_compile() {
164 local myopts
165
166 use lowmem && \
167 myopts="-DLOW_MEMORY"
168
169 if use h323; then
170 einfo "Building H.323 wrapper lib..."
171 make -C channels/h323 \
172 NOTRACE=1 \
173 PWLIBDIR=/usr/share/pwlib \
174 OPENH323DIR=/usr/share/openh323 \
175 libchanh323.a Makefile.ast || die "Make h323 failed"
176 fi
177
178 einfo "Building Asterisk..."
179 make \
180 NOTRACE=1 \
181 OPTIMIZE="${CFLAGS}" \
182 PWLIBDIR=/usr/share/pwlib \
183 OPENH323DIR=/usr/share/openh323 \
184 OPTIONS="${myopts}" || die "Make failed"
185
186 # create api docs
187 use doc && \
188 make progdocs
189
190 # build bristuff's ISDNguard
191 use bri && \
192 make -C ${S_BRI}/ISDNguard
193 }
194
195 src_install() {
196
197 # install asterisk
198 make DESTDIR=${D} install || die "Make install failed"
199 make DESTDIR=${D} samples || die "Failed to create sample files"
200
201 # remove installed sample files if nosamples flag is set
202 if use nosamples; then
203 einfo "Skipping installation of sample files..."
204 einfo "See ${ROOT}usr/share/doc/${PF}/configs for configuration files"
205 insinto /usr/share/doc/${PF}/configs
206 newins ${D}etc/asterisk/asterisk.conf asterisk.conf.sample
207
208 # skip installation of sample configuration files
209 # if asterisk-1.1.0 or later is present
210 if has_version ">net-misc/asterisk-1.1.0"
211 then
212 rm -f ${D}etc/asterisk/*
213 else
214 einfo "No previous or old (<=1.0.x) installation of ${PN} found,"
215 einfo "installing sample configuration files!"
216 fi
217 rm -rf ${D}var/spool/asterisk/voicemail/default
218 rm -f ${D}var/lib/asterisk/mohmp3/*
219 rm -f ${D}var/lib/asterisk/sounds/demo-*
220 rm -f ${D}var/lib/asterisk/agi-bin/*
221 else
222 einfo "Sample files have been installed"
223 keepdir /var/spool/asterisk/voicemail/default/1234/INBOX
224 fi
225
226 # don't delete these directories, even if they are empty
227 for x in voicemail meetme system dictate tmp; do
228 keepdir /var/spool/asterisk/${x}
229 done
230 keepdir /var/lib/asterisk/sounds/priv-callerintros
231 keepdir /var/lib/asterisk/mohmp3
232 keepdir /var/lib/asterisk/agi-bin
233 keepdir /var/log/asterisk/cdr-csv
234 keepdir /var/log/asterisk/cdr-custom
235 keepdir /var/run/asterisk
236
237 # install asterisk.h, a lot of external modules need this
238 insinto /usr/include/asterisk
239 doins include/asterisk.h
240
241 # install astgenkey, astxs, safe_asterisk and manpages
242 dobin contrib/scripts/astxs
243 dosbin contrib/scripts/astgenkey
244 dosbin contrib/scripts/safe_asterisk
245 doman contrib/scripts/safe_asterisk.8
246 doman contrib/scripts/astgenkey.8
247
248 newinitd ${FILESDIR}/1.0.0/asterisk.rc6.sec asterisk
249 newconfd ${FILESDIR}/1.0.0/asterisk.confd.sec asterisk
250
251 # install standard docs...
252 dodoc BUGS CREDITS LICENSE ChangeLog HARDWARE README README.fpm
253 dodoc SECURITY doc/CODING-GUIDELINES doc/linkedlists.README UPGRADE.txt
254 dodoc doc/README.*
255 dodoc doc/*.txt
256
257 docinto scripts
258 dodoc contrib/scripts/*
259
260 docinto utils
261 dodoc contrib/utils/*
262
263 docinto configs
264 dodoc configs/*
265
266 # install api docs
267 if use doc; then
268 insinto /usr/share/doc/${PF}/api/html
269 doins doc/api/html/*
270 fi
271
272 # install ISDNguard
273 if use bri; then
274 cd ${S_BRI}/ISDNguard
275 dosbin ISDNguard
276
277 docinto ISDNguard
278 dodoc INSTALL.ISDNguard
279
280 cd ${S}
281 fi
282
283 insinto /usr/share/doc/${PF}/cgi
284 doins contrib/scripts/vmail.cgi
285 doins images/*.gif
286 }
287
288 pkg_preinst() {
289 enewgroup asterisk
290 enewuser asterisk -1 -1 /var/lib/asterisk asterisk
291 }
292
293 pkg_postinst() {
294 einfo "Fixing permissions"
295 for x in spool run lib log; do
296 chown -R asterisk:asterisk ${ROOT}var/${x}/asterisk
297 chmod -R u=rwX,g=rX,o= ${ROOT}var/${x}/asterisk
298 done
299
300 chown -R root:asterisk ${ROOT}etc/asterisk
301 chmod -R u=rwX,g=rX,o= ${ROOT}etc/asterisk
302 echo
303
304 #
305 # Announcements, warnings, reminders...
306 #
307 einfo "Asterisk has been installed"
308 einfo ""
309 einfo "If you want to know more about asterisk, visit these sites:"
310 einfo "http://www.asteriskdocs.org/"
311 einfo "http://www.voip-info.org/wiki-Asterisk"
312 echo
313 einfo "http://asterisk.xvoip.com/"
314 einfo "http://junghanns.net/asterisk/"
315 einfo "http://www.automated.it/guidetoasterisk.htm"
316 echo
317 einfo "Gentoo VoIP IRC Channel:"
318 einfo "#gentoo-voip @ irc.freenode.net"
319 echo
320 echo
321
322 #
323 # Permission and non-root warning
324 #
325 ewarn "*********************** Important information **************************"
326 ewarn
327 ewarn "- Asterisk runs as user asterisk, group asterisk by default"
328 ewarn
329 ewarn "- Make sure the asterisk user is a member of the proper groups if you want it"
330 ewarn " to have access to hardware devices, e.g. \"audio\" for Alsa and OSS sound or"
331 ewarn " \"dialout\" for zaptel!"
332 ewarn
333 ewarn "- Permissions of /etc/asterisk have been changed to root:asterisk"
334 ewarn " 750 (rwxr-x--- directories) / 640 (rw-r----- files)"
335 ewarn
336 ewarn "- Permissions of /var/{log,lib,run,spool}/asterisk have been changed"
337 ewarn " to asterisk:asterisk 750 / 640"
338 ewarn
339 ewarn "- Asterisk's unix socket and pidfile are now in /var/run/astrisk"
340 ewarn
341 ewarn "- Asterisk cannot set the IP ToS bits when run as user,"
342 ewarn " use something like this to make iptables set them for you:"
343 ewarn " \"iptables -A OUTPUT -t mangle -p udp -m udp --dport 5060 -j DSCP --set-dscp 0x28\""
344 ewarn " \"iptables -A OUTPUT -t mangle -p udp -m udp --sport 10000:20000 -j DSCP --set-dscp 0x28\""
345 ewarn " (taken from voip-info.org comments (see below), thanks andrewid)"
346 ewarn
347 ewarn "For more details:"
348 ewarn " http://bugs.gentoo.org/show_bug.cgi?id=88732"
349 ewarn " http://www.voip-info.org/wiki-Asterisk+non-root"
350 echo
351
352 #
353 # Warning about security changes...
354 #
355 ewarn " Asterisk UPGRADE Warning"
356 ewarn ""
357 ewarn "!!! Read ${ROOT}usr/share/doc/${PF}/UPGRADE.txt.gz before continuing !!!"
358 ewarn ""
359 ewarn " Asterisk UPGRADE Warning"
360 }
361
362 pkg_config() {
363 einfo "Do you want to reset file permissions and ownerships (y/N)?"
364
365 read tmp
366 tmp="$(echo $tmp | tr [:upper:] [:lower:])"
367
368 if [[ "$tmp" = "y" ]] ||\
369 [[ "$tmp" = "yes" ]]
370 then
371 einfo "Resetting permissions to defaults..."
372
373 for x in spool run lib log; do
374 chown -R asterisk:asterisk ${ROOT}var/${x}/asterisk
375 chmod -R u=rwX,g=rX,o= ${ROOT}var/${x}/asterisk
376 done
377
378 chown -R root:asterisk ${ROOT}etc/asterisk
379 chmod -R u=rwX,g=rX,o= ${ROOT}etc/asterisk
380
381 einfo "done"
382 else
383 einfo "skipping"
384 fi
385 }

  ViewVC Help
Powered by ViewVC 1.1.20