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-mac80211 \
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-mac80211) \
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) \
74 $(if $(CONFIG_WPA_RFKILL_SUPPORT),NEED_RFKILL=y)
76 ifneq ($(LOCAL_TYPE),hostapd)
77 ifdef CONFIG_WPA_SUPPLICANT_OPENSSL
78 ifeq ($(LOCAL_VARIANT),full)
79 DRIVER_MAKEOPTS += CONFIG_TLS=openssl
80 TARGET_LDFLAGS += -lcrypto -lssl
83 ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
84 TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
87 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
90 ifdef CONFIG_USE_EGLIBC
91 TARGET_LDFLAGS += -lrt
92 TARGET_LDFLAGS_C += -lrt
95 DRV_DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny @(!TARGET_avr32||BROKEN)
97 define Package/hostapd/Default
100 TITLE:=IEEE 802.1x Authenticator
101 URL:=http://hostap.epitest.fi/
102 DEPENDS:=$(DRV_DEPENDS) +libubus
105 define Package/hostapd
106 $(call Package/hostapd/Default)
109 CONFLICTS:=wpad wpad-mini
112 define Package/hostapd/description
113 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
117 define Package/hostapd-mini
118 $(call Package/hostapd/Default)
119 TITLE+= (WPA-PSK only)
121 CONFLICTS:=wpad wpad-mini
124 define Package/hostapd-mini/description
125 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
128 define Package/hostapd-utils
129 $(call Package/hostapd/Default)
131 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
134 define Package/hostapd-utils/description
135 This package contains a command line utility to control the
136 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
139 define Package/wpad/Default
142 TITLE:=IEEE 802.1x Authenticator/Supplicant
143 URL:=http://hostap.epitest.fi/
147 $(call Package/wpad/Default)
149 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +libubus
153 define Package/wpad/description
154 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
155 Authenticator and Supplicant
158 define Package/wpad-mini
159 $(call Package/wpad/Default)
160 TITLE+= (WPA-PSK only)
161 DEPENDS:=$(DRV_DEPENDS) +libubus
165 define Package/wpad-mini/description
166 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
169 define Package/wpa-supplicant
172 TITLE:=WPA Supplicant
173 URL:=http://hostap.epitest.fi/wpa_supplicant/
174 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
175 CONFLICTS:=wpad wpad-mini
176 VARIANT:=supplicant-full
179 define Package/wpa-supplicant/Description
183 define Package/wpa-supplicant/config
184 source "$(SOURCE)/Config.in"
187 define Package/wpa-supplicant-p2p
188 $(Package/wpa-supplicant)
189 TITLE:=WPA Supplicant (with Wi-Fi P2P support)
190 DEPENDS:=$(DRV_DEPENDS)
191 CONFLICTS:=wpad wpad-mini
192 VARIANT:=supplicant-p2p
195 define Package/wpa-supplicant-p2p/Description
196 WPA Supplicant (with Wi-Fi P2P support)
199 define Package/wpa-supplicant-mini
200 $(Package/wpa-supplicant)
201 TITLE:=WPA Supplicant (minimal version)
202 DEPENDS:=$(DRV_DEPENDS)
203 CONFLICTS:=wpad wpad-mini
204 VARIANT:=supplicant-mini
207 define Package/wpa-supplicant-mini/Description
208 WPA Supplicant (minimal version)
211 define Package/wpa-cli
214 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad
215 TITLE:=WPA Supplicant command line interface
218 define Package/wpa-cli/Description
219 WPA Supplicant control utility
222 define Package/hostapd-common
223 TITLE:=hostapd/wpa_supplicant common support files
228 define Package/hostapd-common-old
229 TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
234 define Package/eapol-test
235 TITLE:=802.1x authentication test utility
238 VARIANT:=supplicant-full
239 DEPENDS:=$(DRV_DEPENDS)
243 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
244 define Build/Configure/rebuild
245 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
246 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
247 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
248 rm -f $(PKG_BUILD_DIR)/.config_*
249 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
253 define Build/Configure
254 $(Build/Configure/rebuild)
255 $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
256 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
258 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
262 -I$(STAGING_DIR)/usr/include/libnl-tiny \
263 -I$(PKG_BUILD_DIR)/src/crypto \
265 -I$(CURDIR)/madwifi \
268 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
270 TARGET_CFLAGS += -ffunction-sections -fdata-sections
271 TARGET_LDFLAGS += -Wl,--gc-sections
272 ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
273 TARGET_LDFLAGS += -lubox -lubus
276 ifdef CONFIG_PACKAGE_kmod-mac80211
277 TARGET_LDFLAGS += -lm -lnl-tiny
281 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
282 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
283 $(TARGET_CONFIGURE_OPTS) \
285 LIBS="$(TARGET_LDFLAGS)" \
286 LIBS_c="$(TARGET_LDFLAGS_C)" \
291 define Build/Compile/wpad
293 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
294 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
295 sed -e 's,-n ,,g' -e 's,$(TARGET_CFLAGS),,' \
296 ` > $(PKG_BUILD_DIR)/.cflags
297 +$(call Build/RunMake,hostapd, \
298 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
300 hostapd_cli hostapd_multi.a \
302 +$(call Build/RunMake,wpa_supplicant, \
303 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
305 wpa_cli wpa_supplicant_multi.a \
307 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
309 ./files/multicall.c \
310 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
311 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
315 define Build/Compile/hostapd
316 $(call Build/RunMake,hostapd, \
317 hostapd hostapd_cli \
321 define Build/Compile/supplicant
322 $(call Build/RunMake,wpa_supplicant, \
323 wpa_cli wpa_supplicant \
327 define Build/Compile/supplicant-full
328 $(call Build/RunMake,wpa_supplicant, \
334 $(Build/Compile/$(LOCAL_TYPE))
335 $(Build/Compile/$(BUILD_VARIANT))
338 define Install/hostapd
339 $(INSTALL_DIR) $(1)/usr/sbin
342 define Install/supplicant
343 $(INSTALL_DIR) $(1)/usr/sbin
346 define Package/hostapd-common/install
347 $(INSTALL_DIR) $(1)/lib/netifd
348 $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
351 define Package/hostapd-common-old/install
352 $(INSTALL_DIR) $(1)/lib/wifi
353 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
354 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
357 define Package/hostapd/install
358 $(call Install/hostapd,$(1))
359 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
361 Package/hostapd-mini/install = $(Package/hostapd/install)
363 ifneq ($(LOCAL_TYPE),supplicant)
364 define Package/hostapd-utils/install
365 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
366 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
367 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
371 define Package/wpad/install
372 $(call Install/hostapd,$(1))
373 $(call Install/supplicant,$(1))
374 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
375 ln -sf wpad $(1)/usr/sbin/hostapd
376 ln -sf wpad $(1)/usr/sbin/wpa_supplicant
378 Package/wpad-mini/install = $(Package/wpad/install)
380 define Package/wpa-supplicant/install
381 $(call Install/supplicant,$(1))
382 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
384 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
385 Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
387 ifneq ($(LOCAL_TYPE),hostapd)
388 define Package/wpa-cli/install
389 $(INSTALL_DIR) $(1)/usr/sbin
390 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
394 ifeq ($(BUILD_VARIANT),supplicant-full)
395 define Package/eapol-test/install
396 $(INSTALL_DIR) $(1)/usr/sbin
397 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
401 $(eval $(call BuildPackage,hostapd))
402 $(eval $(call BuildPackage,hostapd-mini))
403 $(eval $(call BuildPackage,wpad))
404 $(eval $(call BuildPackage,wpad-mini))
405 $(eval $(call BuildPackage,wpa-supplicant))
406 $(eval $(call BuildPackage,wpa-supplicant-mini))
407 $(eval $(call BuildPackage,wpa-supplicant-p2p))
408 $(eval $(call BuildPackage,wpa-cli))
409 $(eval $(call BuildPackage,hostapd-utils))
410 $(eval $(call BuildPackage,hostapd-common))
411 $(eval $(call BuildPackage,hostapd-common-old))
412 $(eval $(call BuildPackage,eapol-test))