summaryrefslogtreecommitdiff
blob: 5f82a120d0bf7a5feb951f1d1c7fa7fe33d08924 (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit linux-mod

DESCRIPTION="Driver for the RaLink RT73/2571 wireless chipsets"
HOMEPAGE="http://www.ralink.com.tw/"
SRC_URI="http://www.ralink.com.tw/drivers/Linux/RT73_Linux_STA_Drv${PV}.tar.gz"

MY_P=RT73_Linux_STA_Drv${PV}

# May work on other little endien arches, e.g amd64
# Known broken on big endian arches
LICENSE="GPL-2"
KEYWORDS="~x86"
IUSE="debug"

RDEPEND="net-wireless/wireless-tools"
MODULE_NAMES="rt73(net:${S}/Module)"

S=${WORKDIR}/${MY_P}

CONFIG_CHECK="NET_RADIO"
ERROR_NET_RADIO="${P} requires support for Wireless LAN drivers (non-hamradio) & Wireless Extensions (CONFIG_NET_RADIO)."
MODULESD_RT73_ALIASES=('usbra? rt73')

pkg_setup() {
	linux-mod_pkg_setup
	BUILD_PARAMS="KERNDIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}"

}

src_unpack (){
	unpack ${A}
	cd "${S}/Module"

	# Portage expects to do make module, not make all
	# Only patch the makefile we are going to use

	# Makefile.4 - Makefile for kernel 2.4 series
	if kernel_is 2 4 ; then
		epatch "${FILESDIR}/make4.patch"
		cp Makefile.4 Makefile
	fi

	# Makefile.6 - Makefile for kernel 2.6 series
	if kernel_is 2 6 ; then
		epatch "${FILESDIR}/make6.patch"
		cp Makefile.6 Makefile
	fi
	if ! [ -f Makefile ]; then
		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.X"
		ewarn "this kernel version is not tested/supported"
		die
	fi

	# You can edit patch to also add your RT73 device if you are careful.
	epatch "${FILESDIR}/deviceID.patch"
}

src_compile() {
	use debug && export debug="y"
	linux-mod_src_compile
}

src_install() {
	linux-mod_src_install
	dodoc Module/README Module/iwpriv_usage.txt
	# The firmware install
	insinto /etc/Wireless/RT73STA
	doins Module/rt73.bin Module/rt73sta.dat
}

pkg_postinst() {
	linux-mod_pkg_postinst

	einfo
	einfo "Thanks to RaLink for releasing open drivers!"
	einfo
}