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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (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.3: +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.1.ebuild,v 1.3 2006/01/23 15:12:58 stkn Exp $
4
5 inherit eutils
6
7 IUSE="alsa bri curl debug doc gtk h323 hardened lowmem mmx mysql \
8 nosamples odbc postgres pri speex sqlite ssl ukcid zaptel"
9
10 BRI_VERSION="0.3.0-PRE-1c"
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
30 RESTRICT="nomirror"
31
32 S="${WORKDIR}/${MY_P}"
33
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.1.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.1.0 )
55 postgres? ( dev-db/postgresql )
56 bri? ( >=net-libs/libpri-1.1.0
57 >=net-misc/zaptel-1.1.0 )"
58
59 # osp? ( >=net-libs/osptoolkit-3.3.4 )
60
61 DEPEND="${RDEPEND}
62 sys-devel/flex
63 sys-devel/bison
64 doc? ( app-doc/doxygen )"
65
66 pkg_setup() {
67 ewarn " Asterisk UPGRADE Warning"
68 ewarn ""
69 ewarn "!!! Read ${ROOT}usr/share/doc/${PF}/UPGRADE.txt.gz after installation !!!"
70 ewarn ""
71 ewarn " Asterisk UPGRADE Warning"
72 echo
73 einfo "Press Ctrl+C to abort"
74 echo
75 ebeep
76
77 n=10
78 while [[ $n -gt 0 ]]; do
79 echo -en " Waiting $n seconds...\r"
80 sleep 1
81 (( n-- ))
82 done
83
84 #
85 # Regular checks
86 #
87 einfo "Running some pre-flight checks..."
88
89 # check if zaptel and libpri have been built with bri enabled
90 if use bri; then
91 if ! built_with_use net-misc/zaptel bri; then
92 eerror "Re-emerge zaptel with bri use-flag enabled!"
93 die "Zaptel without bri support detected"
94 fi
95
96 if ! built_with_use net-libs/libpri bri; then
97 eerror "Re-emerge libpri with bri use-flag enabled!"
98 die "Libpri without bri support detected"
99 fi
100 fi
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 "Gentoo VoIP IRC Channel:"
314 einfo "#gentoo-voip @ irc.freenode.net"
315 echo
316
317 #
318 # Permission and non-root warning
319 #
320 ewarn "*********************** Important information **************************"
321 ewarn
322 ewarn "- Asterisk runs as user asterisk, group asterisk by default"
323 ewarn
324 ewarn "- Make sure the asterisk user is a member of the proper groups if you want it"
325 ewarn " to have access to hardware devices, e.g. \"audio\" for Alsa and OSS sound or"
326 ewarn " \"dialout\" for zaptel!"
327 ewarn
328 ewarn "- Permissions of /etc/asterisk have been changed to root:asterisk"
329 ewarn " 750 (rwxr-x--- directories) / 640 (rw-r----- files)"
330 ewarn
331 ewarn "- Permissions of /var/{log,lib,run,spool}/asterisk have been changed"
332 ewarn " to asterisk:asterisk 750 / 640"
333 ewarn
334 ewarn "- Asterisk's unix socket and pidfile are now in /var/run/astrisk"
335 ewarn
336 ewarn "- Asterisk cannot set the IP ToS bits when run as user,"
337 ewarn " use something like this to make iptables set them for you:"
338 ewarn " \"iptables -A OUTPUT -t mangle -p udp -m udp --dport 5060 -j DSCP --set-dscp 0x28\""
339 ewarn " \"iptables -A OUTPUT -t mangle -p udp -m udp --sport 10000:20000 -j DSCP --set-dscp 0x28\""
340 ewarn " (taken from voip-info.org comments (see below), thanks andrewid)"
341 ewarn
342 ewarn "For more details:"
343 ewarn " http://bugs.gentoo.org/show_bug.cgi?id=88732"
344 ewarn " http://www.voip-info.org/wiki-Asterisk+non-root"
345 echo
346
347 #
348 # Upgrade 1.2.x warning...
349 #
350 eerror " Asterisk UPGRADE Warning"
351 eerror ""
352 eerror "!!! Read ${ROOT}usr/share/doc/${PF}/UPGRADE.txt.gz before continuing !!!"
353 eerror ""
354 eerror " Asterisk UPGRADE Warning"
355 }
356
357 pkg_config() {
358 einfo "Do you want to reset file permissions and ownerships (y/N)?"
359
360 read tmp
361 tmp="$(echo $tmp | tr [:upper:] [:lower:])"
362
363 if [[ "$tmp" = "y" ]] ||\
364 [[ "$tmp" = "yes" ]]
365 then
366 einfo "Resetting permissions to defaults..."
367
368 for x in spool run lib log; do
369 chown -R asterisk:asterisk ${ROOT}var/${x}/asterisk
370 chmod -R u=rwX,g=rX,o= ${ROOT}var/${x}/asterisk
371 done
372
373 chown -R root:asterisk ${ROOT}etc/asterisk
374 chmod -R u=rwX,g=rX,o= ${ROOT}etc/asterisk
375
376 einfo "done"
377 else
378 einfo "skipping"
379 fi
380 }

  ViewVC Help
Powered by ViewVC 1.1.20