Deleted media-libs/SoQt-1.4.1-r1: now in Portage.
[underlay.git] / net-wireless / wpa_supplicant / wpa_supplicant-0.6.9.ebuild
blob3b6aadf9851a7d1cfd2dc539e63445260916bc6b
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/wpa_supplicant-0.6.4.ebuild,v 1.1 2008/08/19 13:03:50 rbu Exp $
5 EAPI="2"
7 inherit eutils toolchain-funcs qt3 qt4
9 DESCRIPTION="IEEE 802.1X/WPA supplicant for secure wireless transfers"
10 HOMEPAGE="http://hostap.epitest.fi/wpa_supplicant/"
11 SRC_URI="http://hostap.epitest.fi/releases/${P}.tar.gz"
12 LICENSE="|| ( GPL-2 BSD )"
14 SLOT="0"
15 KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
16 IUSE="dbus debug gnutls gsm madwifi ps3 qt3 qt4 readline ssl kernel_linux kernel_FreeBSD"
18 DEPEND="dev-libs/libnl
19 dbus? ( sys-apps/dbus )
20 kernel_linux? (
21 gsm? ( sys-apps/pcsc-lite )
22 madwifi? ( ||
23 ( >net-wireless/madwifi-ng-tools-0.9.3
24 net-wireless/madwifi-old )
27 !kernel_linux? ( net-libs/libpcap )
28 qt4? ( x11-libs/qt-gui:4 )
29 !qt4? ( qt3? ( x11-libs/qt:3 ) )
30 readline? ( sys-libs/ncurses sys-libs/readline )
31 gnutls? ( net-libs/gnutls )
32 !gnutls? ( ssl? ( dev-libs/openssl ) )
33 !gnutls? ( !ssl? ( dev-libs/libtommath ) )"
34 RDEPEND="${DEPEND}"
36 S="${WORKDIR}/${P}/${PN}"
38 pkg_setup() {
39 if use gnutls && use ssl ; then
40 einfo "You have both 'gnutls' and 'ssl' USE flags enabled: defaulting to USE=\"gnutls\""
43 if use qt3 && use qt4 ; then
44 einfo "You have both 'qt3' and 'qt4' USE flags enabled: defaulting to USE=\"qt4\""
48 src_prepare() {
49 # net/bpf.h needed for net-libs/libpcap on Gentoo/FreeBSD
50 sed -i \
51 -e "s:\(#include <pcap\.h>\):#include <net/bpf.h>\n\1:" \
52 ../src/l2_packet/l2_packet_freebsd.c || die
54 # People seem to take the example configuration file too literally (bug #102361)
55 sed -i \
56 -e "s:^\(opensc_engine_path\):#\1:" \
57 -e "s:^\(pkcs11_engine_path\):#\1:" \
58 -e "s:^\(pkcs11_module_path\):#\1:" \
59 wpa_supplicant.conf || die
61 # Change configuration to match Gentoo locations (bug #143750)
62 sed -i \
63 -e "s:/usr/lib/opensc:/usr/$(get_libdir):" \
64 -e "s:/usr/lib/pkcs11:/usr/$(get_libdir):" \
65 wpa_supplicant.conf || die
68 src_configure() {
69 # Toolchain setup
70 echo "CC = $(tc-getCC)" > .config
72 # Basic setup
73 echo "CONFIG_CTRL_IFACE=y" >> .config
74 echo "CONFIG_BACKEND=file" >> .config
76 # Basic authentication methods
77 # NOTE: we don't set GPSK or SAKE as they conflict
78 # with the below options
79 echo "CONFIG_EAP_GTC=y" >> .config
80 echo "CONFIG_EAP_MD5=y" >> .config
81 echo "CONFIG_EAP_OTP=y" >> .config
82 echo "CONFIG_EAP_PAX=y" >> .config
83 echo "CONFIG_EAP_PSK=y" >> .config
84 echo "CONFIG_EAP_TLV=y" >> .config
85 echo "CONFIG_IEEE8021X_EAPOL=y" >> .config
86 echo "CONFIG_PKCS12=y" >> .config
87 echo "CONFIG_PEERKEY=y" >> .config
88 echo "CONFIG_EAP_LEAP=y" >> .config
89 echo "CONFIG_EAP_MSCHAPV2=y" >> .config
90 echo "CONFIG_EAP_PEAP=y" >> .config
91 echo "CONFIG_EAP_TLS=y" >> .config
92 echo "CONFIG_EAP_TTLS=y" >> .config
94 if use dbus ; then
95 echo "CONFIG_CTRL_IFACE_DBUS=y" >> .config
98 if use debug ; then
99 echo "CONFIG_DEBUG_FILE=y" >> .config
102 if use gsm ; then
103 # Smart card authentication
104 echo "CONFIG_EAP_SIM=y" >> .config
105 echo "CONFIG_EAP_AKA=y" >> .config
106 echo "CONFIG_EAP_AKA_PRIME=y" >> .config
107 echo "CONFIG_PCSC=y" >> .config
110 if use readline ; then
111 # readline/history support for wpa_cli
112 echo "CONFIG_READLINE=y" >> .config
115 # SSL authentication methods
116 if use gnutls ; then
117 echo "CONFIG_TLS=gnutls" >> .config
118 echo "CONFIG_GNUTLS_EXTRA=y" >> .config
119 elif use ssl ; then
120 echo "CONFIG_TLS=openssl" >> .config
121 echo "CONFIG_SMARTCARD=y" >> .config
122 else
123 echo "CONFIG_TLS=internal" >> .config
126 if use kernel_linux ; then
127 # Linux specific drivers
128 echo "CONFIG_DRIVER_ATMEL=y" >> .config
129 #echo "CONFIG_DRIVER_BROADCOM=y" >> .config
130 #echo "CONFIG_DRIVER_HERMES=y" >> .config
131 echo "CONFIG_DRIVER_HOSTAP=y" >> .config
132 echo "CONFIG_DRIVER_IPW=y" >> .config
133 echo "CONFIG_DRIVER_NDISWRAPPER=y" >> .config
134 echo "CONFIG_DRIVER_NL80211=y" >> .config
135 #echo "CONFIG_DRIVER_PRISM54=y" >> .config
136 echo "CONFIG_DRIVER_RALINK=y" >> .config
137 echo "CONFIG_DRIVER_WEXT=y" >> .config
138 echo "CONFIG_DRIVER_WIRED=y" >> .config
140 if use madwifi ; then
141 # Add include path for madwifi-driver headers
142 echo "CFLAGS += -I/usr/include/madwifi" >> .config
143 echo "CONFIG_DRIVER_MADWIFI=y" >> .config
146 if use ps3 ; then
147 echo "CONFIG_DRIVER_PS3=y" >> .config
150 elif use kernel_FreeBSD ; then
151 # FreeBSD specific driver
152 echo "CONFIG_DRIVER_BSD=y" >> .config
155 # Wi-Fi Protected Setup (WPS)
156 echo "CONFIG_WPS=y" >> .config
158 # Enable mitigation against certain attacks against TKIP
159 echo "CONFIG_DELAYED_MIC_ERROR_REPORT=y" >> .config
162 src_compile() {
163 emake || die "emake failed"
165 if use qt4 ; then
166 cd "${S}"/wpa_gui-qt4
167 eqmake4 wpa_gui.pro
168 emake || die "Qt4 wpa_gui compilation failed"
169 elif use qt3 ; then
170 cd "${S}"/wpa_gui
171 eqmake3 wpa_gui.pro
172 emake || die "Qt3 wpa_gui compilation failed"
176 src_install() {
177 dosbin wpa_supplicant || die
178 dobin wpa_cli wpa_passphrase || die
180 # baselayout-1 compat
181 dosym /usr/sbin/wpa_supplicant /sbin/wpa_supplicant || die
182 dosym /usr/bin/wpa_cli /bin/wpa_cli || die
184 exeinto /etc/wpa_supplicant/
185 newexe "${FILESDIR}"/wpa_cli.sh wpa_cli.sh
186 insinto /etc/wpa_supplicant/
187 newins "${FILESDIR}"/wpa_supplicant.conf wpa_supplicant.conf
189 dodoc ChangeLog {eap_testing,todo}.txt README{,-WPS} \
190 wpa_supplicant.conf || die "dodoc failed"
192 doman doc/docbook/*.{5,8} || die "doman failed"
194 if use qt4 ; then
195 into /usr
196 dobin wpa_gui-qt4/wpa_gui || die
197 elif use qt3 ; then
198 into /usr
199 dobin wpa_gui/wpa_gui || die
202 if use qt3 || use qt4 ; then
203 make_desktop_entry wpa_gui "WPA Supplicant Administration GUI" "wpa_gui" "Qt;Network;"
206 if use dbus ; then
207 insinto /etc/dbus-1/system.d
208 newins dbus-wpa_supplicant.conf wpa_supplicant.conf || die
209 insinto /usr/share/dbus-1/system-services
210 newins dbus-wpa_supplicant.service 'fi.epitest.hostap.WPASupplicant.service' || die
211 keepdir /var/run/wpa_supplicant
215 pkg_postinst() {
216 einfo "A default configuration file has been installed to"
217 einfo "/etc/wpa_supplicant/wpa_supplicant.conf"
218 einfo
219 einfo "An example configuration file is available in"
220 einfo "/usr/share/doc/${PF}/"
222 if [[ -e ${ROOT}etc/wpa_supplicant.conf ]] ; then
223 echo
224 ewarn "WARNING: your old configuration file ${ROOT}etc/wpa_supplicant.conf"
225 ewarn "needs to be moved to ${ROOT}etc/wpa_supplicant/wpa_supplicant.conf"
228 if use madwifi ; then
229 echo
230 einfo "This package compiles against the headers installed by"
231 einfo "madwifi-old, madwifi-ng or madwifi-ng-tools."
232 einfo "You should re-emerge ${PN} after upgrading these packages."