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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Feb 21 20:40:42 2010 UTC (9 years, 9 months ago) by chainsaw
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Missed two 1.6.1 branch ebuilds, away you go.
(Portage version: 2.2_rc63/cvs/Linux x86_64)

1 # Copyright 1999-2010 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.14-r1.ebuild,v 1.1 2010/02/10 22:44:31 chainsaw 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/asterisk-chan_unistim
46 !net-misc/zaptel"
47
48 S="${WORKDIR}/${MY_P}"
49
50 #
51 # shortcuts
52 #
53
54 # update from asterisk-1.0.x
55 is_ast10update() {
56 return $(has_version "=net-misc/asterisk-1.0*")
57 }
58
59 # update from asterisk-1.2.x
60 is_ast12update() {
61 return $(has_version "=net-misc/asterisk-1.2*")
62 }
63
64 # update from asterisk 1.4.x
65 is_ast14update() {
66 return $(has_version "=net-misc/asterisk-1.4*")
67 }
68
69 # update in the asterisk-1.6.x line
70 is_astupdate() {
71 if ! is_ast10update && ! is_ast12update && !is_ast14update; then
72 return $(has_version "<net-misc/asterisk-${PV}")
73 fi
74 return 0
75 }
76
77 get_available_modules() {
78 local modules mod x
79
80 # build list of available modules...
81 for x in app cdr codec format func pbx res; do
82
83 for mod in $(find "${S}" -type f -name "${x}_*.c*" -print)
84 do
85 modules="${modules} $(basename ${mod/%.c*})"
86 done
87 done
88
89 echo "${modules}"
90 }
91
92 pkg_setup() {
93 local checkfailed=0 waitaftermsg=0
94
95 if is_ast12update ; then
96 ewarn "Please note that the configuration style (particularly the dial plan) has changed significantly."
97 ewarn "sip.conf: insecure=very -> insecure=port,invite"
98 ewarn "asterisk.conf: please familiarise yourself with [compat]"
99 ewarn "extensions.conf: use comma instead of pipe as a separator"
100 ewarn "- Please read "${ROOT}"usr/share/doc/${PF}/UPGRADE.txt.bz2 after the installation!"
101 echo
102 waitaftermsg=1
103 fi
104
105 if [[ $waitaftermsg -eq 1 ]]; then
106 einfo "Press Ctrl+C to abort"
107 echo
108 ebeep 10
109 fi
110
111 #
112 # Regular checks
113 #
114 einfo "Running some pre-flight checks..."
115 echo
116
117 if [[ -n "${ASTERISK_MODULES}" ]] ; then
118 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."
119 fi
120 }
121
122 src_unpack() {
123 unpack ${A}
124 cd "${S}"
125
126 #
127 # put pid file(s) into /var/run/asterisk
128 #
129 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-var_rundir.patch || die "patch failed"
130
131 #
132 # fix gsm codec cflags (e.g. i586 core epias) and disable
133 # assembler optimizations
134 #
135 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-gsm-pic.patch || die "patch failed"
136
137 #
138 # add missing LIBS for uclibc
139 #
140 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1-uclibc.patch || die "patch failed"
141
142 #
143 # make sure FXO ports are usable immediately, without requiring an inbound call first
144 # https://issues.asterisk.org/view.php?id=14577
145 #
146 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-fxsks-hookstate.patch || die "patch failed"
147
148 #
149 # do not ignore alarm-cleared event while V23 caller ID detection is in progress
150 # otherwise automated British Telecom line test causes permanent red alarm
151 # https://issues.asterisk.org/view.php?id=14163
152 #
153 epatch "${FILESDIR}"/1.6.1/${PN}-1.6.1.6-bt-line-test.patch || die "patch failed"
154
155 #
156 # sprinkle some plus signs in strategic locations for maximum parallel make happiness
157 # https://issues.asterisk.org/view.php?id=16489
158 #
159 epatch "${FILESDIR}"/1.6.1/${P}-parallel-make.patch || die "patch failed"
160
161 #
162 # do not segfault when asked to restart gracefully
163 # https://issues.asterisk.org/view.php?id=16062
164 # https://issues.asterisk.org/view.php?id=16470
165 #
166 epatch "${FILESDIR}"/1.6.1/${P}-graceful-restart-segfault.patch
167
168 #
169 # add special playback with fax detection
170 # Code by NewMan telecom, patch scavenged
171 # by Cory Coager
172 # http://bugs.gentoo.org/show_bug.cgi?id=298328
173 #
174 epatch "${FILESDIR}"/1.6.2/${PN}-1.6.2.2-nv-faxdetect.patch
175
176 AT_M4DIR=autoconf eautoreconf
177
178 # parse modules list
179 if [[ -n "${ASTERISK_MODULES}" ]]; then
180 local x modules="$(get_available_modules)"
181
182 einfo "Custom list of modules specified, checking..."
183
184 use debug && {
185 einfo "Available modules: ${modules}"
186 einfo " Selected modules: ${ASTERISK_MODULES}"
187 }
188
189 for x in ${ASTERISK_MODULES}; do
190 if [[ "${x}" = "-*" ]]; then
191 MODULES_LIST=""
192 else
193 if has ${x} ${modules}
194 then
195 MODULES_LIST="${MODULES_LIST} ${x}"
196 else
197 eerror "Unknown module: ${x}"
198 fi
199 fi
200 done
201
202 export MODULES_LIST
203 fi
204 }
205
206 src_compile() {
207 #
208 # start with configure
209 #
210 econf \
211 --libdir="/usr/$(get_libdir)" \
212 --localstatedir="/var" \
213 --with-gsm=internal \
214 --with-popt \
215 --with-z \
216 $(use_with alsa asound) \
217 $(use_with caps cap) \
218 $(use_with curl) \
219 $(use_with dahdi pri) \
220 $(use_with dahdi tonezone) \
221 $(use_with dahdi) \
222 $(use_with freetds tds) \
223 $(use_with iconv) \
224 $(use_with jabber iksemel) \
225 $(use_with misdn isdnnet) \
226 $(use_with misdn suppserv) \
227 $(use_with misdn) \
228 $(use_with newt) \
229 $(use_with odbc) \
230 $(use_with oss) \
231 $(use_with postgres) \
232 $(use_with radius) \
233 $(use_with snmp netsnmp) \
234 $(use_with span spandsp) \
235 $(use_with speex) \
236 $(use_with speex speexdsp) \
237 $(use_with sqlite sqlite3) \
238 $(use_with ssl crypto) \
239 $(use_with ssl) \
240 $(use_with vorbis ogg) \
241 $(use_with vorbis) || die "econf failed"
242
243 #
244 # custom module filter
245 # run menuselect to evaluate the list of modules
246 # and rewrite the list afterwards
247 #
248 if [[ -n "${MODULES_LIST}" ]]
249 then
250 local mod category tmp_list failed_list
251
252 ###
253 # run menuselect
254
255 emake menuselect.makeopts || die "emake menuselect.makeopts failed"
256
257 ###
258 # get list of modules with failed dependencies
259
260 failed_list="$(awk -F= '/^MENUSELECT_DEPSFAILED=/{ print $3 }' menuselect.makeopts)"
261
262 ###
263 # traverse our list of modules
264
265 for category in app cdr codec format func pbx res; do
266 tmp_list=""
267
268 # search list of modules for matching ones first...
269 for mod in ${MODULES_LIST}; do
270 # module is from current category?
271 if [[ "${mod/%_*}" = "${category}" ]]
272 then
273 # check menuselect thinks the dependencies are met
274 if has ${mod} ${failed_list}
275 then
276 eerror "${mod}: dependencies required to build this module are not met, NOT BUILDING!"
277 else
278 tmp_list="${tmp_list} ${mod}"
279 fi
280 fi
281 done
282
283 use debug && echo "${category} tmp: ${tmp_list}"
284
285 # replace the module list for $category with our custom one
286 if [[ -n "${tmp_list}" ]]
287 then
288 category="$(echo ${category} | tr '[:lower:]' '[:upper:]')"
289 sed -i -e "s:^\(MENUSELECT_${category}S?\):\1=${tmp_list}:" \
290 menuselect.makeopts || die "failed to set list of ${category} applications"
291 fi
292 done
293 fi
294
295 ASTLDFLAGS="${LDFLAGS}" emake || die "emake failed"
296 }
297
298 src_install() {
299 # setup directory structure
300 #
301 mkdir -p "${D}"usr/lib/pkgconfig
302
303 emake DESTDIR="${D}" install || die "emake install failed"
304 emake DESTDIR="${D}" samples || die "emake samples failed"
305
306 # remove installed sample files if nosamples flag is set
307 if use nosamples; then
308 einfo "Skipping installation of sample files..."
309 rm -f "${D}"var/lib/asterisk/mohmp3/*
310 rm -f "${D}"var/lib/asterisk/sounds/demo-*
311 rm -f "${D}"var/lib/asterisk/agi-bin/*
312 else
313 einfo "Sample files have been installed"
314 fi
315 rm -rf "${D}"var/spool/asterisk/voicemail/default
316
317 # move sample configuration files to doc directory
318 if is_ast10update || is_ast12update || is_ast14update; then
319 einfo "Updating from old (pre-1.6) asterisk version, new configuration files have been installed"
320 einfo "into "${ROOT}"etc/asterisk, use etc-update or dispatch-conf to update them"
321 fi
322
323 einfo "Configuration samples have been moved to: "${ROOT}"/usr/share/doc/${PF}/conf"
324 insinto /usr/share/doc/${PF}/conf
325 doins "${D}"etc/asterisk/*.conf*
326
327 cd "${D}"
328 for conffile in etc/asterisk/*.*
329 do
330 fowners asterisk:asterisk $conffile
331 fperms 0660 $conffile
332 done
333 cd "${S}"
334
335 # keep directories
336 diropts -m 0770 -o asterisk -g asterisk
337 keepdir /etc/asterisk
338 keepdir /var/lib/asterisk
339 keepdir /var/run/asterisk
340 keepdir /var/spool/asterisk
341 keepdir /var/spool/asterisk/{system,tmp,meetme,monitor,dictate,voicemail}
342 diropts -m 0750 -o asterisk -g asterisk
343 keepdir /var/log/asterisk/{cdr-csv,cdr-custom}
344
345 newinitd "${FILESDIR}"/1.6.1/asterisk.initd3 asterisk
346 newconfd "${FILESDIR}"/1.6.0/asterisk.confd asterisk
347
348 # some people like to keep the sources around for custom patching
349 # copy the whole source tree to /usr/src/asterisk-${PVF} and run make clean there
350 if use keepsrc
351 then
352 einfo "keepsrc useflag enabled, copying source..."
353 dodir /usr/src
354
355 cp -dPR "${S}" "${D}"/usr/src/${PF} || die "copying source tree failed"
356
357 ebegin "running make clean..."
358 emake -C "${D}"/usr/src/${PF} clean >/dev/null || die "make clean failed"
359 eend $?
360
361 einfo "Source files have been saved to "${ROOT}"usr/src/${PF}"
362 fi
363
364 # install the upgrade documentation
365 #
366 dodoc README UPGRADE* BUGS CREDITS
367
368 # install snmp mib files
369 #
370 if use snmp
371 then
372 insinto /usr/share/snmp/mibs/
373 doins doc/digium-mib.txt doc/asterisk-mib.txt
374 fi
375 }
376
377 pkg_preinst() {
378 enewgroup asterisk
379 enewuser asterisk -1 -1 /var/lib/asterisk "asterisk,dialout"
380 }
381
382 pkg_postinst() {
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