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