/[gentoo-x86]/net-misc/zaptel/zaptel-1.2.5.ebuild
Gentoo

Contents of /net-misc/zaptel/zaptel-1.2.5.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Oct 3 01:35:51 2006 UTC (13 years, 2 months ago) by genstef
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
version bump thanks to kolla and stkn for help, clean up old
(Portage version: 2.1.2_pre2-r1)
 (Unsigned Manifest commit)

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/zaptel/zaptel-1.2.5.ebuild,v 1.1 2006/04/16 00:50:40 stkn Exp $
4
5 inherit toolchain-funcs eutils linux-mod
6
7 ## NOTE:
8 # this is zaptel-1.2.5-r1 in the overlay
9
10 BRI_VERSION="0.3.0-PRE-1n"
11 FLORZ_VERSION="0.3.0-PRE-1n_florz-11"
12
13 IUSE="bri devfs26 ecmark ecmark2 ecmark3 ecaggressive eckb1 ecmg2 ecsteve ecsteve2 florz rtc ukcid watchdog zapras zapnet"
14
15 MY_P="${P/_/-}"
16
17 DESCRIPTION="Drivers for Digium and ZapataTelephony cards"
18 HOMEPAGE="http://www.asterisk.org"
19 SRC_URI="http://ftp.digium.com/pub/zaptel/${MY_P}.tar.gz
20 bri? ( http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )
21 florz? ( http://www.netdomination.org/pub/asterisk/zaphfc_${FLORZ_VERSION}.diff.gz )"
22
23 S="${WORKDIR}/${MY_P}"
24
25 S_BRI="${WORKDIR}/bristuff-${BRI_VERSION}"
26
27 SLOT="0"
28 LICENSE="GPL-2"
29 KEYWORDS="~amd64 ~ppc ~x86"
30
31 DEPEND="virtual/libc
32 virtual/linux-sources
33 >=dev-libs/newt-0.50.0"
34
35 # list of echo canceller use flags,
36 # first active in this list is selected (=order does matter)
37 ZAP_EC_FLAGS="ecmark ecmark2 ecmark3 ecsteve ecsteve2 eckb1 ecmg2"
38
39 ### Begin: Helper functions
40
41 select_echo_cancel() {
42 local myEC=""
43
44 for x in ${ZAP_EC_FLAGS}; do
45 if use $x; then
46 myEC=$(echo "$x" | sed -e "s:^ec::" | tr '[:lower:]' '[:upper:]')
47 break;
48 fi
49 done
50
51 echo ${myEC}
52 }
53
54 zconfig_disable() {
55 if grep -q "${1}" ${S}/zconfig.h; then
56 # match a little more than ${1} so we can use zconfig_disable
57 # to disable all echo cancellers in zconfig.h w/o calling it several times
58 sed -i -e "s:^[ \t]*#define[ \t]\+\(${1}[a-zA-Z0-9_-]*\).*:#undef \1:" \
59 ${S}/zconfig.h
60 fi
61
62 return $?
63 }
64
65 zconfig_enable() {
66 if grep -q "${1}" ${S}/zconfig.h; then
67 sed -i -e "s:^/\*[ \t]*#define[ \t]\+\(${1}\).*:#define \1:" \
68 -e "s:^[ \t]*#undef[ \t]\+\(${1}\).*:#define \1:" \
69 ${S}/zconfig.h
70 fi
71
72 return $?
73 }
74
75 ### End: Helper functions
76
77 pkg_setup() {
78 local result=0 numec=0
79
80 linux-mod_pkg_setup
81
82 einfo "Running pre-flight checks..."
83
84 # basic zaptel checks
85 if ! linux_chkconfig_present CRC_CCITT; then
86 echo
87 eerror "Your kernel lacks CRC_CCIT support!"
88 eerror "Enable CONFIG_CRC_CCIT!"
89 result=$((result+1))
90 fi
91
92 # check if multiple echo cancellers have been selected
93 for x in ${ZAP_EC_FLAGS}; do
94 use $x && numec=$((numec+1))
95 done
96 if [[ $numec -gt 1 ]]; then
97 # multiple flags are active, only the first in the ZAP_EC_FLAGS list
98 # will be used, make sure the user knows about this
99 echo
100 ewarn "Multiple echo canceller flags are active but only one will be used!"
101 ewarn "Selected: $(select_echo_cancel)"
102 fi
103
104 # we need at least HDLC generic support
105 if use zapnet && ! linux_chkconfig_present HDLC; then
106 echo
107 eerror "zapnet: Your kernel lacks HDLC support!"
108 eerror "zapnet: Enable CONFIG_HDLC* to use zaptel network support!"
109 result=$((result+1))
110 fi
111
112 # zapras needs PPP support
113 if use zapras && ! linux_chkconfig_present PPP; then
114 echo
115 eerror "zapras: Your kernel lacks PPP support!"
116 eerror "zapras: Enable CONFIG_PPP* to use zaptel ras support!"
117 result=$((result+1))
118 fi
119
120 # rtc needs linux-2.6 and CONFIG_RTC
121 if use rtc; then
122 if ! kernel_is 2 6; then
123 echo
124 eerror "rtc: >=Linux-2.6.0 is needed for rtc support!"
125 result=$((result+1))
126 fi
127
128 if ! linux_chkconfig_present RTC; then
129 eerror "rtc: Your kernel lacks RealTime-Clock support!"
130 result=$((result+1))
131 fi
132 fi
133
134 if [[ $result -gt 0 ]]; then
135 echo
136 ewarn "One or more of the neccessary precondition(s) is/are not met!"
137 ewarn "Look at the messages above, resolve the problem (or disable the use-flag) and try again"
138 echo
139
140 if [[ $result -lt 3 ]]; then
141 eerror "[$result Error(s)] Zaptel is not happy :("
142 else
143 eerror "[$result Error(s)] You're making zaptel cry :'("
144 fi
145 die "[$result] Precondition(s) not met"
146 fi
147
148 echo
149 einfo "Zaptel is happy and continues... :)"
150 }
151
152 src_unpack() {
153 unpack ${A}
154
155 cd ${S}
156 epatch ${FILESDIR}/${PN}-1.2.2-gentoo.diff
157
158 if kernel_is 2 6 && use devfs26; then
159 if [[ ${KV_PATCH} -ge 14 ]]; then
160 eerror "Devfs has been removed in linux-2.6.14, skipping devfs26!"
161 else
162 epatch ${FILESDIR}/${PN}-1.2.0-devfs26.diff
163
164 # fix Makefile to not create device nodes for
165 # devfs enabled 2.6 kernels
166 sed -i -e 's:grep -q udevd:grep -q \"udevd\\|devfsd\":' \
167 Makefile
168
169 # disable udev support on devfs26 systems
170 zconfig_disable CONFIG_ZAP_UDEV
171 fi
172 fi
173
174 use ukcid && \
175 epatch ${FILESDIR}/${PN}-1.2.0-ukcid.patch
176
177 # try to apply bristuff patch
178 if use bri; then
179 # fix for userpriv
180 chmod -R a=rwX ${S_BRI}
181
182 einfo "Patching zaptel w/ BRI stuff (${BRI_VERSION})"
183 epatch ${S_BRI}/patches/zaptel.patch
184
185 cd ${S_BRI}
186
187 if use florz; then
188 einfo "Using florz patches (${FLORZ_VERSION}) for zaphfc"
189
190 # remove as soon as there's a new florz patch available
191 sed -i -e "s:zaptel-1\.2\.1:zaptel-1.2.3:g" \
192 ${WORKDIR}/zaphfc_${FLORZ_VERSION}.diff
193
194 epatch ${WORKDIR}/zaphfc_${FLORZ_VERSION}.diff
195 fi
196
197 # patch includes
198 sed -i -e "s:^#include.*zaptel\.h.*:#include <zaptel.h>:" \
199 qozap/qozap.c \
200 zaphfc/zaphfc.c \
201 cwain/cwain.c
202
203 # patch makefiles
204 sed -i -e "s:^ZAP[\t ]*=.*:ZAP=-I${S}:" \
205 -e "s:^MODCONF=.*:MODCONF=/etc/modules.d/zaptel:" \
206 -e "s:linux-2.6:linux:g" \
207 qozap/Makefile \
208 zaphfc/Makefile \
209 cwain/Makefile
210
211 sed -i -e "s:^\(CFLAGS+=-I. \).*:\1 \$(ZAP):" \
212 zaphfc/Makefile
213
214 cd ${S}
215 fi
216
217 ### Configuration changes
218 local myEC
219
220 # prepare zconfig.h
221 myEC=$(select_echo_cancel)
222 if [[ -n "${myEC}" ]]; then
223 einfo "Selected echo canceller: ${myEC}"
224 # disable default first, set new selected ec afterwards
225 zconfig_disable ECHO_CAN
226 zconfig_enable ECHO_CAN_${myEC}
227 fi
228
229 # enable rtc support on 2.6
230 if use rtc && linux_chkconfig_present RTC && kernel_is 2 6; then
231 einfo "Enabling ztdummy RTC support"
232 zconfig_enable USE_RTC
233 fi
234
235 # enable agressive echo surpression
236 use ecaggressive && \
237 zconfig_enable AGGRESSIVE_SUPPRESSOR
238
239 # ppp ras support
240 use zapras && \
241 zconfig_enable CONFIG_ZAPATA_PPP
242
243 # frame relay, syncppp...
244 use zapnet && \
245 zconfig_enable CONFIG_ZAPATA_NET
246
247 # zaptel watchdog
248 use watchdog && \
249 zconfig_enable CONFIG_ZAPTEL_WATCHDOG
250 }
251
252 src_compile() {
253 # build
254 make KVERS=${KV_FULL} \
255 KSRC=/usr/src/linux ARCH=$(tc-arch-kernel) || die
256
257 if use bri; then
258 cd ${S_BRI}
259 for x in cwain qozap zaphfc; do
260 einfo "Building ${x}..."
261 make KVERS=${KV_FULL} \
262 KSRC=/usr/src/linux \
263 ARCH=$(tc-arch-kernel) \
264 -C ${x} || die "make ${x} failed"
265 done
266 fi
267 }
268
269 src_install() {
270 make INSTALL_PREFIX=${D} ARCH=$(tc-arch-kernel) \
271 KVERS=${KV_FULL} KSRC=/usr/src/linux install || die
272
273 dodoc ChangeLog README README.udev README.Linux26 README.fxsusb zaptel.init
274 dodoc zaptel.conf.sample LICENSE zaptel.sysconfig
275
276 # additional tools
277 dobin ztmonitor ztspeed zttest
278
279 # install all header files, several packages need the complete set
280 # (e.g. sangoma wanpipe)
281 insinto /usr/include/zaptel
282 doins *.h
283
284 if use bri; then
285 einfo "Installing bri"
286 cd ${S_BRI}
287
288 insinto /lib/modules/${KV_FULL}/misc
289 doins qozap/qozap.${KV_OBJ}
290 doins zaphfc/zaphfc.${KV_OBJ}
291 doins cwain/cwain.${KV_OBJ}
292
293 # install example configs for octoBRI and quadBRI
294 insinto /etc
295 doins qozap/zaptel.conf.octoBRI
296 newins qozap/zaptel.conf zaptel.conf.quadBRI
297 newins zaphfc/zaptel.conf zaptel.conf.zaphfc
298
299 insinto /etc/asterisk
300 doins qozap/zapata.conf.octoBRI
301 newins qozap/zapata.conf zapata.conf.quadBRI
302 newins zaphfc/zapata.conf zapata.conf.zaphfc
303
304 docinto bristuff
305 dodoc CHANGES INSTALL
306
307 docinto bristuff/qozap
308 dodoc qozap/LICENSE qozap/TODO qozap/*.conf*
309
310 docinto bristuff/zaphfc
311 dodoc zaphfc/LICENSE zaphfc/*.conf
312
313 docinto bristuff/cwain
314 dodoc cwain/TODO cwain/LICENSE
315
316 cd ${S}
317 fi
318
319 # install init script
320 newinitd ${FILESDIR}/zaptel.rc6 zaptel
321 newconfd ${FILESDIR}/zaptel.confd zaptel
322
323 # install devfsd rule file
324 insinto /etc/devfs.d
325 newins ${FILESDIR}/zaptel.devfsd zaptel
326
327 # install udev rule file
328 insinto /etc/udev/rules.d
329 newins ${FILESDIR}/zaptel.udevd 10-zaptel.rules
330
331 # fix permissions if there's no udev / devfs around
332 if [[ -d ${D}/dev/zap ]]; then
333 chown -R root:dialout ${D}/dev/zap
334 chmod -R u=rwX,g=rwX,o= ${D}/dev/zap
335 fi
336 }
337
338 pkg_postinst() {
339 linux-mod_pkg_postinst
340
341 if kernel_is 2 6 && [[ ${KV_PATCH} -lt 14 ]] && use devfs26; then
342 ewarn "*** Warning! ***"
343 ewarn "Devfs support for linux-2.6 is experimental and not"
344 ewarn "supported by digium or the asterisk project!"
345 echo
346 ewarn "Send bug-reports to: stkn@gentoo.org"
347 fi
348
349 echo
350 einfo "Use the /etc/init.d/zaptel script to load zaptel.conf settings on startup!"
351 echo
352
353 if use bri; then
354 einfo "Bristuff configs have been merged as:"
355 einfo ""
356 einfo "${ROOT}etc/"
357 einfo " zaptel.conf.zaphfc"
358 einfo " zaptel.conf.quadBRI"
359 einfo " zaptel.conf.octoBRI"
360 einfo ""
361 einfo "${ROOT}etc/asterisk/"
362 einfo " zapata.conf.zaphfc"
363 einfo " zapata.conf.quadBRI"
364 einfo " zapata.conf.octoBRI"
365 echo
366 fi
367
368 # fix permissions if there's no udev / devfs around
369 if [[ -d ${ROOT}dev/zap ]]; then
370 chown -R root:dialout ${ROOT}dev/zap
371 chmod -R u=rwX,g=rwX,o= ${ROOT}dev/zap
372 fi
373 }

  ViewVC Help
Powered by ViewVC 1.1.20