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

inherit eutils linux-mod

DESCRIPTION="Intel (R) PRO/Wireless 3945ABG Network Connection"
HOMEPAGE="http://intellinuxwireless.org/?p=iwlwifi"
SRC_URI="http://intellinuxwireless.org/${PN}/downloads/${P}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="iwl3945 iwl4965"

DEPEND="|| ( >=virtual/linux-sources-2.6.22_rc1 net-wireless/mac80211 )"
RDEPEND="iwl3945? ( net-wireless/iwlwifi3945-ucode )
	iwl4965? ( net-wireless/iwlwifi4965-ucode )
	!iwl3945? ( !iwl4965? ( net-wireless/iwlwifi3945-ucode net-wireless/iwlwifi4965-ucode ) )"

S="${WORKDIR}/${P}/compatible"

#MODULE_NAMES="iwl3945(net/wireless)"
BUILD_TARGETS="modules"

pkg_setup() {
	if kernel_is ge 2 6 22 ; then
		if has_version net-wireless/mac80211 ; then
			CONFIG_CHECK="!MAC80211"
			ERROR_MAC80211="MAC80211 support already enabled in kernel. Unmerge net-wireless/mac80211 or disable MAC80211 in kernel."
			MY_INCLUDE="/usr/include/mac80211"
			MY_HEADERS="MAC80211_INC=/usr/include/mac80211/net/"
		else
			CONFIG_CHECK="MAC80211"
			ERROR_MAC80211="MAC80211 support disabled in kernel. Emerge net-wireless/mac80211 or enable MAC80211 in kernel."
			MY_INCLUDE="/usr/src/linux/"
			MY_HEADERS=""
		fi
	elif has_version net-wireless/mac80211 ; then
			MY_INCLUDE="/usr/include/mac80211"
			MY_HEADERS="MAC80211_INC=/usr/include/mac80211/net/"
	else
			eerror "This ebuild requires kernel >=2.6.22_rc1."
			die "Set your /usr/src/linux symlink accordingly."
	fi

	MODULE_NAMES=""
	if use iwl3945; then
		MODULE_NAMES="iwl3945(net/wireless)"
	fi
	if use iwl4965; then
		MODULE_NAMES="${MODULE_NAMES} iwl4965(net/wireless)"
	fi
	if ! use iwl3945 && ! use iwl4965; then
		MODULE_NAMES="iwl3945(net/wireless) iwl4965(net/wireless)"
	fi
	echo ${MODULE_NAMES}

	linux-mod_pkg_setup
	BUILD_PARAMS="-C ${KV_DIR} M=${S}"
	if use iwl3945; then
		BUILD_PARAMS="${BUILD_PARAMS} CONFIG_IWL3945=m"
        fi
        if use iwl4965; then
		BUILD_PARAMS="${BUILD_PARAMS} CONFIG_IWL4965=m"
        fi
	if ! use iwl3945 && ! use iwl4965; then
		BUILD_PARAMS="${BUILD_PARAMS} CONFIG_IWL3945=m CONFIG_IWL4965=m"
	fi
	echo ${BUILD_PARAMS}
}

src_unpack() {
	unpack ${A}
	cd "${WORKDIR}/${P}"
	sed -i -e 's/\(.*chmod\)/#\1/' Makefile
	make compatible/kversion KSRC="${KV_DIR}" \
		${MY_HEADERS} || die "make unmodified failed"
	sed -i -e 's%\.\./\(net/mac80211/\)%\1%' "${S}"/*.c "${S}"/*.h
	echo "CFLAGS += -I${MY_INCLUDE} -DCONFIG_IWLWIFI_DEBUG=y" \
		"-DCONFIG_IWLWIFI_SPECTRUM_MEASUREMENT=y" >> "${S}"/Makefile
}