# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
##Stable
MY_P=${P/_rc/-rc}
SRC_URI="http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.31/${MY_P}.tar.bz2"
##Dailies
#MY_P=${P//./-}
#SRC_URI="http://wireless.kernel.org/download/compat-wireless-2.6/${MY_P}.tar.bz2"
inherit linux-mod linux-info
DEPEND=""
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="kernel_linux +injection"
S=${WORKDIR}/${MY_P}
CONFIG_CHECK="!DYNAMIC_FTRACE"
RESTRICT="strip"
BUILD_TARGETS="all"
MODULES_NAMES="mac80211(updates/net/mac80211/:${S}/net/mac80211:${S}/net/mac80211
cfg80211(updates/net/wireless/:${S}/net/wireless/:${S}/net/wireless"
# @$(MODPROBE) -l lib80211
# @$(MODPROBE) -l adm8211
# @$(MODPROBE) -l ar9170usb
# @$(MODPROBE) -l at76c50x-usb
# @$(MODPROBE) -l ath
# @$(MODPROBE) -l ath5k
# @$(MODPROBE) -l ath9k
# @$(MODPROBE) -l b43
# @$(MODPROBE) -l b43legacy
# @$(MODPROBE) -l b44
# @$(MODPROBE) -l cdc_ether
# @$(MODPROBE) -l eeprom_93cx6
# @$(MODPROBE) -l ipw2100
# @$(MODPROBE) -l ipw2200
# @$(MODPROBE) -l iwl3945
# @$(MODPROBE) -l iwlagn
# @$(MODPROBE) -l iwlcore
# @$(MODPROBE) -l lib80211_crypt_ccmp
# @$(MODPROBE) -l lib80211_crypt_tkip
# @$(MODPROBE) -l lib80211_crypt_wep
# @$(MODPROBE) -l libertas
# @$(MODPROBE) -l libertas_cs
# @$(MODPROBE) -l libertas_sdio
# @$(MODPROBE) -l libertas_spi
# @$(MODPROBE) -l libertas_tf
# @$(MODPROBE) -l libertas_tf_usb
# @$(MODPROBE) -l libipw
# @$(MODPROBE) -l mac80211_hwsim
# @$(MODPROBE) -l mwl8k
# @$(MODPROBE) -l p54common
# @$(MODPROBE) -l p54pci
# @$(MODPROBE) -l p54spi
# @$(MODPROBE) -l p54usb
# @$(MODPROBE) -l rndis_host
# @$(MODPROBE) -l rndis_wlan
# @$(MODPROBE) -l rt2400pci
# @$(MODPROBE) -l rt2500pci
# @$(MODPROBE) -l rt2500usb
# @$(MODPROBE) -l rt2x00lib
# @$(MODPROBE) -l rt2x00pci
# @$(MODPROBE) -l rt2x00usb
# @$(MODPROBE) -l rt61pci
# @$(MODPROBE) -l rt73usb
# @$(MODPROBE) -l rtl8180
# @$(MODPROBE) -l rtl8187
# @$(MODPROBE) -l ssb
# @$(MODPROBE) -l usb8xxx
# @$(MODPROBE) -l usbnet
# @$(MODPROBE) -l zd1211rw
##Adding the following for reference only while writing, remove after it works (the right way)
# The structure of each MODULE_NAMES entry is as follows:
#
# modulename(libdir:srcdir:objdir)
#
# where:
#
# modulename = name of the module file excluding the .ko
# libdir = place in system modules directory where module is installed (by default it's misc)
# srcdir = place for ebuild to cd to before running make (by default it's ${S})
# objdir = place the .ko and objects are located after make runs (by default it's set to srcdir)
#
# To get an idea of how these variables are used, here's a few lines
# of code from around line 540 in this eclass:
#
# einfo "Installing ${modulename} module"
# cd ${objdir} || die "${objdir} does not exist"
# insinto /lib/modules/${KV_FULL}/${libdir}
# doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
#
# For example:
# MODULE_NAMES="module_pci(pci:${S}/pci:${S}) module_usb(usb:${S}/usb:${S})"
#
# what this would do is
#
# cd "${S}"/pci
# make ${BUILD_PARAMS} ${BUILD_TARGETS}
# cd "${S}"
# insinto /lib/modules/${KV_FULL}/pci
# doins module_pci.${KV_OBJ}
##remove the proceeding after this works "the gentoo way"
pkg_setup() {
linux-mod_pkg_setup
linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
}
src_compile() {
# if use injection; then epatch "${FILESDIR}"/400[024]_*.patch; fi
# if use injection; then epatch "${FILESDIR}"/4012_*.patch; fi
if use injection; then einfo "injection use flag is temporarily disabled, sorry about your luck"; fi
# epatch "${FILESDIR}"/whynot.patch
# epatch "${FILESDIR}"/rtl8187-led-blink_possibly-final.patch
# addpredict "${KERNEL_DIR}"
# addpredict /lib/modules/"${KV_FULL}"
# use amd64 && export ARCH="x86_64"
# use x86 && export ARCH="x86"
linux-mod_src_compile
}
src_install() {
linux-mod_src_install
dodoc README || die
}
pkg_postinst() {
linux-mod_pkg_postinst
update_depmod
}