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

Contents of /net-misc/zaptel/zaptel-1.0.9_p2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (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.2: +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-2005 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.0.9_p2.ebuild,v 1.2 2005/12/02 03:32:51 stkn Exp $
4
5 IUSE="devfs26 bri florz rtc"
6
7 inherit toolchain-funcs eutils linux-mod
8
9 BRI_VERSION="0.2.0-RC8n"
10 FLORZ_VERSION="0.2.0-RC8j_florz-8"
11
12 MY_PV="${PV/_p/.}"
13
14 DESCRIPTION="Drivers for Digium and ZapataTelephony cards"
15 HOMEPAGE="http://www.asterisk.org"
16 SRC_URI="ftp://ftp.digium.com/pub/telephony/zaptel/old/zaptel-${MY_PV}.tar.gz
17 bri? ( http://www.junghanns.net/downloads/bristuff-${BRI_VERSION}.tar.gz )
18 florz? ( http://zaphfc.florz.dyndns.org/zaphfc_${FLORZ_VERSION}.diff.gz )"
19
20 SLOT="0"
21 LICENSE="GPL-2"
22 KEYWORDS="~x86 ~ppc ~amd64"
23
24 DEPEND="virtual/libc
25 virtual/linux-sources
26 >=dev-libs/newt-0.50.0"
27
28 S="${WORKDIR}/${PN}-${MY_PV}"
29
30 pkg_setup() {
31 linux-mod_pkg_setup
32
33 # show an nice warning message about zaptel not supporting devfs on 2.6
34 if kernel_is 2 6 && linux_chkconfig_present DEVFS_FS ; then
35 echo
36 einfo "You're using a 2.6 kernel with DEVFS."
37 einfo "The Zaptel drivers won't work unless you either:"
38 einfo " * switch to udev"
39 einfo " * write a script that re-creates the necessary device nodes for you"
40 einfo " * enable the devfs26 useflag (see below)"
41 einfo ""
42 einfo "There's an experimental patch which adds devfs support when using linux-2.6, but:"
43 einfo " 1. It disables udev support to avoid conflicts"
44 ewarn " 2. It is not supported by Digium / the Asterisk project!"
45 einfo ""
46 einfo "If you're still interested, abort now (ctrl+c) and enable the devfs26 USE-flag"
47 einfo "Feedback and bug-reports should go to: stkn@gentoo.org"
48 einfo "You have been warned!"
49 echo
50 einfo "Sleeping 20 Seconds..."
51 epause 20
52 fi
53 }
54
55 src_unpack() {
56 unpack ${A}
57
58 cd ${S}
59 # patch makefile(s) for gentoo
60 epatch ${FILESDIR}/${PN}-1.0.9_p2-gentoo.diff
61
62 # devfs support
63 if use devfs26; then
64 einfo "Enabling experimental devfs support for linux-2.6..."
65 epatch ${FILESDIR}/${PN}-1.0.4-experimental-devfs26.diff
66
67 # disable udev
68 sed -i -e "s:#define[\t ]\+\(CONFIG_ZAP_UDEV\):#undef \1:" \
69 zconfig.h
70
71 # fix Makefile to not create device nodes for
72 # devfs enabled 2.6 kernels
73 sed -i -e 's:grep udevd:grep -q \"udevd\\|devfsd\":' \
74 Makefile || die "QA error: No substitution performed"
75 fi
76
77 # apply patch for gcc-3.4.x if that's the compiler in use...
78 # fixes (#76707)
79 if use x86 && [[ `gcc-fullversion` = "3.4.3" ]]; then
80 epatch ${FILESDIR}/${PN}-1.0.4-gcc34.patch
81 fi
82
83 # try to apply bristuff patch
84 if use bri; then
85 einfo "Patching zaptel w/ BRI stuff (${BRI_VERSION})"
86 epatch ${FILESDIR}/zaptel-bristuff-${BRI_VERSION}.patch
87
88 cd ${WORKDIR}/bristuff-${BRI_VERSION}
89
90 if use florz; then
91 einfo "Using florz patches (${FLORZ_VERSION}) for zaphfc"
92
93 epatch ${WORKDIR}/zaphfc_${FLORZ_VERSION}.diff
94 fi
95
96 # patch includes
97 sed -i -e "s:^#include.*zaptel\.h.*:#include <zaptel.h>:" \
98 qozap/qozap.c \
99 zaphfc/zaphfc.c \
100 cwain/cwain.c
101
102 # patch makefiles
103 sed -i -e "s:^ZAP[\t ]*=.*:ZAP=-I${S}:" \
104 -e "s:^MODCONF=.*:MODCONF=/etc/modules.d/zaptel:" \
105 -e "s:linux-2.6:linux:g" \
106 qozap/Makefile \
107 zaphfc/Makefile \
108 cwain/Makefile
109
110 sed -i -e "s:^\(CFLAGS+=-I. \).*:\1 \$(ZAP):" \
111 zaphfc/Makefile
112 fi
113
114 # replace `uname -r` with ${KV_FULL} in all Makefiles
115 find ${WORKDIR} -iname "Makefile" -exec sed -i -e "s:\`uname -r\`:${KV_FULL}:g" {} \;
116
117 cd ${S}
118 #######################################################################
119 # apply other patches here,
120 # make sure they work with things that have been added before!
121 #
122
123 # apply x86 rtc patch for ztdummy (http://bugs.digium.com/view.php?id=4301)
124 # this won't have any effect on non-x86 systems...
125 if use rtc; then
126 if use x86 || use amd64; then
127 epatch ${FILESDIR}/${PN}-1.0.9-rtc.patch
128 else
129 ewarn "RTC is unsupported on your arch, skipping patch"
130 fi
131 fi
132 }
133
134 src_compile() {
135 make ARCH=$(tc-arch-kernel) KERNEL_SOURCE=/usr/src/linux || die
136
137 if use bri; then
138 cd ${WORKDIR}/bristuff-${BRI_VERSION}
139 make ARCH=$(tc-arch-kernel) -C qozap || die
140 make ARCH=$(tc-arch-kernel) -C zaphfc || die
141 make ARCH=$(tc-arch-kernel) -C cwain || die
142 fi
143 }
144
145 src_install() {
146 make INSTALL_PREFIX=${D} install || die
147
148 dodoc ChangeLog README README.udev README.Linux26 README.fxsusb zaptel.init
149 dodoc zaptel.conf.sample LICENSE zaptel.sysconfig
150
151 # additional tools
152 dobin ztmonitor ztspeed zttest
153
154 if use bri; then
155 einfo "Installing bri"
156 cd ${WORKDIR}/bristuff-${BRI_VERSION}
157
158 insinto /lib/modules/${KV_FULL}/misc
159 doins qozap/qozap.${KV_OBJ}
160 doins zaphfc/zaphfc.${KV_OBJ}
161 doins cwain/cwain.${KV_OBJ}
162
163 # install example configs for octoBRI and quadBRI
164 insinto /etc
165 doins qozap/zaptel.conf.octoBRI
166 newins qozap/zaptel.conf zaptel.conf.quadBRI
167 newins zaphfc/zaptel.conf zaptel.conf.zaphfc
168
169 insinto /etc/asterisk
170 doins qozap/zapata.conf.octoBRI
171 newins qozap/zapata.conf zapata.conf.quadBRI
172 newins zaphfc/zapata.conf zapata.conf.zaphfc
173
174 docinto bristuff
175 dodoc CHANGES INSTALL
176
177 docinto bristuff/qozap
178 dodoc qozap/LICENSE qozap/TODO qozap/*.conf*
179
180 docinto bristuff/zaphfc
181 dodoc zaphfc/LICENSE zaphfc/*.conf
182
183 docinto bristuff/cwain
184 dodoc cwain/TODO cwain/LICENSE
185 fi
186
187 # install init script
188 newinitd ${FILESDIR}/zaptel.rc6 zaptel
189 newconfd ${FILESDIR}/zaptel.confd zaptel
190
191 # install devfsd rule file
192 insinto /etc/devfs.d
193 newins ${FILESDIR}/zaptel.devfsd zaptel
194
195 # install udev rule file
196 insinto /etc/udev/rules.d
197 newins ${FILESDIR}/zaptel.udevd 10-zaptel.rules
198
199 # fix permissions if there's no udev / devfs around
200 if [[ -d ${D}/dev/zap ]]; then
201 chown -R root:dialout ${D}/dev/zap
202 chmod -R u=rwX,g=rwX,o= ${D}/dev/zap
203 fi
204 }
205
206 pkg_postinst() {
207 linux-mod_pkg_postinst
208
209 if use devfs26; then
210 ewarn "*** Warning! ***"
211 ewarn "Devfs support for linux-2.6 is experimental and not"
212 ewarn "supported by digium or the asterisk project!"
213 echo
214 ewarn "Send bug-reports to: stkn@gentoo.org"
215 fi
216
217 echo
218 einfo "Use the /etc/init.d/zaptel script to load zaptel.conf settings on startup!"
219 echo
220
221 if use bri; then
222 einfo "Bristuff configs have been merged as:"
223 einfo ""
224 einfo "${ROOT}etc/"
225 einfo " zaptel.conf.zaphfc"
226 einfo " zaptel.conf.quadBRI"
227 einfo " zaptel.conf.octoBRI"
228 einfo ""
229 einfo "${ROOT}etc/asterisk/"
230 einfo " zapata.conf.zaphfc"
231 einfo " zapata.conf.quadBRI"
232 einfo " zapata.conf.octoBRI"
233 echo
234 fi
235
236 # fix permissions if there's no udev / devfs around
237 if [[ -d ${ROOT}/dev/zap ]]; then
238 chown -R root:dialout ${ROOT}/dev/zap
239 chmod -R u=rwX,g=rwX,o= ${ROOT}/dev/zap
240 fi
241 }

  ViewVC Help
Powered by ViewVC 1.1.20