mac80211: brcmfmac: backport changes from 2016-09-27
[openwrt/svn-archive/archive.git] / package / network / services / hostapd / Makefile
1 # Copyright (C) 2006-2014 OpenWrt.org
2 #
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
5 #
6
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=hostapd
10 PKG_VERSION:=2015-03-25
11 PKG_RELEASE:=1
12 PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
16 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE_VERSION:=$(PKG_REV)
18 PKG_SOURCE_PROTO:=git
19 # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
20
21 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
22 PKG_LICENSE:=BSD-3-Clause
23
24 PKG_BUILD_PARALLEL:=1
25
26 PKG_CONFIG_DEPENDS:= \
27 CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
28 CONFIG_PACKAGE_kmod-ath9k \
29 CONFIG_PACKAGE_kmod-cfg80211 \
30 CONFIG_PACKAGE_hostapd \
31 CONFIG_PACKAGE_hostapd-mini \
32 CONFIG_PACKAGE_kmod-hostap \
33 CONFIG_WPA_RFKILL_SUPPORT \
34 CONFIG_DRIVER_WEXT_SUPPORT \
35 CONFIG_DRIVER_11N_SUPPORT
36
37 LOCAL_TYPE=$(strip \
38 $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
39 $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
40 hostapd \
41 )))
42 LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
43
44 ifeq ($(LOCAL_TYPE),supplicant)
45 ifeq ($(LOCAL_VARIANT),full)
46 PKG_CONFIG_DEPENDS += \
47 CONFIG_WPA_SUPPLICANT_INTERNAL \
48 CONFIG_WPA_SUPPLICANT_OPENSSL
49 endif
50 ifeq ($(LOCAL_VARIANT),mesh)
51 PKG_CONFIG_DEPENDS += \
52 CONFIG_WPA_SUPPLICANT_OPENSSL
53 endif
54 endif
55
56 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
57
58 include $(INCLUDE_DIR)/package.mk
59
60 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
61
62 ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
63 HOSTAPD_IEEE80211N:=y
64 endif
65
66 DRIVER_MAKEOPTS= \
67 CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
68 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
69 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
70 CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
71 CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
72
73 ifeq ($(LOCAL_VARIANT),full)
74 DRIVER_MAKEOPTS += CONFIG_IEEE80211W=$(CONFIG_DRIVER_11W_SUPPORT)
75 endif
76
77 ifneq ($(LOCAL_TYPE),hostapd)
78 ifdef CONFIG_WPA_SUPPLICANT_OPENSSL
79 ifeq ($(LOCAL_VARIANT),full)
80 DRIVER_MAKEOPTS += CONFIG_TLS=openssl
81 TARGET_LDFLAGS += -lcrypto -lssl
82 endif
83 endif
84 ifeq ($(LOCAL_VARIANT),mesh)
85 DRIVER_MAKEOPTS += CONFIG_TLS=openssl
86 TARGET_LDFLAGS += -lcrypto -lssl
87 endif
88 ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
89 TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
90 endif
91 ifdef CONFIG_WPA_RFKILL_SUPPORT
92 DRIVER_MAKEOPTS += NEED_RFKILL=y
93 endif
94 DRIVER_MAKEOPTS += \
95 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
96 endif
97
98 ifdef CONFIG_USE_GLIBC
99 TARGET_LDFLAGS += -lrt
100 TARGET_LDFLAGS_C += -lrt
101 endif
102
103 DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny
104
105 define Package/hostapd/Default
106 SECTION:=net
107 CATEGORY:=Network
108 TITLE:=IEEE 802.1x Authenticator
109 URL:=http://hostap.epitest.fi/
110 DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus
111 endef
112
113 define Package/hostapd
114 $(call Package/hostapd/Default)
115 TITLE+= (full)
116 VARIANT:=full
117 CONFLICTS:=wpad wpad-mini wpad-mesh
118 endef
119
120 define Package/hostapd/description
121 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
122 Authenticator.
123 endef
124
125 define Package/hostapd-mini
126 $(call Package/hostapd/Default)
127 TITLE+= (WPA-PSK only)
128 VARIANT:=mini
129 CONFLICTS:=wpad wpad-mini wpad-mesh
130 endef
131
132 define Package/hostapd-mini/description
133 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
134 endef
135
136 define Package/hostapd-utils
137 $(call Package/hostapd/Default)
138 TITLE+= (utils)
139 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mesh||PACKAGE_wpad-mini
140 endef
141
142 define Package/hostapd-utils/description
143 This package contains a command line utility to control the
144 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
145 endef
146
147 define Package/wpad/Default
148 SECTION:=net
149 CATEGORY:=Network
150 TITLE:=IEEE 802.1x Authenticator/Supplicant
151 DEPENDS:=$(DRV_DEPENDS) +hostapd-common +libubus
152 URL:=http://hostap.epitest.fi/
153 endef
154
155 define Package/wpad
156 $(call Package/wpad/Default)
157 TITLE+= (full)
158 DEPENDS+=+WPA_SUPPLICANT_OPENSSL:libopenssl
159 VARIANT:=wpad-full
160 endef
161
162 define Package/wpad/description
163 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
164 Authenticator and Supplicant
165 endef
166
167 define Package/wpad-mini
168 $(call Package/wpad/Default)
169 TITLE+= (WPA-PSK only)
170 VARIANT:=wpad-mini
171 endef
172
173 define Package/wpad-mini/description
174 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
175 endef
176
177 define Package/wpad-mesh
178 $(call Package/wpad/Default)
179 TITLE+= (with 802.11s mesh and SAE support)
180 DEPENDS:=$(DRV_DEPENDS) +libubus +libopenssl +@CONFIG_WPA_SUPPLICANT_OPENSSL @(!TARGET_uml||BROKEN)
181 CONFLICTS:=@WPA_SUPPLICANT_INTERNAL
182 VARIANT:=wpad-mesh
183 endef
184
185 define Package/wpad-mesh/description
186 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (with 802.11s mesh and SAE support).
187 endef
188
189 define Package/wpa-supplicant
190 SECTION:=net
191 CATEGORY:=Network
192 TITLE:=WPA Supplicant
193 URL:=http://hostap.epitest.fi/wpa_supplicant/
194 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
195 CONFLICTS:=wpad wpad-mini wpad-mesh
196 VARIANT:=supplicant-full
197 endef
198
199 define Package/wpa-supplicant/Description
200 WPA Supplicant
201 endef
202
203 define Package/wpa-supplicant/config
204 source "$(SOURCE)/Config.in"
205 endef
206
207 define Package/wpa-supplicant-p2p
208 $(Package/wpa-supplicant)
209 TITLE:=WPA Supplicant (with Wi-Fi P2P support)
210 DEPENDS:=$(DRV_DEPENDS)
211 CONFLICTS:=wpad wpad-mini wpad-mesh
212 VARIANT:=supplicant-p2p
213 endef
214
215 define Package/wpa-supplicant-p2p/Description
216 WPA Supplicant (with Wi-Fi P2P support)
217 endef
218
219 define Package/wpa-supplicant-mesh
220 $(Package/wpa-supplicant)
221 TITLE:=WPA Supplicant (with 802.11s and SAE)
222 DEPENDS:=$(DRV_DEPENDS) @(!TARGET_uml||BROKEN)
223 CONFLICTS:=wpad wpad-mesh wpad-mesh
224 VARIANT:=supplicant-mesh
225 endef
226
227 define Package/wpa-supplicant-mesh/Description
228 WPA Supplicant (variant with 802.11s and SAE support)
229 endef
230
231 define Package/wpa-supplicant-mini
232 $(Package/wpa-supplicant)
233 TITLE:=WPA Supplicant (minimal version)
234 DEPENDS:=$(DRV_DEPENDS)
235 CONFLICTS:=wpad wpad-mini wpad-mesh
236 VARIANT:=supplicant-mini
237 endef
238
239 define Package/wpa-supplicant-mini/Description
240 WPA Supplicant (minimal version)
241 endef
242
243 define Package/wpa-cli
244 SECTION:=net
245 CATEGORY:=Network
246 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad||PACKAGE_wpad-mesh
247 TITLE:=WPA Supplicant command line interface
248 endef
249
250 define Package/wpa-cli/Description
251 WPA Supplicant control utility
252 endef
253
254 define Package/hostapd-common
255 TITLE:=hostapd/wpa_supplicant common support files
256 SECTION:=net
257 CATEGORY:=Network
258 endef
259
260 define Package/hostapd-common-old
261 TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
262 SECTION:=net
263 CATEGORY:=Network
264 endef
265
266 define Package/eapol-test
267 TITLE:=802.1x authentication test utility
268 SECTION:=net
269 CATEGORY:=Network
270 VARIANT:=supplicant-full
271 DEPENDS:=$(DRV_DEPENDS)
272 endef
273
274
275 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
276 define Build/Configure/rebuild
277 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
278 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
279 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
280 rm -f $(PKG_BUILD_DIR)/.config_*
281 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
282 endef
283 endif
284
285 define Build/Configure
286 $(Build/Configure/rebuild)
287 $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
288 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
289 )
290 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
291 endef
292
293 TARGET_CPPFLAGS := \
294 -I$(STAGING_DIR)/usr/include/libnl-tiny \
295 -I$(PKG_BUILD_DIR)/src/crypto \
296 $(TARGET_CPPFLAGS) \
297 -DCONFIG_LIBNL20 \
298 -D_GNU_SOURCE \
299 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
300
301 TARGET_CFLAGS += -ffunction-sections -fdata-sections
302 TARGET_LDFLAGS += -Wl,--gc-sections
303 ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
304 TARGET_LDFLAGS += -lubox -lubus
305 endif
306
307 ifdef CONFIG_PACKAGE_kmod-cfg80211
308 TARGET_LDFLAGS += -lm -lnl-tiny
309 endif
310
311 define Build/RunMake
312 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
313 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
314 $(TARGET_CONFIGURE_OPTS) \
315 $(DRIVER_MAKEOPTS) \
316 LIBS="$(TARGET_LDFLAGS)" \
317 LIBS_c="$(TARGET_LDFLAGS_C)" \
318 BCHECK= \
319 $(2)
320 endef
321
322 define Build/Compile/wpad
323 echo ` \
324 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
325 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
326 sed -e 's,-n ,,g' -e 's^$(TARGET_CFLAGS)^^' \
327 ` > $(PKG_BUILD_DIR)/.cflags
328 +$(call Build/RunMake,hostapd, \
329 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
330 MULTICALL=1 \
331 hostapd_cli hostapd_multi.a \
332 )
333 +$(call Build/RunMake,wpa_supplicant, \
334 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
335 MULTICALL=1 \
336 wpa_cli wpa_supplicant_multi.a \
337 )
338 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
339 $(TARGET_CFLAGS) \
340 ./files/multicall.c \
341 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
342 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
343 $(TARGET_LDFLAGS)
344 endef
345
346 define Build/Compile/hostapd
347 $(call Build/RunMake,hostapd, \
348 hostapd hostapd_cli \
349 )
350 endef
351
352 define Build/Compile/supplicant
353 $(call Build/RunMake,wpa_supplicant, \
354 wpa_cli wpa_supplicant \
355 )
356 endef
357
358 define Build/Compile/supplicant-full
359 $(call Build/RunMake,wpa_supplicant, \
360 eapol_test \
361 )
362 endef
363
364 define Build/Compile
365 $(Build/Compile/$(LOCAL_TYPE))
366 $(Build/Compile/$(BUILD_VARIANT))
367 endef
368
369 define Install/hostapd
370 $(INSTALL_DIR) $(1)/usr/sbin
371 endef
372
373 define Install/supplicant
374 $(INSTALL_DIR) $(1)/usr/sbin
375 endef
376
377 define Package/hostapd-common/install
378 $(INSTALL_DIR) $(1)/lib/netifd
379 $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
380 endef
381
382 define Package/hostapd-common-old/install
383 $(INSTALL_DIR) $(1)/lib/wifi
384 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
385 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
386 endef
387
388 define Package/hostapd/install
389 $(call Install/hostapd,$(1))
390 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
391 endef
392 Package/hostapd-mini/install = $(Package/hostapd/install)
393
394 ifneq ($(LOCAL_TYPE),supplicant)
395 define Package/hostapd-utils/install
396 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
397 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
398 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
399 endef
400 endif
401
402 define Package/wpad/install
403 $(call Install/hostapd,$(1))
404 $(call Install/supplicant,$(1))
405 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
406 $(LN) wpad $(1)/usr/sbin/hostapd
407 $(LN) wpad $(1)/usr/sbin/wpa_supplicant
408 endef
409 Package/wpad-mini/install = $(Package/wpad/install)
410 Package/wpad-mesh/install = $(Package/wpad/install)
411
412 define Package/wpa-supplicant/install
413 $(call Install/supplicant,$(1))
414 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
415 endef
416 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
417 Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
418
419 ifneq ($(LOCAL_TYPE),hostapd)
420 define Package/wpa-cli/install
421 $(INSTALL_DIR) $(1)/usr/sbin
422 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
423 endef
424 endif
425
426 ifeq ($(BUILD_VARIANT),supplicant-full)
427 define Package/eapol-test/install
428 $(INSTALL_DIR) $(1)/usr/sbin
429 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
430 endef
431 endif
432
433 $(eval $(call BuildPackage,hostapd))
434 $(eval $(call BuildPackage,hostapd-mini))
435 $(eval $(call BuildPackage,wpad))
436 $(eval $(call BuildPackage,wpad-mesh))
437 $(eval $(call BuildPackage,wpad-mini))
438 $(eval $(call BuildPackage,wpa-supplicant))
439 $(eval $(call BuildPackage,wpa-supplicant-mesh))
440 $(eval $(call BuildPackage,wpa-supplicant-mini))
441 $(eval $(call BuildPackage,wpa-supplicant-p2p))
442 $(eval $(call BuildPackage,wpa-cli))
443 $(eval $(call BuildPackage,hostapd-utils))
444 $(eval $(call BuildPackage,hostapd-common))
445 $(eval $(call BuildPackage,hostapd-common-old))
446 $(eval $(call BuildPackage,eapol-test))