summaryrefslogtreecommitdiff
blob: a01846dfa1f4c4ef2f1a4aaeae2f785040970969 (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
119
120
121
122
123
124
125
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostap/hostap-0.0.4.ebuild,v 1.2 2003/09/07 00:19:18 msterret Exp $

inherit eutils

DESCRIPTION="HostAP wireless drivers"
HOMEPAGE="http://hostap.epitest.fi/"

MY_PCMCIA="pcmcia-cs-3.2.1"
PATCH_3_2_2="${MY_PCMCIA}-3.2.2.diff.gz"
PATCH_3_2_3="${MY_PCMCIA}-3.2.3.diff.gz"
PATCH_3_2_4="${MY_PCMCIA}-3.2.4.diff.gz"

SRC_URI="http://hostap.epitest.fi/releases/${P}.tar.gz
		pcmcia? ( mirror://sourceforge/pcmcia-cs/${MY_PCMCIA}.tar.gz )
		pcmcia? ( mirror://gentoo/${PATCH_3_2_2} )
		pcmcia? ( mirror://gentoo/${PATCH_3_2_3} )
		pcmcia? ( mirror://gentoo/${PATCH_3_2_4} )"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"

IUSE="pcmcia hostap-nopci hostap-noplx"

DEPEND=">=net-wireless/wireless-tools-25
		pcmcia? ( >=sys-apps/pcmcia-cs-3.2.1* )"

LIB_PATH="/lib/modules/${KV}"

src_unpack() {
	check_KV
	unpack ${P}.tar.gz

	if [ -n "`use pcmcia`" ]; then
		unpack ${MY_PCMCIA}.tar.gz
		cd ${WORKDIR}/${MY_PCMCIA}
		if [ -z "`has_version =sys-apps/pcmcia-cs-3.2.4*`" ]; then
			epatch ${DISTDIR}/${PATCH_3_2_4}
		elif [ -z "`has_version =sys-apps/pcmcia-cs-3.2.3*`" ]; then
			epatch ${DISTDIR}/${PATCH_3_2_3}
		elif [ -z "`has_version =sys-apps/pcmcia-cs-3.2.2*`" ]; then
			epatch ${DISTDIR}/${PATCH_3_2_2}
		fi
	fi


	cd ${S}
	mv Makefile ${T}
	sed -e "s:gcc:${CC}:" \
		-e "s:-O2:${CFLAGS}:" \
		-e "s:\$(EXTRA_CFLAGS):\$(EXTRA_CFLAGS) -DPRISM2_HOSTAPD:" \
		${T}/Makefile > Makefile

	if [ -n "`use pcmcia`" ] || [[ "${HOSTAP_DRIVERS}" == *pccard* ]]; then
		mv Makefile ${T}
		sed -e "s:^PCMCIA_PATH=:PCMCIA_PATH=${WORKDIR}/${MY_PCMCIA}:" \
			${T}/Makefile > Makefile
	fi

	cd ${S}/hostapd
	mv Makefile ${T}
	sed -e "s:gcc:${CC}:" \
		-e "s:-O2:${CFLAGS}:" \
		${T}/Makefile > Makefile
}

src_compile() {

	local mydrivers

	use pcmcia && mydrivers="${mydrivers} pccard"
	use hostap-nopci || mydrivers="${mydrivers} pci"
	use hostap-noplx || mydrivers="${mydrivers} plx"

	# Build the drivers
	einfo "Building the folowing drivers: ${mydrivers}"
	emake ${mydrivers} || die

	# Make the hostapd daemon
	cd ${S}/hostapd
	emake || die

	# Make the little wlansniff utility
	cd ${S}/sniff
	emake || die
}

src_install() {
	dodir ${LIB_PATH}/net
	cp ${S}/driver/modules/{hostap.o,hostap_crypt.o,hostap_crypt_wep.o}\
		${D}${LIB_PATH}/net/

	if [ -n "`use pcmcia`" ]; then
		dodir ${LIB_PATH}/pcmcia
		dodir /etc/pcmcia
		cp ${S}/driver/modules/hostap_cs.o ${D}/${LIB_PATH}/pcmcia/
		cp ${S}/driver/etc/hostap_cs.conf ${D}/etc/pcmcia/
		if [ -r /etc/pcmcia/prism2.conf ]; then
			einfo "You may need to edit or remove /etc/pcmcia/prism2.conf"
			einfo "This is usually a result of conflicts with the"
			einfo "linux-wlan-ng drivers."
		fi
	fi

	if [ -z "`use hostap-nopci`" ]; then
		cp ${S}/driver/modules/hostap_pci.o\
			${D}${LIB_PATH}/net/
	fi

	if [ -z "`use hostap-noplx`" ]; then
		cp ${S}/driver/modules/hostap_plx.o\
			${D}${LIB_PATH}/net/
	fi

	dodoc FAQ README driver_source.txt ChangeLog

	dosbin hostapd/hostapd
	dosbin sniff/wlansniff
	newdoc sniff/README README.wlansniff
}
pkg_postinst(){
	/sbin/depmod -a
}