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

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

  ViewVC Help
Powered by ViewVC 1.1.20