2 # Copyright (C) 2006-2012 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
13 PKG_REV:=a311c61dd664db7c1d16dd3395adf07bea6c141d
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:=d81d1b073521df0c608f42e2cedec60c
22 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
27 PACKAGE_kmod-madwifi:madwifi \
29 PKG_CONFIG_DEPENDS:= \
30 CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
31 CONFIG_PACKAGE_kmod-ath9k \
32 CONFIG_PACKAGE_kmod-mac80211 \
33 CONFIG_PACKAGE_kmod-madwifi \
34 CONFIG_PACKAGE_hostapd \
35 CONFIG_PACKAGE_hostapd-mini \
36 CONFIG_PACKAGE_kmod-hostap \
37 CONFIG_WPA_RFKILL_SUPPORT \
38 CONFIG_DRIVER_WEXT_SUPPORT \
39 CONFIG_DRIVER_11N_SUPPORT
42 $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
43 $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
46 LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
48 ifeq ($(LOCAL_TYPE),supplicant)
49 ifeq ($(LOCAL_VARIANT),full)
50 PKG_CONFIG_DEPENDS += \
51 CONFIG_WPA_SUPPLICANT_INTERNAL \
52 CONFIG_WPA_SUPPLICANT_OPENSSL
56 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
58 include $(INCLUDE_DIR)/package.mk
60 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
62 ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
67 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-mac80211) \
68 CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
69 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
70 CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
71 CONFIG_IEEE80211W=$(CONFIG_PACKAGE_kmod-ath9k) \
72 CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
73 $(if $(CONFIG_WPA_RFKILL_SUPPORT),NEED_RFKILL=y)
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
86 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
89 DRV_DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny @(!TARGET_avr32||BROKEN)
91 define Package/hostapd/Default
94 TITLE:=IEEE 802.1x Authenticator
95 URL:=http://hostap.epitest.fi/
96 DEPENDS:=$(DRV_DEPENDS)
99 define Package/hostapd
100 $(call Package/hostapd/Default)
105 define Package/hostapd/description
106 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
110 define Package/hostapd-mini
111 $(call Package/hostapd/Default)
112 TITLE+= (WPA-PSK only)
116 define Package/hostapd-mini/description
117 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
120 define Package/hostapd-utils
121 $(call Package/hostapd/Default)
123 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
126 define Package/hostapd-utils/description
127 This package contains a command line utility to control the
128 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
131 define Package/wpad/Default
134 TITLE:=IEEE 802.1x Authenticator/Supplicant
135 URL:=http://hostap.epitest.fi/
139 $(call Package/wpad/Default)
141 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
145 define Package/wpad/description
146 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
147 Authenticator and Supplicant
150 define Package/wpad-mini
151 $(call Package/wpad/Default)
152 TITLE+= (WPA-PSK only)
153 DEPENDS:=$(DRV_DEPENDS)
157 define Package/wpad-mini/description
158 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
161 define Package/wpa-supplicant
164 TITLE:=WPA Supplicant
165 URL:=http://hostap.epitest.fi/wpa_supplicant/
166 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
167 VARIANT:=supplicant-full
170 define Package/wpa-supplicant/Description
174 define Package/wpa-supplicant/config
175 source "$(SOURCE)/Config.in"
178 define Package/wpa-supplicant-mini
179 $(Package/wpa-supplicant)
180 TITLE:=WPA Supplicant (minimal version)
181 DEPENDS:=$(DRV_DEPENDS)
182 VARIANT:=supplicant-mini
185 define Package/wpa-supplicant-mini/Description
186 WPA Supplicant (minimal version)
189 define Package/wpa-cli
192 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpad-mini||PACKAGE_wpad
193 TITLE:=WPA Supplicant command line interface
196 define Package/wpa-cli/Description
197 WPA Supplicant control utility
201 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
202 define Build/Configure/rebuild
203 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
204 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
205 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
206 rm -f $(PKG_BUILD_DIR)/.config_*
207 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
211 define Build/Configure
212 $(Build/Configure/rebuild)
213 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
214 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
218 -I$(STAGING_DIR)/usr/include/libnl-tiny \
219 -I$(PKG_BUILD_DIR)/src/crypto \
221 -I$(CURDIR)/madwifi \
224 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
226 TARGET_CFLAGS += -ffunction-sections -fdata-sections
227 TARGET_LDFLAGS += -Wl,--gc-sections
229 ifdef CONFIG_PACKAGE_kmod-mac80211
230 TARGET_LDFLAGS += -lm -lnl-tiny
234 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
235 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
236 $(TARGET_CONFIGURE_OPTS) \
238 LIBS="$(TARGET_LDFLAGS)" \
243 define Build/Compile/wpad
245 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
246 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
247 sed -e 's,-n ,,g' -e 's,$(TARGET_CFLAGS),,' \
248 ` > $(PKG_BUILD_DIR)/.cflags
249 +$(call Build/RunMake,hostapd, \
250 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
252 hostapd_cli hostapd_multi.a \
254 +$(call Build/RunMake,wpa_supplicant, \
255 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
257 wpa_cli wpa_supplicant_multi.a \
259 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
261 ./files/multicall.c \
262 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
263 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
267 define Build/Compile/hostapd
268 $(call Build/RunMake,hostapd, \
269 hostapd hostapd_cli \
273 define Build/Compile/supplicant
274 $(call Build/RunMake,wpa_supplicant, \
275 wpa_cli wpa_supplicant \
280 $(Build/Compile/$(LOCAL_TYPE))
283 define Install/hostapd
284 $(INSTALL_DIR) $(1)/lib/wifi
285 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
286 $(INSTALL_DIR) $(1)/usr/sbin
289 define Install/supplicant
290 $(INSTALL_DIR) $(1)/lib/wifi
291 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
292 $(INSTALL_DIR) $(1)/usr/sbin
295 define Package/hostapd/install
296 $(call Install/hostapd,$(1))
297 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
299 Package/hostapd-mini/install = $(Package/hostapd/install)
301 ifneq ($(LOCAL_TYPE),supplicant)
302 define Package/hostapd-utils/install
303 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/hotplug.d/button
304 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
305 $(INSTALL_DATA) ./files/wps-hotplug.sh $(1)/etc/hotplug.d/button/50-wps
306 $(if $(CONFIG_PROCD_INIT),
307 $(INSTALL_DIR) $(1)/etc/rc.button/
308 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps,
309 $(INSTALL_DATA) ./files/wps-hotplug.sh $(1)/etc/hotplug.d/button/50-wps
314 define Package/wpad/install
315 $(call Install/hostapd,$(1))
316 $(call Install/supplicant,$(1))
317 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
318 ln -sf wpad $(1)/usr/sbin/hostapd
319 ln -sf wpad $(1)/usr/sbin/wpa_supplicant
321 Package/wpad-mini/install = $(Package/wpad/install)
323 define Package/wpa-supplicant/install
324 $(call Install/supplicant,$(1))
325 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
327 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
329 ifneq ($(LOCAL_TYPE),hostapd)
330 define Package/wpa-cli/install
331 $(INSTALL_DIR) $(1)/usr/sbin
332 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
336 $(eval $(call BuildPackage,hostapd))
337 $(eval $(call BuildPackage,hostapd-mini))
338 $(eval $(call BuildPackage,wpad))
339 $(eval $(call BuildPackage,wpad-mini))
340 $(eval $(call BuildPackage,wpa-supplicant))
341 $(eval $(call BuildPackage,wpa-supplicant-mini))
342 $(eval $(call BuildPackage,wpa-cli))
343 $(eval $(call BuildPackage,hostapd-utils))