xref: /OK3568_Linux_fs/buildroot/package/wpa_supplicant/wpa_supplicant.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# wpa_supplicant
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunWPA_SUPPLICANT_VERSION = 2.9
8*4882a593SmuzhiyunWPA_SUPPLICANT_SITE = http://w1.fi/releases
9*4882a593SmuzhiyunWPA_SUPPLICANT_PATCH = \
10*4882a593Smuzhiyun	https://w1.fi/security/2020-2/0001-P2P-Fix-copying-of-secondary-device-types-for-P2P-gr.patch \
11*4882a593Smuzhiyun	https://w1.fi/security/2021-1/0001-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch
12*4882a593SmuzhiyunWPA_SUPPLICANT_LICENSE = BSD-3-Clause
13*4882a593SmuzhiyunWPA_SUPPLICANT_LICENSE_FILES = README
14*4882a593SmuzhiyunWPA_SUPPLICANT_CPE_ID_VENDOR = w1.fi
15*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG = $(WPA_SUPPLICANT_DIR)/wpa_supplicant/.config
16*4882a593SmuzhiyunWPA_SUPPLICANT_SUBDIR = wpa_supplicant
17*4882a593SmuzhiyunWPA_SUPPLICANT_DBUS_SERVICE = fi.w1.wpa_supplicant1
18*4882a593SmuzhiyunWPA_SUPPLICANT_CFLAGS = $(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libnl3/
19*4882a593SmuzhiyunWPA_SUPPLICANT_LDFLAGS = $(TARGET_LDFLAGS)
20*4882a593SmuzhiyunWPA_SUPPLICANT_SELINUX_MODULES = networkmanager
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun# 0001-AP-Silently-ignore-management-frame-from-unexpected-.patch
23*4882a593SmuzhiyunWPA_SUPPLICANT_IGNORE_CVES += CVE-2019-16275
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun# 0001-P2P-Fix-a-corner-case-in-peer-addition-based-on-PD-R.patch
26*4882a593SmuzhiyunWPA_SUPPLICANT_IGNORE_CVES += CVE-2021-27803
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun# 0002-ASN.1-Validate-DigestAlgorithmIdentifier-parameters.patch
29*4882a593SmuzhiyunWPA_SUPPLICANT_IGNORE_CVES += CVE-2021-30004
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun# install the wpa_client library
32*4882a593SmuzhiyunWPA_SUPPLICANT_INSTALL_STAGING = YES
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_EDITS =
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE = \
37*4882a593Smuzhiyun	CONFIG_INTERNAL_LIBTOMMATH \
38*4882a593Smuzhiyun	CONFIG_MATCH_IFACE
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE = \
41*4882a593Smuzhiyun	CONFIG_SMARTCARD
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun# libnl-3 needs -lm (for rint) and -lpthread if linking statically
44*4882a593Smuzhiyun# And library order matters hence stick -lnl-3 first since it's appended
45*4882a593Smuzhiyun# in the wpa_supplicant Makefiles as in LIBS+=-lnl-3 ... thus failing
46*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_NL80211),y)
47*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),y)
48*4882a593SmuzhiyunWPA_SUPPLICANT_LIBS += -lnl-3 -lm -lpthread
49*4882a593Smuzhiyunendif
50*4882a593SmuzhiyunWPA_SUPPLICANT_DEPENDENCIES += host-pkgconf libnl
51*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_LIBNL32
52*4882a593Smuzhiyunelse
53*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_DRIVER_NL80211
54*4882a593Smuzhiyunendif
55*4882a593Smuzhiyun
56*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WEXT),)
57*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_DRIVER_WEXT
58*4882a593Smuzhiyunendif
59*4882a593Smuzhiyun
60*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_IBSS_RSN), )
61*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_IBSS_RSN
62*4882a593Smuzhiyunendif
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun# Trailing underscore on purpose to not enable CONFIG_EAPOL_TEST
65*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_EAP),y)
66*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_EAP_
67*4882a593Smuzhiyun# uses dlopen()
68*4882a593Smuzhiyunifeq ($(BR2_STATIC_LIBS),y)
69*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_EAP_TNC
70*4882a593Smuzhiyunendif
71*4882a593Smuzhiyunelse
72*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += \
73*4882a593Smuzhiyun	CONFIG_EAP \
74*4882a593Smuzhiyun	CONFIG_IEEE8021X_EAPOL \
75*4882a593Smuzhiyun	CONFIG_FILS
76*4882a593Smuzhiyunendif
77*4882a593Smuzhiyun
78*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WIRED),)
79*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += \
80*4882a593Smuzhiyun	CONFIG_DRIVER_WIRED \
81*4882a593Smuzhiyun	CONFIG_MACSEC \
82*4882a593Smuzhiyun	CONFIG_DRIVER_MACSEC
83*4882a593Smuzhiyunendif
84*4882a593Smuzhiyun
85*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_HOTSPOT),)
86*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += \
87*4882a593Smuzhiyun	CONFIG_HS20 \
88*4882a593Smuzhiyun	CONFIG_INTERWORKING
89*4882a593Smuzhiyunendif
90*4882a593Smuzhiyun
91*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT),y)
92*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += \
93*4882a593Smuzhiyun	CONFIG_AP \
94*4882a593Smuzhiyun	CONFIG_P2P
95*4882a593Smuzhiyunelse
96*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += \
97*4882a593Smuzhiyun	CONFIG_AP \
98*4882a593Smuzhiyun	CONFIG_P2P
99*4882a593Smuzhiyunendif
100*4882a593Smuzhiyun
101*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WIFI_DISPLAY),y)
102*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_WIFI_DISPLAY
103*4882a593Smuzhiyunelse
104*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_WIFI_DISPLAY
105*4882a593Smuzhiyunendif
106*4882a593Smuzhiyun
107*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_MESH_NETWORKING),y)
108*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_MESH
109*4882a593Smuzhiyunelse
110*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_MESH
111*4882a593Smuzhiyunendif
112*4882a593Smuzhiyun
113*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN),y)
114*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += \
115*4882a593Smuzhiyun	CONFIG_AUTOSCAN_EXPONENTIAL \
116*4882a593Smuzhiyun	CONFIG_AUTOSCAN_PERIODIC
117*4882a593Smuzhiyunendif
118*4882a593Smuzhiyun
119*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPS),)
120*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_WPS
121*4882a593Smuzhiyunendif
122*4882a593Smuzhiyun
123*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPA3),y)
124*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += \
125*4882a593Smuzhiyun	CONFIG_DPP \
126*4882a593Smuzhiyun	CONFIG_SAE \
127*4882a593Smuzhiyun	CONFIG_OWE
128*4882a593Smuzhiyunelse
129*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += \
130*4882a593Smuzhiyun	CONFIG_DPP \
131*4882a593Smuzhiyun	CONFIG_SAE \
132*4882a593Smuzhiyun	CONFIG_OWE
133*4882a593Smuzhiyunendif
134*4882a593Smuzhiyun
135*4882a593Smuzhiyun# Try to use openssl if it's already available
136*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_LIBOPENSSL),y)
137*4882a593SmuzhiyunWPA_SUPPLICANT_DEPENDENCIES += host-pkgconf libopenssl
138*4882a593SmuzhiyunWPA_SUPPLICANT_LIBS += `$(PKG_CONFIG_HOST_BINARY) --libs openssl`
139*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_EDITS += 's/\#\(CONFIG_TLS=openssl\)/\1/'
140*4882a593Smuzhiyunelse
141*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_EAP_PWD CONFIG_EAP_TEAP
142*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_EDITS += 's/\#\(CONFIG_TLS=\).*/\1internal/'
143*4882a593Smuzhiyunendif
144*4882a593Smuzhiyun
145*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE),)
146*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_CTRL_IFACE\>
147*4882a593Smuzhiyunendif
148*4882a593Smuzhiyun
149*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_DBUS),y)
150*4882a593SmuzhiyunWPA_SUPPLICANT_DEPENDENCIES += host-pkgconf dbus
151*4882a593SmuzhiyunWPA_SUPPLICANT_MAKE_ENV = \
152*4882a593Smuzhiyun	PKG_CONFIG_SYSROOT_DIR="$(STAGING_DIR)" \
153*4882a593Smuzhiyun	PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig"
154*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_CTRL_IFACE_DBUS_NEW
155*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_DBUS_NEW
156*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D \
157*4882a593Smuzhiyun		$(@D)/wpa_supplicant/dbus/$(WPA_SUPPLICANT_DBUS_SERVICE).service \
158*4882a593Smuzhiyun		$(TARGET_DIR)/usr/share/dbus-1/system-services/$(WPA_SUPPLICANT_DBUS_SERVICE).service
159*4882a593Smuzhiyunendef
160*4882a593Smuzhiyun
161*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_DBUS_INTROSPECTION),y)
162*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_CTRL_IFACE_DBUS_INTRO
163*4882a593Smuzhiyunendif
164*4882a593Smuzhiyun
165*4882a593Smuzhiyunelse
166*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_CTRL_IFACE_DBUS_NEW
167*4882a593Smuzhiyunendif
168*4882a593Smuzhiyun
169*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_DEBUG_SYSLOG),)
170*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_DISABLE += CONFIG_DEBUG_SYSLOG
171*4882a593Smuzhiyunendif
172*4882a593Smuzhiyun
173*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_READLINE),y)
174*4882a593SmuzhiyunWPA_SUPPLICANT_DEPENDENCIES += readline
175*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_ENABLE += CONFIG_READLINE
176*4882a593Smuzhiyunendif
177*4882a593Smuzhiyun
178*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO),y)
179*4882a593SmuzhiyunWPA_SUPPLICANT_CONFIG_SET += CONFIG_BUILD_WPA_CLIENT_SO
180*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO
181*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/libwpa_client.so \
182*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/libwpa_client.so
183*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/src/common/wpa_ctrl.h \
184*4882a593Smuzhiyun		$(TARGET_DIR)/usr/include/wpa_ctrl.h
185*4882a593Smuzhiyunendef
186*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_STAGING_WPA_CLIENT_SO
187*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/libwpa_client.so \
188*4882a593Smuzhiyun		$(STAGING_DIR)/usr/lib/libwpa_client.so
189*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/src/common/wpa_ctrl.h \
190*4882a593Smuzhiyun		$(STAGING_DIR)/usr/include/wpa_ctrl.h
191*4882a593Smuzhiyunendef
192*4882a593Smuzhiyunendif
193*4882a593Smuzhiyun
194*4882a593Smuzhiyundefine WPA_SUPPLICANT_CONFIGURE_CMDS
195*4882a593Smuzhiyun	cp $(@D)/wpa_supplicant/defconfig $(WPA_SUPPLICANT_CONFIG)
196*4882a593Smuzhiyun	sed -i $(patsubst %,-e 's/^#\(%\)/\1/',$(WPA_SUPPLICANT_CONFIG_ENABLE)) \
197*4882a593Smuzhiyun		$(patsubst %,-e 's/^\(%\)/#\1/',$(WPA_SUPPLICANT_CONFIG_DISABLE)) \
198*4882a593Smuzhiyun		$(patsubst %,-e '1i%=y',$(WPA_SUPPLICANT_CONFIG_SET)) \
199*4882a593Smuzhiyun		$(patsubst %,-e %,$(WPA_SUPPLICANT_CONFIG_EDITS)) \
200*4882a593Smuzhiyun		$(WPA_SUPPLICANT_CONFIG)
201*4882a593Smuzhiyunendef
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun# LIBS for wpa_supplicant, LIBS_c for wpa_cli, LIBS_p for wpa_passphrase
204*4882a593Smuzhiyundefine WPA_SUPPLICANT_BUILD_CMDS
205*4882a593Smuzhiyun	$(TARGET_MAKE_ENV) CFLAGS="$(WPA_SUPPLICANT_CFLAGS)" \
206*4882a593Smuzhiyun		LDFLAGS="$(TARGET_LDFLAGS)" BINDIR=/usr/sbin \
207*4882a593Smuzhiyun		LIBS="$(WPA_SUPPLICANT_LIBS)" LIBS_c="$(WPA_SUPPLICANT_LIBS)" \
208*4882a593Smuzhiyun		LIBS_p="$(WPA_SUPPLICANT_LIBS)" \
209*4882a593Smuzhiyun		$(MAKE) CC="$(TARGET_CC)" -C $(@D)/$(WPA_SUPPLICANT_SUBDIR)
210*4882a593Smuzhiyunendef
211*4882a593Smuzhiyun
212*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_CLI),y)
213*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_CLI
214*4882a593Smuzhiyun	$(INSTALL) -m 0755 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/wpa_cli \
215*4882a593Smuzhiyun		$(TARGET_DIR)/usr/sbin/wpa_cli
216*4882a593Smuzhiyunendef
217*4882a593Smuzhiyunendif
218*4882a593Smuzhiyun
219*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE),y)
220*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_PASSPHRASE
221*4882a593Smuzhiyun	$(INSTALL) -m 0755 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/wpa_passphrase \
222*4882a593Smuzhiyun		$(TARGET_DIR)/usr/sbin/wpa_passphrase
223*4882a593Smuzhiyunendef
224*4882a593Smuzhiyunendif
225*4882a593Smuzhiyun
226*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_DBUS),y)
227*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_DBUS
228*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D \
229*4882a593Smuzhiyun		$(@D)/wpa_supplicant/dbus/dbus-wpa_supplicant.conf \
230*4882a593Smuzhiyun		$(TARGET_DIR)/etc/dbus-1/system.d/wpa_supplicant.conf
231*4882a593Smuzhiyun	$(WPA_SUPPLICANT_INSTALL_DBUS_NEW)
232*4882a593Smuzhiyunendef
233*4882a593Smuzhiyunendif
234*4882a593Smuzhiyun
235*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_STAGING_CMDS
236*4882a593Smuzhiyun	$(WPA_SUPPLICANT_INSTALL_STAGING_WPA_CLIENT_SO)
237*4882a593Smuzhiyunendef
238*4882a593Smuzhiyun
239*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_TARGET_CMDS
240*4882a593Smuzhiyun	$(INSTALL) -m 0755 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/wpa_supplicant \
241*4882a593Smuzhiyun		$(TARGET_DIR)/usr/sbin/wpa_supplicant
242*4882a593Smuzhiyun	$(INSTALL) -m 644 -D package/wpa_supplicant/wpa_supplicant.conf \
243*4882a593Smuzhiyun		$(TARGET_DIR)/etc/wpa_supplicant.conf
244*4882a593Smuzhiyun	$(WPA_SUPPLICANT_INSTALL_CLI)
245*4882a593Smuzhiyun	$(WPA_SUPPLICANT_INSTALL_PASSPHRASE)
246*4882a593Smuzhiyun	$(WPA_SUPPLICANT_INSTALL_DBUS)
247*4882a593Smuzhiyun	$(WPA_SUPPLICANT_INSTALL_WPA_CLIENT_SO)
248*4882a593Smuzhiyunendef
249*4882a593Smuzhiyun
250*4882a593Smuzhiyundefine WPA_SUPPLICANT_INSTALL_INIT_SYSTEMD
251*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/systemd/wpa_supplicant.service \
252*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/wpa_supplicant.service
253*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/systemd/wpa_supplicant@.service \
254*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/wpa_supplicant@.service
255*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/systemd/wpa_supplicant-nl80211@.service \
256*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/wpa_supplicant-nl80211@.service
257*4882a593Smuzhiyun	$(INSTALL) -m 0644 -D $(@D)/$(WPA_SUPPLICANT_SUBDIR)/systemd/wpa_supplicant-wired@.service \
258*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system/wpa_supplicant-wired@.service
259*4882a593Smuzhiyun	$(INSTALL) -D -m 644 $(WPA_SUPPLICANT_PKGDIR)/50-wpa_supplicant.preset \
260*4882a593Smuzhiyun		$(TARGET_DIR)/usr/lib/systemd/system-preset/50-wpa_supplicant.preset
261*4882a593Smuzhiyunendef
262*4882a593Smuzhiyun
263*4882a593Smuzhiyun$(eval $(generic-package))
264