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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Thu Nov 5 11:21:10 2009 UTC (10 years, 1 month ago) by chainsaw
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Version bumps as requested by Alex "a3li" Legler in security bug #284892, drop any non-stable vulnerable ebuild. Upstream advisory AST-2009-008.
(Portage version: 2.2_rc48/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.6.1.8-r1.ebuild,v 1.2 2009/10/28 16:35:07 mr_bones_ Exp $
4
5 EAPI=1
6 inherit eutils autotools
7
8 MY_P="${PN}-${PV/_/-}"
9
10 DESCRIPTION="Asterisk: A Modular Open Source PBX System"
11 HOMEPAGE="http://www.asterisk.org/"
12 SRC_URI="http://downloads.digium.com/pub/asterisk/releases/${MY_P}.tar.gz"
13 LICENSE="GPL-2"
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16
17 IUSE="alsa +caps curl dahdi debug freetds iconv jabber ldap keepsrc misdn newt nosamples odbc oss postgres radius snmp span speex ssl sqlite static vorbis"
18
19 RDEPEND="sys-libs/ncurses
20 dev-libs/popt
21 sys-libs/zlib
22 alsa? ( media-libs/alsa-lib )
23 caps? ( sys-libs/libcap )
24 curl? ( net-misc/curl )
25 dahdi? ( >=net-libs/libpri-1.4.7
26 net-misc/dahdi-tools )
27 freetds? ( dev-db/freetds )
28 iconv? ( virtual/libiconv )
29 jabber? ( dev-libs/iksemel )
30 ldap? ( net-nds/openldap )
31 misdn? ( net-dialup/misdnuser )
32 newt? ( dev-libs/newt )
33 odbc? ( dev-db/unixODBC )
34 postgres? ( virtual/postgresql-base )
35 radius? ( net-dialup/radiusclient-ng )
36 snmp? ( net-analyzer/net-snmp )
37 span? ( media-libs/spandsp )
38 speex? ( media-libs/speex )
39 sqlite? ( dev-db/sqlite )
40 ssl? ( dev-libs/openssl )
41 vorbis? ( media-libs/libvorbis )"
42
43 DEPEND="${RDEPEND}
44 !<net-misc/asterisk-addons-1.6
45 !net-misc/zaptel"
46
47 S="${WORKDIR}/${MY_P}"
48
49 #
50 # shortcuts
51 #
52
53 # update from asterisk-1.0.x
54 is_ast10update() {
55 return $(has_version "=net-misc/asterisk-1.0*")
56 }
57
58 # update from asterisk-1.2.x
59 is_ast12update() {
60 return $(has_version "=net-misc/asterisk-1.2*")
61 }
62
63 # update from asterisk 1.4.x
64 is_ast14update() {
65 return $(has_version "=net-misc/asterisk-1.4*")
66 }
67
68 # update in the asterisk-1.6.x line
69 is_astupdate() {
70 if ! is_ast10update && ! is_ast12update && !is_ast14update; then
71 return $(has_version "<net-misc/asterisk-${PV}")
72 fi
73 return 0
74 }
75
76 get_available_modules() {
77 local modules mod x
78
79 # build list of available modules...
80 for x in app cdr codec format func pbx res; do
81
82 for mod in $(find "${S}" -type f -name "${x}_*.c*" -print)
83 do
84 modules="${modules} $(basename ${mod/%.c*})"
85 done
86 done
87
88 echo "${modules}"
89 }
90
91 pkg_setup() {
92 local checkfailed=0 waitaftermsg=0
93
94 if is_ast12update ; then
95 ewarn "Please note that the configuration style (particularly the dial plan) has changed significantly."
96 ewarn "sip.conf: insecure=very -> insecure=port,invite"
97 ewarn "asterisk.conf: please familiarise yourself with [compat]"
98 ewarn "extensions.conf: use comma instead of pipe as a separator"
99 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 after the installation!"
100 echo
101 waitaftermsg=1
102 fi
103
104 if [[ $waitaftermsg -eq 1 ]]; then
105 einfo "Press Ctrl+C to abort"
106 echo
107 ebeep 10
108 fi
109
110 #
111 # Regular checks
112 #
113 einfo "Running some pre-flight checks..."
114 echo
115
116 if [[ -n "${ASTERISK_MODULES}" ]] ; then
117 ewarn "You are overriding ASTERISK_MODULES. We will assume you know what you are doing. There is no support for this option, try without if you see breakage."
118 fi
119 }
120
121 src_unpack() {
122 unpack ${A}
123 cd "${S}"
124
125 #
126 # put pid file(s) into /var/run/asterisk
127 #
128 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-var_rundir.patch || die "patch failed"
129
130 #
131 # fix gsm codec cflags (e.g. i586 core epias) and disable
132 # assembler optimizations
133 #
134 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-gsm-pic.patch || die "patch failed"
135
136 #
137 # add missing LIBS for uclibc
138 #
139 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-uclibc.patch || die "patch failed"
140
141 #
142 # compensate for non-standard LUA header paths in Gentoo
143 #
144 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-lua-includes.patch || die "patch failed"
145
146 #
147 # make sure FXO ports are usable immediately, without requiring an inbound call first
148 # https://issues.asterisk.org/view.php?id=14577
149 #
150 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-fxsks-hookstate.patch || die "patch failed"
151
152 #
153 # avoid segmentation fault when transferring a queue call
154 # https://issues.asterisk.org/view.php?id=15848
155 #
156 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-transfer-segfault.patch || die "patch failed"
157
158 #
159 # do not ignore alarm-cleared event while V23 caller ID detection is in progress
160 # otherwise automated British Telecom line test causes permanent red alarm
161 # https://issues.asterisk.org/view.php?id=14163
162 #
163 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-bt-line-test.patch || die "patch failed"
164
165 #
166 # SIP invites without a session-expires header end up with an expiry time of -1 seconds
167 # causing immediate hangup.
168 # https://issues.asterisk.org/view.php?id=15621
169 #
170 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.8-session_expiry.patch || die "patch failed"
171
172 AT_M4DIR=autoconf eautoreconf
173
174 # parse modules list
175 if [[ -n "${ASTERISK_MODULES}" ]]; then
176 local x modules="$(get_available_modules)"
177
178 einfo "Custom list of modules specified, checking..."
179
180 use debug && {
181 einfo "Available modules: ${modules}"
182 einfo " Selected modules: ${ASTERISK_MODULES}"
183 }
184
185 for x in ${ASTERISK_MODULES}; do
186 if [[ "${x}" = "-*" ]]; then
187 MODULES_LIST=""
188 else
189 if has ${x} ${modules}
190 then
191 MODULES_LIST="${MODULES_LIST} ${x}"
192 else
193 eerror "Unknown module: ${x}"
194 fi
195 fi
196 done
197
198 export MODULES_LIST
199 fi
200 }
201
202 src_compile() {
203 #
204 # start with configure
205 #
206 econf \
207 --libdir="/usr/$(get_libdir)" \
208 --localstatedir="/var" \
209 --with-gsm=internal \
210 --with-popt \
211 --with-z \
212 $(use_with alsa asound) \
213 $(use_with caps cap) \
214 $(use_with curl) \
215 $(use_with dahdi pri) \
216 $(use_with dahdi tonezone) \
217 $(use_with dahdi) \
218 $(use_with freetds tds) \
219 $(use_with iconv) \
220 $(use_with jabber iksemel) \
221 $(use_with misdn isdnnet) \
222 $(use_with misdn suppserv) \
223 $(use_with misdn) \
224 $(use_with newt) \
225 $(use_with odbc) \
226 $(use_with oss) \
227 $(use_with postgres) \
228 $(use_with radius) \
229 $(use_with snmp netsnmp) \
230 $(use_with span spandsp) \
231 $(use_with speex) \
232 $(use_with speex speexdsp) \
233 $(use_with sqlite sqlite3) \
234 $(use_with ssl crypto) \
235 $(use_with ssl) \
236 $(use_with vorbis ogg) \
237 $(use_with vorbis) || die "econf failed"
238
239 #
240 # custom module filter
241 # run menuselect to evaluate the list of modules
242 # and rewrite the list afterwards
243 #
244 if [[ -n "${MODULES_LIST}" ]]
245 then
246 local mod category tmp_list failed_list
247
248 ###
249 # run menuselect
250
251 emake menuselect.makeopts || die "emake menuselect.makeopts failed"
252
253 ###
254 # get list of modules with failed dependencies
255
256 failed_list="$(awk -F= '/^MENUSELECT_DEPSFAILED=/{ print $3 }' menuselect.makeopts)"
257
258 ###
259 # traverse our list of modules
260
261 for category in app cdr codec format func pbx res; do
262 tmp_list=""
263
264 # search list of modules for matching ones first...
265 for mod in ${MODULES_LIST}; do
266 # module is from current category?
267 if [[ "${mod/%_*}" = "${category}" ]]
268 then
269 # check menuselect thinks the dependencies are met
270 if has ${mod} ${failed_list}
271 then
272 eerror "${mod}: dependencies required to build this module are not met, NOT BUILDING!"
273 else
274 tmp_list="${tmp_list} ${mod}"
275 fi
276 fi
277 done
278
279 use debug && echo "${category} tmp: ${tmp_list}"
280
281 # replace the module list for $category with our custom one
282 if [[ -n "${tmp_list}" ]]
283 then
284 category="$(echo ${category} | tr '[:lower:]' '[:upper:]')"
285 sed -i -e "s:^\(MENUSELECT_${category}S?\):\1=${tmp_list}:" \
286 menuselect.makeopts || die "failed to set list of ${category} applications"
287 fi
288 done
289 fi
290
291 emake || die "emake failed"
292 }
293
294 src_install() {
295 # setup directory structure
296 #
297 mkdir -p "${D}"usr/lib/pkgconfig
298
299 emake DESTDIR="${D}" install || die "emake install failed"
300 emake DESTDIR="${D}" samples || die "emake samples failed"
301
302 # remove installed sample files if nosamples flag is set
303 if use nosamples; then
304 einfo "Skipping installation of sample files..."
305 rm -f "${D}"var/lib/asterisk/mohmp3/*
306 rm -f "${D}"var/lib/asterisk/sounds/demo-*
307 rm -f "${D}"var/lib/asterisk/agi-bin/*
308 else
309 einfo "Sample files have been installed"
310 fi
311 rm -rf "${D}"var/spool/asterisk/voicemail/default
312
313 # move sample configuration files to doc directory
314 if is_ast10update || is_ast12update || is_ast14update; then
315 einfo "Updating from old (pre-1.6) asterisk version, new configuration files have been installed"
316 einfo "into "${ROOT}"etc/asterisk, use etc-update or dispatch-conf to update them"
317 fi
318
319 einfo "Configuration samples have been moved to: "${ROOT}"/usr/share/doc/${PF}/conf"
320 insinto /usr/share/doc/${PF}/conf
321 doins "${D}"etc/asterisk/*.conf*
322
323 # keep directories
324 diropts -m 0770 -o asterisk -g asterisk
325 keepdir /etc/asterisk
326 keepdir /var/lib/asterisk
327 keepdir /var/run/asterisk
328 keepdir /var/spool/asterisk
329 keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail}
330 diropts -m 0750 -o asterisk -g asterisk
331 keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
332
333 newinitd "${FILESDIR}"/1.6.1/asterisk.initd asterisk
334 newconfd "${FILESDIR}"/1.6.0/asterisk.confd asterisk
335
336 # some people like to keep the sources around for custom patching
337 # copy the whole source tree to /usr/src/asterisk-${PVF} and run make clean there
338 if use keepsrc
339 then
340 einfo "keepsrc useflag enabled, copying source..."
341 dodir /usr/src
342
343 cp -dPR "${S}" "${D}"/usr/src/${PF} || die "copying source tree failed"
344
345 ebegin "running make clean..."
346 emake -C "${D}"/usr/src/${PF} clean >/dev/null || die "make clean failed"
347 eend $?
348
349 einfo "Source files have been saved to "${ROOT}"usr/src/${PF}"
350 fi
351
352 # install the upgrade documentation
353 #
354 dodoc README UPGRADE* BUGS CREDITS
355
356 # install snmp mib files
357 #
358 if use snmp
359 then
360 insinto /usr/share/snmp/mibs/
361 doins doc/digium-mib.txt doc/asterisk-mib.txt
362 fi
363 }
364
365 pkg_preinst() {
366 enewgroup asterisk
367 enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
368 }
369
370 pkg_postinst() {
371 ebegin "Fixing up permissions"
372 chown -R asterisk:asterisk "${ROOT}"var/log/asterisk
373 chmod -R u=rwX,g=rX,o= "${ROOT}"var/log/asterisk
374
375 chown asterisk:asterisk "${ROOT}"etc/asterisk/
376 chown asterisk:asterisk "${ROOT}"etc/asterisk/*.adsi
377 chown asterisk:asterisk "${ROOT}"etc/asterisk/extensions.ael
378 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/
379 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/*.adsi
380 chmod u=rwX,g=rwX,o= "${ROOT}"etc/asterisk/extensions.ael
381 eend $?
382
383 #
384 # Announcements, warnings, reminders...
385 #
386 einfo "Asterisk has been installed"
387 echo
388 elog "If you want to know more about asterisk, visit these sites:"
389 elog "http://www.asteriskdocs.org/"
390 elog "http://www.voip-info.org/wiki-Asterisk"
391 echo
392 elog "http://www.automated.it/guidetoasterisk.htm"
393 echo
394 elog "Gentoo VoIP IRC Channel:"
395 elog "#gentoo-voip @ irc.freenode.net"
396 echo
397 echo
398
399 #
400 # Warning about 1.x -> 1.6 changes...
401 #
402 if is_ast10update || is_ast12update || is_ast14update; then
403 ewarn ""
404 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 before continuing"
405 ewarn ""
406 fi
407 }
408
409 pkg_config() {
410 einfo "Do you want to reset file permissions and ownerships (y/N)?"
411
412 read tmp
413 tmp="$(echo $tmp | tr '[:upper:]' '[:lower:]')"
414
415 if [[ "$tmp" = "y" ]] ||\
416 [[ "$tmp" = "yes" ]]
417 then
418 einfo "Resetting permissions to defaults..."
419
420 for x in spool run lib log; do
421 chown -R asterisk:asterisk "${ROOT}"var/${x}/asterisk
422 chmod -R u=rwX,g=rwX,o= "${ROOT}"var/${x}/asterisk
423 done
424
425 chown -R root:asterisk "${ROOT}"etc/asterisk
426 chmod -R u=rwX,g=rwX,o= "${ROOT}"etc/asterisk
427
428 einfo "done"
429 else
430 einfo "skipping"
431 fi
432 }

  ViewVC Help
Powered by ViewVC 1.1.20