summaryrefslogtreecommitdiff
blob: 9efa19ff65488ea15d80d3da82ee1aa6ca09a7af (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
# This ebuild is intended for macbook pro users.

inherit linux-mod subversion flag-o-matic

ESVN_REPO_URI="http://svn.madwifi.org/trunk/"
ESVN_UPDATE_CMD="svn -r ${PV} update"
ESVN_PROJECT="madwifi-ng"

DESCRIPTION="Wireless-ng driver for Atheros chipset a/b/g cards"
HOMEPAGE="http://www.madwifi.org/"
LICENSE="GPL-2"
KEYWORDS="~x86 ~amd64"
IUSE=""
DEPEND="app-arch/sharutils"
RDEPEND=""
S=${WORKDIR}/madwifi

CONFIG_CHECK="CRYPTO SYSCTL"
ERROR_CRYPTO="${P} requires Cryptographic API support (CONFIG_CRYPTO)."
ERROR_SYSCTL="${P} requires Sysctl support (CONFIG_SYSCTL)."

pkg_setup() {

	if ! ( kernel_is 2 6 22 ); then
		die "This only works on 2.6.22 kernels"
	fi

	linux-mod_pkg_setup

	use x86 && ARCH=i386
	use amd64 && ARCH=x86_64
	MODULE_NAMES="ath_hal(net:${S}/ath_hal)
		wlan(net:${S}/net80211)
		wlan_acl(net:${S}/net80211)
		wlan_ccmp(net:${S}/net80211)
		wlan_tkip(net:${S}/net80211)
		wlan_wep(net:${S}/net80211)
		wlan_xauth(net:${S}/net80211)
		wlan_scan_sta(net:${S}/net80211)
		wlan_scan_ap(net:${S}/net80211)
		ath_rate_amrr(net:${S}/ath_rate/amrr)
		ath_rate_onoe(net:${S}/ath_rate/onoe)
		ath_rate_sample(net:${S}/ath_rate/sample)
		ath_rate_minstrel(net:${S}/ath_rate/minstrel)
		ath_pci(net:${S}/ath)"
	BUILD_PARAMS="KERNELPATH=${ROOT}${KV_OUT_DIR} KERNELRELEASE=${KV_FULL}
		ARCH=${ARCH} TOOLPREFIX=/usr/bin/"
	BUILD_TARGETS="all"
}

src_unpack() {
	subversion_src_unpack

	epatch ${FILESDIR}/madwifi-ng-0.9.3-uudecode-gcda-fix.patch

	for dir in ath ath_hal net80211 ath_rate/amrr ath_rate/onoe ath_rate/sample ath_rate/minstrel
	do
		convert_to_m ${S}/${dir}/Makefile
	done

	cp ${FILESDIR}/svnversion.h ${S}
}

src_compile() {
	emake DESTDIR="${D}"|| die "emake failed"
}

src_install() {
	linux-mod_src_install

	cd ${S}

	dodoc README COPYRIGHT

# install headers for use by
# net-wireless/wpa_supplicant and net-wireless/hostapd
	insinto /usr/include/madwifi/include/
	doins ${S}/include/*.h
	insinto /usr/include/madwifi/include/sys/
	doins ${S}/include/sys/*.h
	insinto /usr/include/madwifi/net80211
	doins ${S}/net80211/*.h

	cd ${S}/tools
	make install DESTDIR=${D} BINDIR=/sbin
}

pkg_postinst() {
	linux-mod_pkg_postinst
	einfo ""
	einfo "The madwifi drivers create an interface named 'wifiX'"
	einfo ""
}