blob: 7931dc630c769b2a72708a4f6facec40cddba4b7 (
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
|
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit linux-mod eutils flag-o-matic
HPEC_VERSION="9.00.007"
MY_P="${P/dahdi/dahdi-linux}"
MY_S="${WORKDIR}/${MY_P}"
DESCRIPTION="Kernel modules for Digium compatible hardware (formerly known as Zaptel)."
HOMEPAGE="http://www.asterisk.org"
SRC_URI="http://downloads.digium.com/pub/telephony/dahdi-linux/releases/${MY_P}.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-064-1.05.01.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-128-1.05.01.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-tc400m-MR6.12.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-vpmadt032-1.07.tar.gz"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="echpec"
DEPEND=""
RDEPEND=""
QA_EXECSTACK="opt/bin/dahdihpec_register opt/bin/dahdihpec_enable"
hpec_detect() {
if [ "$(tc-arch)" == "x86" ]; then
HPEC_ARCH="32"
HPEC_CPU="i386"
return
fi
if [ "$(tc-arch)" == "amd64" ]; then
HPEC_ARCH="64"
HPEC_CPU="opteron"
if grep -q "GenuineIntel" /proc/cpuinfo; then HPEC_CPU="nocona"; fi
return
fi
die "HPEC is not available for your architecture, please remove the 'echpec' USE flag and retry."
}
src_unpack() {
unpack ${A}
# fix udev rules to work with both asterisk and callweaver
sed -i 's/GROUP="asterisk"/GROUP="dialout"/' "${MY_S}"/build_tools/genudevrules
# copy the firmware files to the correct location
for file in ${A} ; do
cp "${DISTDIR}"/${file} "${MY_P}"/drivers/dahdi/firmware/
done
cp *bin "${MY_P}"/drivers/dahdi/firmware/
cd "${MY_P}"
epatch "${FILESDIR}"/${P}-install.patch
# prepare hpec
if use echpec; then
elog "Support for commercial HPEC echo canceller."
hpec_detect
cd "${MY_S}"/drivers/dahdi/hpec
wget -O hpec.tgz \
"http://downloads.digium.com/pub/telephony/hpec/${HPEC_ARCH}-bit/hpec-${HPEC_VERSION}-${HPEC_CPU}.tar.gz" \
|| die "HPEC download failed"
tar xzf hpec.tgz
fi
}
src_compile() {
cd "${MY_P}"
unset ARCH
emake KSRC="${KERNEL_DIR}" DESTDIR="${D}" modules || die "failed to build module"
# download hpec utils
if use echpec; then
cd "${S}"
wget -O dahdihpec_register "http://downloads.digium.com/pub/register/x86-${HPEC_ARCH}/register"
wget -O dahdihpec_enable "http://downloads.digium.com/pub/telephony/hpec/${HPEC_ARCH}-bit/dahdihpec_enable"
fi
}
src_install() {
cd "${MY_P}"
# setup directory structure so udev rules get installed
mkdir -p "${D}"/etc/udev/rules.d
einfo "Installing kernel module"
emake KSRC="${KERNEL_DIR}" DESTDIR="${D}" install || die "failed to install module"
rm -rf "$D"/lib/modules/*/modules.*
# install hpec utils
if use echpec; then
cd "${S}"
diropts -o root -g root -m 0744
dodir /opt/bin
insinto /opt/bin
insopts -o root -g root -m 0700
doins dahdihpec_register || die "installing dahdihpec_register failed"
doins dahdihpec_enable || die "installing dahdihpec_enable failed"
fi
}
src_postinst() {
# instructions for hpec
if use echpec; then
elog "HPEC is a commercial echo canceller. If you have purchased telephony"
elog "hardware from Digium, you might be eligible for a free HPEC license:"
elog "http://www.digium.com/en/products/software/hpec.php"
elog ""
elog "HPEC has to be registered once with 'dahdihpec_register' and then enabled"
elog "with 'dahdihpec_enable' every time the DAHDI drivers are loaded. The DAHDI"
elog "init script does so implicitly."
fi
}
|