Gentoo Archives: gentoo-commits

From: Richard Farina <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-wireless/wpa_supplicant/
Date: Sun, 05 Aug 2018 16:04:15
Message-Id: 1533485040.f68a920c048a4f792997a28e5cb9e2cbcf055420.zerochaos@gentoo
1 commit: f68a920c048a4f792997a28e5cb9e2cbcf055420
2 Author: Zero_Chaos <zerochaos <AT> gentoo <DOT> org>
3 AuthorDate: Sun Aug 5 16:03:45 2018 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Sun Aug 5 16:04:00 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f68a920c
7
8 net-wireless/wpa_supplicant: rough live ebuild
9
10 you are welcome to test and report bugs, but you will likely get told
11 you get to keep the pieces
12
13 Package-Manager: Portage-2.3.44, Repoman-2.3.10
14
15 .../wpa_supplicant/wpa_supplicant-9999.ebuild | 454 +++++++++++++++++++++
16 1 file changed, 454 insertions(+)
17
18 diff --git a/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild b/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild
19 new file mode 100644
20 index 00000000000..5c5676770af
21 --- /dev/null
22 +++ b/net-wireless/wpa_supplicant/wpa_supplicant-9999.ebuild
23 @@ -0,0 +1,454 @@
24 +# Copyright 1999-2018 Gentoo Foundation
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=6
28 +
29 +inherit eutils qmake-utils systemd toolchain-funcs readme.gentoo-r1
30 +
31 +DESCRIPTION="IEEE 802.1X/WPA supplicant for secure wireless transfers"
32 +HOMEPAGE="https://w1.fi/wpa_supplicant/"
33 +LICENSE="|| ( GPL-2 BSD )"
34 +
35 +if [ "${PV}" = "9999" ]; then
36 + inherit git-r3
37 + EGIT_REPO_URI="https://w1.fi/hostap.git"
38 + KEYWORDS=""
39 +else
40 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
41 + SRC_URI="https://w1.fi/releases/${P}.tar.gz"
42 +fi
43 +
44 +SLOT="0"
45 +IUSE="ap bindist dbus eap-sim eapol_test fasteap gnutls +hs2-0 libressl p2p privsep ps3 qt5 readline selinux smartcard ssl suiteb tdls uncommon-eap-types wimax wps kernel_linux kernel_FreeBSD"
46 +REQUIRED_USE="smartcard? ( ssl )"
47 +
48 +CDEPEND="dbus? ( sys-apps/dbus )
49 + kernel_linux? (
50 + dev-libs/libnl:3
51 + net-wireless/crda
52 + eap-sim? ( sys-apps/pcsc-lite )
53 + )
54 + !kernel_linux? ( net-libs/libpcap )
55 + qt5? (
56 + dev-qt/qtcore:5
57 + dev-qt/qtgui:5
58 + dev-qt/qtsvg:5
59 + dev-qt/qtwidgets:5
60 + )
61 + readline? (
62 + sys-libs/ncurses:0=
63 + sys-libs/readline:0=
64 + )
65 + ssl? (
66 + gnutls? (
67 + dev-libs/libgcrypt:0=
68 + net-libs/gnutls:=
69 + )
70 + !gnutls? (
71 + !libressl? ( >=dev-libs/openssl-1.0.2k:0=[bindist=] )
72 + libressl? ( dev-libs/libressl:0= )
73 + )
74 + )
75 + !ssl? ( dev-libs/libtommath )
76 +"
77 +DEPEND="${CDEPEND}
78 + virtual/pkgconfig
79 +"
80 +RDEPEND="${CDEPEND}
81 + selinux? ( sec-policy/selinux-networkmanager )
82 +"
83 +
84 +DOC_CONTENTS="
85 + If this is a clean installation of wpa_supplicant, you
86 + have to create a configuration file named
87 + ${EROOT%/}/etc/wpa_supplicant/wpa_supplicant.conf
88 + An example configuration file is available for reference in
89 + ${EROOT%/}/usr/share/doc/${PF}/
90 +"
91 +
92 +S="${WORKDIR}/${P}/${PN}"
93 +
94 +Kconfig_style_config() {
95 + #param 1 is CONFIG_* item
96 + #param 2 is what to set it = to, defaulting in y
97 + CONFIG_PARAM="${CONFIG_HEADER:-CONFIG_}$1"
98 + setting="${2:-y}"
99 +
100 + if [ ! $setting = n ]; then
101 + #first remove any leading "# " if $2 is not n
102 + sed -i "/^# *$CONFIG_PARAM=/s/^# *//" .config || echo "Kconfig_style_config error uncommenting $CONFIG_PARAM"
103 + #set item = $setting (defaulting to y)
104 + sed -i "/^$CONFIG_PARAM/s/=.*/=$setting/" .config || echo "Kconfig_style_config error setting $CONFIG_PARAM=$setting"
105 + if [ -z "$( grep ^$CONFIG_PARAM= .config )" ] ; then
106 + echo "$CONFIG_PARAM=$setting" >>.config
107 + fi
108 + else
109 + #ensure item commented out
110 + sed -i "/^$CONFIG_PARAM/s/$CONFIG_PARAM/# $CONFIG_PARAM/" .config || echo "Kconfig_style_config error commenting $CONFIG_PARAM"
111 + fi
112 +}
113 +
114 +pkg_setup() {
115 + if use ssl ; then
116 + if use gnutls && use libressl ; then
117 + elog "You have both 'gnutls' and 'libressl' USE flags enabled: defaulting to USE=\"gnutls\""
118 + fi
119 + else
120 + elog "You have 'ssl' USE flag disabled: defaulting to internal TLS implementation"
121 + fi
122 +}
123 +
124 +src_prepare() {
125 + default
126 +
127 + # net/bpf.h needed for net-libs/libpcap on Gentoo/FreeBSD
128 + sed -i \
129 + -e "s:\(#include <pcap\.h>\):#include <net/bpf.h>\n\1:" \
130 + ../src/l2_packet/l2_packet_freebsd.c || die
131 +
132 + # People seem to take the example configuration file too literally (bug #102361)
133 + sed -i \
134 + -e "s:^\(opensc_engine_path\):#\1:" \
135 + -e "s:^\(pkcs11_engine_path\):#\1:" \
136 + -e "s:^\(pkcs11_module_path\):#\1:" \
137 + wpa_supplicant.conf || die
138 +
139 + # Change configuration to match Gentoo locations (bug #143750)
140 + sed -i \
141 + -e "s:/usr/lib/opensc:/usr/$(get_libdir):" \
142 + -e "s:/usr/lib/pkcs11:/usr/$(get_libdir):" \
143 + wpa_supplicant.conf || die
144 +
145 + # systemd entries to D-Bus service files (bug #372877)
146 + echo 'SystemdService=wpa_supplicant.service' \
147 + | tee -a dbus/*.service >/dev/null || die
148 +
149 + cd "${WORKDIR}/${P}" || die
150 +
151 + if use wimax; then
152 + # generate-libeap-peer.patch comes before
153 + # fix-undefined-reference-to-random_get_bytes.patch
154 + eapply "${FILESDIR}/${P}-generate-libeap-peer.patch"
155 +
156 + # multilib-strict fix (bug #373685)
157 + sed -e "s/\/usr\/lib/\/usr\/$(get_libdir)/" -i src/eap_peer/Makefile || die
158 + fi
159 +
160 + # bug (320097)
161 + #eapply "${FILESDIR}/${P}-do-not-call-dbus-functions-with-NULL-path.patch"
162 +
163 + # bug (596332 & 651314)
164 + #eapply "${FILESDIR}/${P}-libressl-compatibility.patch"
165 +
166 + # bug (640492)
167 + sed -i 's#-Werror ##' wpa_supplicant/Makefile || die
168 +}
169 +
170 +src_configure() {
171 + # Toolchain setup
172 + tc-export CC
173 +
174 + cp defconfig .config || die
175 +
176 + # Basic setup
177 + Kconfig_style_config CTRL_IFACE
178 + Kconfig_style_config MATCH_IFACE
179 + Kconfig_style_config BACKEND file
180 + Kconfig_style_config IBSS_RSN
181 + Kconfig_style_config IEEE80211W
182 + Kconfig_style_config IEEE80211R
183 +
184 + # Basic authentication methods
185 + # NOTE: we don't set GPSK or SAKE as they conflict
186 + # with the below options
187 + Kconfig_style_config EAP_GTC
188 + Kconfig_style_config EAP_MD5
189 + Kconfig_style_config EAP_OTP
190 + Kconfig_style_config EAP_PAX
191 + Kconfig_style_config EAP_PSK
192 + Kconfig_style_config EAP_TLV
193 + Kconfig_style_config EAP_EXE
194 + Kconfig_style_config IEEE8021X_EAPOL
195 + Kconfig_style_config PKCS12
196 + Kconfig_style_config PEERKEY
197 + Kconfig_style_config EAP_LEAP
198 + Kconfig_style_config EAP_MSCHAPV2
199 + Kconfig_style_config EAP_PEAP
200 + Kconfig_style_config EAP_TLS
201 + Kconfig_style_config EAP_TTLS
202 +
203 + # Enabling background scanning.
204 + Kconfig_style_config BGSCAN_SIMPLE
205 + Kconfig_style_config BGSCAN_LEARN
206 +
207 + if use dbus ; then
208 + Kconfig_style_config CTRL_IFACE_DBUS
209 + Kconfig_style_config CTRL_IFACE_DBUS_NEW
210 + Kconfig_style_config CTRL_IFACE_DBUS_INTRO
211 + fi
212 +
213 + if use eapol_test ; then
214 + Kconfig_style_config EAPOL_TEST
215 + fi
216 +
217 + # Enable support for writing debug info to a log file and syslog.
218 + Kconfig_style_config DEBUG_FILE
219 + Kconfig_style_config DEBUG_SYSLOG
220 +
221 + if use hs2-0 ; then
222 + Kconfig_style_config INTERWORKING
223 + Kconfig_style_config HS20
224 + fi
225 +
226 + if use uncommon-eap-types; then
227 + Kconfig_style_config EAP_GPSK
228 + Kconfig_style_config EAP_SAKE
229 + Kconfig_style_config EAP_GPSK_SHA256
230 + Kconfig_style_config EAP_IKEV2
231 + Kconfig_style_config EAP_EKE
232 + fi
233 +
234 + if use eap-sim ; then
235 + # Smart card authentication
236 + Kconfig_style_config EAP_SIM
237 + Kconfig_style_config EAP_AKA
238 + Kconfig_style_config EAP_AKA_PRIME
239 + Kconfig_style_config PCSC
240 + fi
241 +
242 + if use fasteap ; then
243 + Kconfig_style_config EAP_FAST
244 + fi
245 +
246 + if use readline ; then
247 + # readline/history support for wpa_cli
248 + Kconfig_style_config READLINE
249 + else
250 + #internal line edit mode for wpa_cli
251 + Kconfig_style_config WPA_CLI_EDIT
252 + fi
253 +
254 + if use suiteb; then
255 + Kconfig_style_config SUITEB
256 + fi
257 +
258 + # SSL authentication methods
259 + if use ssl ; then
260 + if use gnutls ; then
261 + Kconfig_style_config TLS gnutls
262 + Kconfig_style_config GNUTLS_EXTRA
263 + else
264 + #this fails for gnutls
265 + Kconfig_style_config SUITEB192
266 + Kconfig_style_config TLS openssl
267 + if ! use bindist; then
268 + #this fails for gnutls
269 + Kconfig_style_config EAP_PWD
270 + # SAE fails on gnutls and everything below here needs SAE
271 + # Enabling mesh networks.
272 + Kconfig_style_config MESH
273 + #WPA3
274 + Kconfig_style_config OWE
275 + Kconfig_style_config SAE
276 + #we also need to disable FILS, except that isn't enabled yet
277 + fi
278 +
279 + fi
280 + else
281 + Kconfig_style_config TLS internal
282 + fi
283 +
284 + if use smartcard ; then
285 + Kconfig_style_config SMARTCARD
286 + fi
287 +
288 + if use tdls ; then
289 + Kconfig_style_config TDLS
290 + fi
291 +
292 + if use kernel_linux ; then
293 + # Linux specific drivers
294 + Kconfig_style_config DRIVER_ATMEL
295 + Kconfig_style_config DRIVER_HOSTAP
296 + Kconfig_style_config DRIVER_IPW
297 + Kconfig_style_config DRIVER_NL80211
298 + Kconfig_style_config DRIVER_RALINK
299 + Kconfig_style_config DRIVER_WEXT
300 + Kconfig_style_config DRIVER_WIRED
301 +
302 + if use ps3 ; then
303 + Kconfig_style_config DRIVER_PS3
304 + fi
305 +
306 + elif use kernel_FreeBSD ; then
307 + # FreeBSD specific driver
308 + Kconfig_style_config DRIVER_BSD
309 + fi
310 +
311 + # Wi-Fi Protected Setup (WPS)
312 + if use wps ; then
313 + Kconfig_style_config WPS
314 + Kconfig_style_config WPS2
315 + # USB Flash Drive
316 + Kconfig_style_config WPS_UFD
317 + # External Registrar
318 + Kconfig_style_config WPS_ER
319 + # Universal Plug'n'Play
320 + Kconfig_style_config WPS_UPNP
321 + # Near Field Communication
322 + Kconfig_style_config WPS_NFC
323 + fi
324 +
325 + # Wi-Fi Direct (WiDi)
326 + if use p2p ; then
327 + Kconfig_style_config P2P
328 + Kconfig_style_config WIFI_DISPLAY
329 + fi
330 +
331 + # Access Point Mode
332 + if use ap ; then
333 + Kconfig_style_config AP
334 + fi
335 +
336 + # Enable essentials for AP/P2P
337 + if use ap || use p2p ; then
338 + # Enabling HT support (802.11n)
339 + Kconfig_style_config IEEE80211N
340 +
341 + # Enabling VHT support (802.11ac)
342 + Kconfig_style_config IEEE80211AC
343 + fi
344 +
345 + # Enable mitigation against certain attacks against TKIP
346 + Kconfig_style_config DELAYED_MIC_ERROR_REPORT
347 +
348 + if use privsep ; then
349 + Kconfig_style_config PRIVSEP
350 + fi
351 +
352 + # If we are using libnl 2.0 and above, enable support for it
353 + # Bug 382159
354 + # Removed for now, since the 3.2 version is broken, and we don't
355 + # support it.
356 + if has_version ">=dev-libs/libnl-3.2"; then
357 + Kconfig_style_config LIBNL32
358 + fi
359 +
360 + if use qt5 ; then
361 + pushd "${S}"/wpa_gui-qt4 > /dev/null || die
362 + eqmake5 wpa_gui.pro
363 + popd > /dev/null || die
364 + fi
365 +}
366 +
367 +src_compile() {
368 + einfo "Building wpa_supplicant"
369 + emake V=1 BINDIR=/usr/sbin
370 +
371 + if use wimax; then
372 + emake -C ../src/eap_peer clean
373 + emake -C ../src/eap_peer
374 + fi
375 +
376 + if use qt5; then
377 + einfo "Building wpa_gui"
378 + emake -C "${S}"/wpa_gui-qt4
379 + fi
380 +
381 + if use eapol_test ; then
382 + emake eapol_test
383 + fi
384 +}
385 +
386 +src_install() {
387 + dosbin wpa_supplicant
388 + use privsep && dosbin wpa_priv
389 + dobin wpa_cli wpa_passphrase
390 +
391 + # baselayout-1 compat
392 + if has_version "<sys-apps/baselayout-2.0.0"; then
393 + dodir /sbin
394 + dosym ../usr/sbin/wpa_supplicant /sbin/wpa_supplicant
395 + dodir /bin
396 + dosym ../usr/bin/wpa_cli /bin/wpa_cli
397 + fi
398 +
399 + if has_version ">=sys-apps/openrc-0.5.0"; then
400 + newinitd "${FILESDIR}/${PN}-init.d" wpa_supplicant
401 + newconfd "${FILESDIR}/${PN}-conf.d" wpa_supplicant
402 + fi
403 +
404 + exeinto /etc/wpa_supplicant/
405 + newexe "${FILESDIR}/wpa_cli.sh" wpa_cli.sh
406 +
407 + readme.gentoo_create_doc
408 + dodoc ChangeLog {eap_testing,todo}.txt README{,-WPS} \
409 + wpa_supplicant.conf
410 +
411 + newdoc .config build-config
412 +
413 + #doman doc/docbook/*.{5,8}
414 +
415 + if use qt5 ; then
416 + into /usr
417 + dobin wpa_gui-qt4/wpa_gui
418 + doicon wpa_gui-qt4/icons/wpa_gui.svg
419 + make_desktop_entry wpa_gui "WPA Supplicant Administration GUI" "wpa_gui" "Qt;Network;"
420 + else
421 + rm "${ED}"/usr/share/man/man8/wpa_gui.8
422 + fi
423 +
424 + use wimax && emake DESTDIR="${D}" -C ../src/eap_peer install
425 +
426 + if use dbus ; then
427 + pushd "${S}"/dbus > /dev/null || die
428 + insinto /etc/dbus-1/system.d
429 + newins dbus-wpa_supplicant.conf wpa_supplicant.conf
430 + insinto /usr/share/dbus-1/system-services
431 + doins fi.epitest.hostap.WPASupplicant.service fi.w1.wpa_supplicant1.service
432 + popd > /dev/null || die
433 +
434 + # This unit relies on dbus support, bug 538600.
435 + systemd_dounit systemd/wpa_supplicant.service
436 + fi
437 +
438 + if use eapol_test ; then
439 + dobin eapol_test
440 + fi
441 +
442 + systemd_dounit "systemd/wpa_supplicant@.service"
443 + systemd_dounit "systemd/wpa_supplicant-nl80211@.service"
444 + systemd_dounit "systemd/wpa_supplicant-wired@.service"
445 +}
446 +
447 +pkg_postinst() {
448 + readme.gentoo_print_elog
449 +
450 + if [[ -e "${EROOT%/}"/etc/wpa_supplicant.conf ]] ; then
451 + echo
452 + ewarn "WARNING: your old configuration file ${EROOT%/}/etc/wpa_supplicant.conf"
453 + ewarn "needs to be moved to ${EROOT%/}/etc/wpa_supplicant/wpa_supplicant.conf"
454 + fi
455 +
456 + if use bindist || use gnutls; then
457 + if ! use libressl; then
458 + ewarn "Using bindist or gnutls use flags presently breaks WPA3 (specifically SAE and OWE)."
459 + ewarn "This is incredibly undesirable"
460 + fi
461 + fi
462 +
463 + # Mea culpa, feel free to remove that after some time --mgorny.
464 + local fn
465 + for fn in wpa_supplicant{,@wlan0}.service; do
466 + if [[ -e "${EROOT%/}"/etc/systemd/system/network.target.wants/${fn} ]]
467 + then
468 + ebegin "Moving ${fn} to multi-user.target"
469 + mv "${EROOT%/}"/etc/systemd/system/network.target.wants/${fn} \
470 + "${EROOT%/}"/etc/systemd/system/multi-user.target.wants/ || die
471 + eend ${?} \
472 + "Please try to re-enable ${fn}"
473 + fi
474 + done
475 +
476 + systemd_reenable wpa_supplicant.service
477 +}