blob: 240419cd17295239b08d875d217d6387ef738e77 (
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/wanpipe/wanpipe-2.3.2_p4.ebuild,v 1.3 2005/09/16 15:36:30 stkn Exp $
inherit eutils toolchain-funcs linux-mod
DESCRIPTION="Driver for Sangoma WAN cards"
HOMEPAGE="http://www.sangoma.com/"
SRC_URI="ftp://ftp.sangoma.com/linux/current_wanpipe/${P//_p/-}.tgz"
LICENSE="WANPIPE"
SLOT="0"
KEYWORDS="~x86"
IUSE="adsl"
RDEPEND="sys-libs/ncurses
>=net-misc/zaptel-1.2.0_beta1"
DEPEND="sys-devel/flex
${RDEPEND}"
S=${WORKDIR}/${PN}
S_BUILD=${WORKDIR}/build-tmp
# Test log:
#
# Compile OK: linux-2.6.12.2
# (zaptel-1.0.8 + /usr/include/zaptel hack)
# linux-2.4.29-nd1
# (zaptel-1.0.7-r1 + /usr/include/zaptel hack)
# linux-2.6.11.12-grsec
# (zaptel-1.2.0_pre20050817 + /usr/include/zaptel)
# linux-2.6.12
# (zaptel-1.2.0_beta1)
pkg_setup() {
linux-mod_pkg_setup
local n
ewarn "****************************** WARNING! ******************************"
ewarn "* *"
ewarn "* ALPHA QUALITY EBUILD *"
ewarn "* *"
ewarn "* Sangoma drivers built with this ebuild are _completely_ untested! *"
ewarn "* (Due to lack of hardware and a T1/E1 line) *"
ewarn "* *"
ewarn "* There is no init script to setup the card(s) on startup! *"
ewarn "* *"
ewarn "* You have been warned! *"
ewarn "* - stkn *"
ewarn "****************************** WARNING! ******************************"
echo
ebeep
n=10
while [[ $n -gt 0 ]]; do
echo -en " Waiting $n seconds...\r"
sleep 1
(( n-- ))
done
}
src_unpack() {
local binobj
unpack ${A}
# Instead of patching stuff in /usr/src/linux, we'll
# copy all needed files to ${S_BUILD} and build everything
# there
# let's go...
cd ${S}
mkdir -p ${S_BUILD}/{src,include}
mkdir -p ${S_BUILD}/src/{mod,tmp}
ln -s ${S_BUILD}/src ${S_BUILD}/src/modinfo
ln -s ${S_BUILD}/src ${S_BUILD}/src/common
cp -dPR /usr/src/linux/drivers/net/wan/*.{c,h} ${S_BUILD}/src
cp -dPR /usr/src/linux/include/linux ${S_BUILD}/include
cp ${S}/patches/kdrivers/src/wanrouter/*.c ${S_BUILD}/src
cp ${S}/patches/kdrivers/src/wan_aften/*.c ${S_BUILD}/src
cp ${S}/patches/kdrivers/src/net/*.c ${S_BUILD}/src
cp ${S}/patches/kdrivers/include/*.h ${S_BUILD}/include/linux
sed -i -e "s:\(-I/usr/src/linux/include \):-I${S_BUILD}/include \1:g" \
-e "s:-I/usr/src/zaptel:-I/usr/include/zaptel:g" \
${S}/Makefile
#
# step 2: select the right binary modules and copy them
#
if [[ "$(gcc-major-version)" == "2" ]]; then
binobj="gcc2"
else
binobj="gcc3"
fi
binobj="${binobj}.$(uname -m)"
linux_chkconfig_present REGPARM \
&& binobj="${binobj}.regparm" \
cp patches/kdrivers/src/net/wanpipe_adsl.${binobj}.o ${S_BUILD}/src/wanpipe_adsl.o
cp patches/kdrivers/src/net/wanpipe_atm.${binobj}.o ${S_BUILD}/src/wanpipe_atm.o
# fix the makefile...
sed -i -e "s:../adsl/wanpipe_adsl.o:common/wanpipe_adsl.o:g" \
-e "s:../atm/wanpipe_atm.o:common/wanpipe_atm.o:g" \
${S}/Makefile
# these are needed too, wanpipe won't load otherwise
sed -i -e "s:^\(WANPIPE_FILE_LIST.*\):\1 sdla_edu.o sdla_bitstrm.o sdla_adccp.o sdla_sdlc.o sdla_mp_fr.o sdla_pos.o:" \
${S}/Makefile
# fix Makefile for amd64
use amd64 && \
sed -i -e "s:-march=\$(ARCH):-march=k8 -mcmodel=kernel:" \
-e "s:\(-mpreferred-stack-boundary\)=2:\1=4:" \
-e "s:^\(LD_ELF=\).*:\1-m elf_x86_64:" \
${S}/Makefile
# apply patch for gcc3.4 (todo: change path in patch to ${S}/...)
cd ${WORKDIR}
epatch ${FILESDIR}/${P}-gcc34.diff
}
src_compile() {
#
# well for the drivers, all that's left to do is:
#
cd ${S_BUILD}/src
make -f ${S}/Makefile || die "Error building drivers!"
#
# Build utilities
#
einfo "Building utils..."
cd ${S}/util
make \
SYSINC=${S_BUILD}/include \
PROTOCOL_DEFS=$(use adsl && echo "-DCONFIG_PRODUCT_WANPIPE_ADSL")
#
# Build WanCfg tool
#
einfo "Building WanCfg tool..."
make -C wancfg all \
SYSINC=${S_BUILD}/include
#
# Build misc utilities
#
einfo "Building misc utilities..."
make -C misc clean all \
SYSINC=${S_BUILD}/include
#
# Build API (for development)
#
# if ! use minimal; then
# einfo "Building development API..."
# cd ${S}/api
# make \
# SYSINC=${S_BUILD}/include
# else
# einfo "Skipping API build..."
# fi
}
src_install() {
#
# install kernel modules
#
insinto /lib/modules/${KV_FULL}/extra
doins ${S_BUILD}/src/mod/*.${KV_OBJ}
#
# install firmware
#
insinto /lib/firmware
doins firmware/*.sfm
#
# install tools
#
einfo "Installing utils..."
cd ${S}/util
make install \
WAN_VIRTUAL=${D}
einfo "Installing misc utilities..."
make -C misc install \
WAN_VIRTUAL=${D}
cd ${S}
#
# install config + scripts
#
# newconfd ${FILESDIR}/wanpipe.confd wanpipe
#
# finally install docs
#
dodoc doc/README* doc/ANNOUNCE doc/COPYING doc/LICENSE
dodoc doc/*.txt
insinto /usr/share/doc/${PF}
doins doc/*.pdf doc/*.sfm
}
|