blob: 6455d0d60d5bf3074275bfe531f0df19f0d1c91f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/asterisk-addons/asterisk-addons-1.2.5.ebuild,v 1.1 2007/01/17 18:55:23 gustavoz Exp $
WANT_AUTOCONF="latest"
WANT_AUTOMAKE="latest"
inherit eutils flag-o-matic autotools
IUSE="elibc_uclibc mysql mysql_loguniqueid h323 mp3 debug"
MY_P="${P/_/-}"
DESCRIPTION="Additional Plugins for Asterisk"
HOMEPAGE="http://www.asterisk.org/"
SRC_URI="http://ftp.digium.com/pub/asterisk/${MY_P}.tar.gz"
S=${WORKDIR}/${MY_P}
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"
DEPEND=">=net-misc/asterisk-1.4.0
mysql? ( virtual/mysql )"
get_available_modules() {
local modules mod x
# build list of available modules...
for x in app cdr codec format func pbx res chan; do
for mod in $(find "${S}" -type f -name "${x}_*.c*" -print)
do
modules="${modules} $(basename ${mod/%.c*})"
done
done
echo "${modules}"
}
pkg_setup() {
local n dosleep=0
einfo "Running pre-flight checks..."
if use mysql_loguniqueid && ! use mysql; then
die "The use flag mysql_loguniqueid requires the mysql use flag!";
fi
if use h323 && built_with_use net-misc/asterisk h323; then
echo
ewarn "h323: Emerging \"${PN}\" with the h323 flag enabled will overwrite asterisk's chan_h323.so!"
ewarn "h323: Be sure to upgrade \"${ROOT}\"etc/asterisk/h323.conf afterwards!"
dosleep=1
fi
echo
if [[ $dosleep -gt 0 ]]; then
ebeep 10
fi
}
src_unpack() {
unpack ${A}
cd "${S}"
# create install dir
#
epatch "${FILESDIR}"/install.patch || die "patch failed"
econf
}
src_compile() {
local modules
append-flags -fPIC
use mysql_loguniqueid && append-flags "-DMYSQL_LOGUNIQUEID"
# build MODULE_LIST
#
if ! use mysql; then
modules="${modules} app_addon_sql_mysql cdr_mysql cdr_addon_mysql res_mysql res_config_mysql"
fi
if ! use mp3 ; then
modules="${modules} format_mp3"
fi
if ! use h323 ; then
modules="${modules} chan_ooh323"
fi
einfo "available modules $(get_available_modules)"
einfo " skipping modules ${modules}"
# run menuselect to evaluate the list of modules
# and rewrite the list afterwards
#
if [[ -n "${modules}" ]]
then
local mod category tmp_list failed_list
###
# run menuselect
emake menuselect.makeopts || die "emake menuselect.makeopts failed"
###
# get list of modules with failed dependencies
failed_list="$(awk -F= '/^MENUSELECT_DEPSFAILED=/{ print $3 }' menuselect.makeopts)"
###
# traverse our list of modules
einfo "Building menuselect.makeopts..."
for category in app cdr codec format func pbx res chan; do
tmp_list=""
# search list of modules for matching ones first...
for mod in ${modules}; do
# module is from current category?
if [[ "${mod/%_*}" = "${category}" ]]
then
# check menuselect thinks the dependencies are met
if has ${mod} ${failed_list}
then
eerror "${mod}: dependencies required to build this module are not met, NOT BUILDING!"
else
tmp_list="${tmp_list} ${mod}"
fi
fi
done
use debug && echo "${category} tmp: ${tmp_list}"
# replace the module list for $category with our custom one
if [[ -n "${tmp_list}" ]]
then
category="$(echo ${category} | tr '[:lower:]' '[:upper:]')"
sed -i -e "s:^\(MENUSELECT_${category}.*=\):\1 ${tmp_list}:" \
menuselect.makeopts || die "failed to set list of ${category} applications"
fi
done
fi
emake -j1 OPTIMIZE="${CFLAGS}" || die "Make failed"
}
src_install() {
mkdir -p "${D}"/usr/lib/asterisk/modules
emake DESTDIR="${D}" install || die "Make install failed"
# install standard docs...
dodoc README
dodoc doc/cdr_mysql.txt
insinto /usr/share/doc/${PF}
doins configs/*.sample
cd "${S}"
if use h323; then
insinto /etc/asterisk
newins configs/ooh323.conf.sample ooh323.conf
fi
if use mysql; then
insinto /etc/asterisk
newins configs/cdr_mysql.conf.sample cdr_mysql.conf
newins configs/res_mysql.conf.sample res_mysql.conf
fi
einfo "Fixing permissions"
fowners -R root:asterisk /etc/asterisk
fperms -R u=rwX,g=rX,o= /etc/asterisk
}
pkg_postinst() {
#
# Announcements, warnings, reminders...
#
einfo "********* Some notes from the asterisk-addons-1.4.6 readme: **********"
echo
ewarn "\"Using res_config_mysql at the same time as res_config_odbc can create"
ewarn "system instability on some systems. Please load only one or the other.\""
echo
ewarn "\"format_mp3 can cause Asterisk to crash on certain mp3 files (notably"
ewarn "8k files made with lame) due to bugs in mpglib. If you must use this"
ewarn "module, use it only with mp3's you know will work with it.\""
}
|