2 # Copyright (C) 2006-2014 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
11 PKG_VERSION:=2014-10-25
13 PKG_REV:=01e2231fdc4fbec61fbc382238e3606a1d2826e4
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
17 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=$(PKG_REV)
20 # PKG_MIRROR_MD5SUM:=4e7c1f97edd7514535056fce54ae053a
22 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
23 PKG_LICENSE:=BSD-3-Clause
28 PACKAGE_kmod-madwifi:madwifi \
30 PKG_CONFIG_DEPENDS:= \
31 CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
32 CONFIG_PACKAGE_kmod-ath9k \
33 CONFIG_PACKAGE_kmod-cfg80211 \
34 CONFIG_PACKAGE_kmod-madwifi \
35 CONFIG_PACKAGE_hostapd \
36 CONFIG_PACKAGE_hostapd-mini \
37 CONFIG_PACKAGE_kmod-hostap \
38 CONFIG_WPA_RFKILL_SUPPORT \
39 CONFIG_DRIVER_WEXT_SUPPORT \
40 CONFIG_DRIVER_11N_SUPPORT
43 $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
44 $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
47 LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
49 ifeq ($(LOCAL_TYPE),supplicant)
50 ifeq ($(LOCAL_VARIANT),full)
51 PKG_CONFIG_DEPENDS += \
52 CONFIG_WPA_SUPPLICANT_INTERNAL \
53 CONFIG_WPA_SUPPLICANT_OPENSSL
57 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
59 include $(INCLUDE_DIR)/package.mk
61 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
63 ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
68 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
69 CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
70 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
71 CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
72 CONFIG_IEEE80211W=$(CONFIG_PACKAGE_kmod-ath9k) \
73 CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
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
82 ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
83 TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
85 ifdef CONFIG_WPA_RFKILL_SUPPORT
86 DRIVER_MAKEOPTS += NEED_RFKILL=y
89 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
92 ifdef CONFIG_USE_EGLIBC
93 TARGET_LDFLAGS += -lrt
94 TARGET_LDFLAGS_C += -lrt
97 DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny @(!TARGET_avr32||BROKEN)
99 define Package/hostapd/Default
102 TITLE:=IEEE 802.1x Authenticator
103 URL:=http://hostap.epitest.fi/
104 DEPENDS:=$(DRV_DEPENDS) +libubus
107 define Package/hostapd
108 $(call Package/hostapd/Default)
111 CONFLICTS:=wpad wpad-mini
114 define Package/hostapd/description
115 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
119 define Package/hostapd-mini
120 $(call Package/hostapd/Default)
121 TITLE+= (WPA-PSK only)
123 CONFLICTS:=wpad wpad-mini
126 define Package/hostapd-mini/description
127 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
130 define Package/hostapd-utils
131 $(call Package/hostapd/Default)
133 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
136 define Package/hostapd-utils/description
137 This package contains a command line utility to control the
138 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
141 define Package/wpad/Default
144 TITLE:=IEEE 802.1x Authenticator/Supplicant
145 URL:=http://hostap.epitest.fi/
149 $(call Package/wpad/Default)
151 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +libubus
155 define Package/wpad/description
156 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
157 Authenticator and Supplicant
160 define Package/wpad-mini
161 $(call Package/wpad/Default)
162 TITLE+= (WPA-PSK only)
163 DEPENDS:=$(DRV_DEPENDS) +libubus
167 define Package/wpad-mini/description
168 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
171 define Package/wpa-supplicant
174 TITLE:=WPA Supplicant
175 URL:=http://hostap.epitest.fi/wpa_supplicant/
176 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
177 CONFLICTS:=wpad wpad-mini
178 VARIANT:=supplicant-full
181 define Package/wpa-supplicant/Description
185 define Package/wpa-supplicant/config
186 source "$(SOURCE)/Config.in"
189 define Package/wpa-supplicant-p2p
190 $(Package/wpa-supplicant)
191 TITLE:=WPA Supplicant (with Wi-Fi P2P support)
192 DEPENDS:=$(DRV_DEPENDS)
193 CONFLICTS:=wpad wpad-mini
194 VARIANT:=supplicant-p2p
197 define Package/wpa-supplicant-p2p/Description
198 WPA Supplicant (with Wi-Fi P2P support)
201 define Package/wpa-supplicant-mini
202 $(Package/wpa-supplicant)
203 TITLE:=WPA Supplicant (minimal version)
204 DEPENDS:=$(DRV_DEPENDS)
205 CONFLICTS:=wpad wpad-mini
206 VARIANT:=supplicant-mini
209 define Package/wpa-supplicant-mini/Description
210 WPA Supplicant (minimal version)
213 define Package/wpa-cli
216 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad
217 TITLE:=WPA Supplicant command line interface
220 define Package/wpa-cli/Description
221 WPA Supplicant control utility
224 define Package/hostapd-common
225 TITLE:=hostapd/wpa_supplicant common support files
230 define Package/hostapd-common-old
231 TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
236 define Package/eapol-test
237 TITLE:=802.1x authentication test utility
240 VARIANT:=supplicant-full
241 DEPENDS:=$(DRV_DEPENDS)
245 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
246 define Build/Configure/rebuild
247 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
248 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
249 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
250 rm -f $(PKG_BUILD_DIR)/.config_*
251 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
255 define Build/Configure
256 $(Build/Configure/rebuild)
257 $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
258 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
260 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
264 -I$(STAGING_DIR)/usr/include/libnl-tiny \
265 -I$(PKG_BUILD_DIR)/src/crypto \
267 -I$(CURDIR)/madwifi \
270 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
272 TARGET_CFLAGS += -ffunction-sections -fdata-sections
273 TARGET_LDFLAGS += -Wl,--gc-sections
274 ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
275 TARGET_LDFLAGS += -lubox -lubus
278 ifdef CONFIG_PACKAGE_kmod-cfg80211
279 TARGET_LDFLAGS += -lm -lnl-tiny
283 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
284 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
285 $(TARGET_CONFIGURE_OPTS) \
287 LIBS="$(TARGET_LDFLAGS)" \
288 LIBS_c="$(TARGET_LDFLAGS_C)" \
293 define Build/Compile/wpad
295 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
296 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
297 sed -e 's,-n ,,g' -e 's^$(TARGET_CFLAGS)^^' \
298 ` > $(PKG_BUILD_DIR)/.cflags
299 +$(call Build/RunMake,hostapd, \
300 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
302 hostapd_cli hostapd_multi.a \
304 +$(call Build/RunMake,wpa_supplicant, \
305 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
307 wpa_cli wpa_supplicant_multi.a \
309 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
311 ./files/multicall.c \
312 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
313 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
317 define Build/Compile/hostapd
318 $(call Build/RunMake,hostapd, \
319 hostapd hostapd_cli \
323 define Build/Compile/supplicant
324 $(call Build/RunMake,wpa_supplicant, \
325 wpa_cli wpa_supplicant \
329 define Build/Compile/supplicant-full
330 $(call Build/RunMake,wpa_supplicant, \
336 $(Build/Compile/$(LOCAL_TYPE))
337 $(Build/Compile/$(BUILD_VARIANT))
340 define Install/hostapd
341 $(INSTALL_DIR) $(1)/usr/sbin
344 define Install/supplicant
345 $(INSTALL_DIR) $(1)/usr/sbin
348 define Package/hostapd-common/install
349 $(INSTALL_DIR) $(1)/lib/netifd
350 $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
353 define Package/hostapd-common-old/install
354 $(INSTALL_DIR) $(1)/lib/wifi
355 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
356 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
359 define Package/hostapd/install
360 $(call Install/hostapd,$(1))
361 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
363 Package/hostapd-mini/install = $(Package/hostapd/install)
365 ifneq ($(LOCAL_TYPE),supplicant)
366 define Package/hostapd-utils/install
367 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
368 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
369 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
373 define Package/wpad/install
374 $(call Install/hostapd,$(1))
375 $(call Install/supplicant,$(1))
376 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
377 $(LN) wpad $(1)/usr/sbin/hostapd
378 $(LN) wpad $(1)/usr/sbin/wpa_supplicant
380 Package/wpad-mini/install = $(Package/wpad/install)
382 define Package/wpa-supplicant/install
383 $(call Install/supplicant,$(1))
384 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
386 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
387 Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
389 ifneq ($(LOCAL_TYPE),hostapd)
390 define Package/wpa-cli/install
391 $(INSTALL_DIR) $(1)/usr/sbin
392 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
396 ifeq ($(BUILD_VARIANT),supplicant-full)
397 define Package/eapol-test/install
398 $(INSTALL_DIR) $(1)/usr/sbin
399 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
403 $(eval $(call BuildPackage,hostapd))
404 $(eval $(call BuildPackage,hostapd-mini))
405 $(eval $(call BuildPackage,wpad))
406 $(eval $(call BuildPackage,wpad-mini))
407 $(eval $(call BuildPackage,wpa-supplicant))
408 $(eval $(call BuildPackage,wpa-supplicant-mini))
409 $(eval $(call BuildPackage,wpa-supplicant-p2p))
410 $(eval $(call BuildPackage,wpa-cli))
411 $(eval $(call BuildPackage,hostapd-utils))
412 $(eval $(call BuildPackage,hostapd-common))
413 $(eval $(call BuildPackage,hostapd-common-old))
414 $(eval $(call BuildPackage,eapol-test))