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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Jun 24 16:49:19 2005 UTC (14 years, 5 months ago) by stkn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
FILE REMOVED
Removing old ebuilds without security update
(Portage version: 2.0.51.22-r1)

1 # Copyright 1999-2005 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.0.5-r1.ebuild,v 1.4 2005/05/30 03:17:48 solar Exp $
4
5 IUSE="alsa doc gtk mmx mysql pri zaptel resperl debug postgres vmdbmysql vmdbpostgres"
6
7 inherit eutils
8
9 ADDONS_VERSION="1.0.4"
10 SOUNDS_VERSION="1.0.2"
11
12 DESCRIPTION="Asterisk: A Modular Open Source PBX System"
13 HOMEPAGE="http://www.asterisk.org/"
14 SRC_URI="ftp://ftp.asterisk.org/pub/telephony/asterisk/${P}.tar.gz
15 ftp://ftp.asterisk.org/pub/telephony/asterisk/${PN}-addons-${ADDONS_VERSION}.tar.gz
16 ftp://ftp.asterisk.org/pub/telephony/asterisk/${PN}-sounds-${SOUNDS_VERSION}.tar.gz"
17
18 S=${WORKDIR}/${P}
19 S_ADDONS=${WORKDIR}/${PN}-addons-${ADDONS_VERSION}
20 S_SOUNDS=${WORKDIR}/${PN}-sounds-${SOUNDS_VERSION}
21
22 SLOT="0"
23 LICENSE="GPL-2"
24 KEYWORDS="~x86 ~sparc ~hppa ~amd64"
25
26 DEPEND="dev-libs/newt
27 media-sound/mpg123
28 media-sound/sox
29 doc? ( app-doc/doxygen )
30 gtk? ( =x11-libs/gtk+-1.2* )
31 pri? ( >=net-libs/libpri-1.0.3 )
32 alsa? ( media-libs/alsa-lib )
33 mysql? ( dev-db/mysql )
34 zaptel? ( >=net-misc/zaptel-1.0.3 )
35 resperl? ( dev-lang/perl
36 >=net-misc/zaptel-1.0.3 )
37 postgres? ( dev-db/postgresql )
38 vmdbmysql? ( dev-db/mysql )
39 vmdbpostgres? ( dev-db/postgresql )"
40
41
42 pkg_setup() {
43 einfo "Running some pre-flight checks..."
44 if use resperl; then
45 # res_perl pre-flight check...
46 if ! $(perl -V | grep -q "usemultiplicity=define"); then
47 eerror "Embedded perl add-on needs Perl with built-in threads support"
48 eerror "(rebuild perl with ithreads use-flag enabled)"
49 die "Perl w/o threads support..."
50 fi
51 einfo "Perl with ithreads support found"
52 fi
53
54
55 # mysql and postgres voicemail support are mutually exclusive..
56 if use vmdbmysql && use vmdbpostgres; then
57 eerror "MySQL and PostgreSQL Voicemail support are mutually exclusive... choose one!"
58 die "Conflicting use-flags"
59 fi
60 }
61
62 src_unpack() {
63 unpack ${A}
64 cd ${S}
65
66 # set cflags & mmx optimization
67 sed -i -e "s:^\(OPTIMIZE+=\).*:\1 ${CFLAGS}:" \
68 -e "s:^\(CFLAGS+=\$(shell if \$(CC)\):#\1:" \
69 Makefile
70
71 # gsm codec still uses -fomit-frame-pointer, and other codecs have their
72 # own flags. We only change the arch.
73 sed -i -e "s:^OPTIMIZE+=.*:OPTIMIZE+=${CFLAGS}:" codecs/gsm/Makefile
74
75 if use mmx; then
76 einfo "enabling mmx optimization"
77 sed -i -e "s:^#\(K6OPT.*\):\1:" Makefile
78 sed -i -e "s:^#\(K6OPT[\t ]\+= -DK6OPT\):\1:" codecs/gsm/Makefile
79 fi
80
81 if ! use debug; then
82 einfo "disabling debugging"
83 sed -i -e "s:^\(DEBUG=\):#\1:" Makefile
84 fi
85
86 # change image path in voicemail cgi
87 sed -i -e "s:^\(\$astpath = \).*:\1 \"/asterisk\";:" contrib/scripts/vmail.cgi
88
89 #
90 # embedded perl
91 #
92 if use resperl; then
93 einfo "Patching asterisk for embedded perl support..."
94 epatch ${S_ADDONS}/res_perl/astmake.diff
95
96 # create necessary .c file
97 perl -MExtUtils::Embed -e xsinit || die "Could not create perlxsi.c"
98
99 sed -i -e "s:/usr/local/bin/perl:/usr/bin/perl:" \
100 ${S_ADDONS}/res_perl/Makefile \
101 Makefile
102 sed -i -e "s:^ASTSRC.*:ASTSRC = ${S}:" \
103 -e "s:\$(ASTLIBDIR)/modules/\(res_musiconhold.so\):${S}/res/\1:" \
104 ${S_ADDONS}/res_perl/Makefile
105 fi
106
107 #
108 # uclibc patch
109 #
110 if use elibc_uclibc; then
111 einfo "Patching asterisk for uclibc..."
112 epatch ${FILESDIR}/1.0.0/${P}-uclibc-dns.diff
113 fi
114
115 #
116 # other patches
117 #
118
119 # asterisk-config
120 epatch ${FILESDIR}/1.0.0/${P}-astcfg-0.0.2.diff
121
122 # fix include path for speex >= 1.1.0
123 epatch ${FILESDIR}/1.0.0/${P}-speex.diff
124
125 # hppa build fix
126 epatch ${FILESDIR}/1.0.0/${P}-hppa.patch
127
128 #
129 # database voicemail support
130 #
131 if use postgres; then
132 sed -i -e "s:^#\(APPS+=app_sql_postgres.so\):\1:" \
133 -e "s:/usr/local/pgsql/include:/usr/include/postgresql/pgsql:" \
134 -e "s:/usr/local/pgsql/lib:/usr/lib/postgresql:" \
135 apps/Makefile
136 fi
137
138 if use vmdbpostgres; then
139 einfo "Enabling PostgreSQL voicemail support"
140 sed -i -e "s:^\(USE_POSTGRES_VM_INTERFACE\).*:\1=1:" \
141 -e "s:/usr/local/pgsql/include:/usr/include/postgresql/pgsql:" \
142 -e "s:/usr/local/pgsql/lib:/usr/lib/postgresql:" \
143 apps/Makefile
144
145 # patch app_voicemail.c
146 sed -i -e "s:^#include <postgresql/libpq-fe\.h>:#include \"libpq-fe\.h\":" \
147 apps/app_voicemail.c
148
149 elif use vmdbmysql; then
150 einfo "Enabling MySQL voicemail support"
151 sed -i -e "s:^\(USE_MYSQL_VM_INTERFACE\).*:\1=1:" \
152 -e "s:^\(CFLAGS+=-DUSEMYSQLVM\):\1 -I${S_ADDONS}:" \
153 apps/Makefile
154 fi
155
156 #
157 # asterisk add-ons
158 #
159 cd ${S_ADDONS}
160 sed -i -e "s:-I../asterisk:-I${S} -I${S}/include:" Makefile
161 sed -i -e "s:^OPTIMIZE+=.*:OPTIMIZE+=${CFLAGS}:" \
162 -e "s:^\(CFLAGS=\)\(.*\):\1-I${S}/include -fPIC \2:" \
163 format_mp3/Makefile
164 }
165
166 src_compile() {
167 # build asterisk first...
168 einfo "Building Asterisk..."
169 cd ${S}
170 emake -j1 || die "Make failed"
171
172 #
173 # add-ons
174 #
175 einfo "Building additional stuff..."
176 cd ${S_ADDONS}
177 emake -j1 || die "Make failed"
178
179 if use resperl; then
180 cd ${S_ADDONS}/res_perl
181 emake -j1 || die "Building embedded perl failed"
182 fi
183 }
184
185 src_install() {
186 emake -j1 DESTDIR=${D} install || die "Make install failed"
187 emake -j1 DESTDIR=${D} samples || die "Make install samples failed"
188
189 # install addmailbox and astgenkey
190 dosbin contrib/scripts/addmailbox
191 dosbin contrib/scripts/astgenkey
192
193 # documentation
194 use doc && \
195 emake -j1 DESTDIR=${D} progdocs
196
197 # rem # install necessary files
198 # dodir /etc/env.d
199 # echo "LD_LIBRARY_PATH=\"/usr/lib/asterisk\"" > ${D}/etc/env.d/25asterisk
200
201 exeinto /etc/init.d
202 newexe ${FILESDIR}/1.0.0/asterisk.rc6 asterisk
203
204 insinto /etc/conf.d
205 newins ${FILESDIR}/1.0.0/asterisk.confd asterisk
206
207 # don't delete these, even if they are empty
208 keepdir /var/spool/asterisk/voicemail/default/1234/INBOX
209 keepdir /var/log/asterisk/cdr-csv
210
211 # install standard docs...
212 dodoc BUGS CREDITS LICENSE ChangeLog HARDWARE README README.fpm SECURITY
213
214 docinto scripts
215 dodoc contrib/scripts/*
216 docinto firmware/iax
217 dodoc contrib/firmware/iax/*
218
219 insinto /usr/share/doc/${PF}/cgi
220 doins contrib/scripts/vmail.cgi
221 for i in "images/*.gif"; do
222 doins $i
223 done
224
225 #
226 # sounds + add-ons
227 #
228
229 # install additional sounds...
230 einfo "Installing additional sounds..."
231 cd ${S_SOUNDS}
232 emake -j1 DESTDIR=${D} install || die "Make install failed"
233
234 # install additional modules...
235 einfo "Installing additional modules..."
236 cd ${S_ADDONS}
237 emake -j1 INSTALL_PREFIX=${D} install || die "Make install failed"
238
239 if use resperl; then
240 cd ${S_ADDONS}/res_perl
241
242 # copy plugin because -rpath and stuff only works for lib*.* files and we don't want
243 # res_perl.so to look at the wrong places... (ugly but works)
244 cp ${S}/res/res_musiconhold.so . || die "Could not copy musiconhold plugin, needed by res_perl!"
245 emake -j1 INSTALL_PREFIX=${D} install || die "Installation of perl AST_API failed"
246 fi
247 }
248
249 pkg_postinst() {
250 einfo "Asterisk has been installed"
251 einfo ""
252 einfo "to add new Mailboxes use: /usr/sbin/addmailbox"
253 einfo ""
254 einfo "If you want to know more about asterisk, visit these sites:"
255 einfo "http://www.automated.it/guidetoasterisk.htm"
256 einfo "http://asterisk.xvoip.com/"
257 einfo "http://www.voip-info.org/wiki-Asterisk"
258 einfo "http://ns1.jnetdns.de/jn/relaunch/asterisk/"
259 }

  ViewVC Help
Powered by ViewVC 1.1.20