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:=762b99db7a76803d1ad274e87caa6fe870d47441
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:=fa3227c146cb50732fe8511ce6d1d862
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||TARGET_etrax)||BROKEN)
91 define Package/hostapd/Default
94 TITLE:=IEEE 802.1x Authenticator
95 URL:=http://hostap.epitest.fi/
96 DEPENDS:=$(DRV_DEPENDS)
97 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
100 define Package/hostapd
101 $(call Package/hostapd/Default)
106 define Package/hostapd/description
107 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
111 define Package/hostapd-mini
112 $(call Package/hostapd/Default)
113 TITLE+= (WPA-PSK only)
117 define Package/hostapd-mini/description
118 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
121 define Package/hostapd-utils
122 $(call Package/hostapd/Default)
124 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
127 define Package/hostapd-utils/description
128 This package contains a command line utility to control the
129 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
132 define Package/wpad/Default
135 TITLE:=IEEE 802.1x Authenticator/Supplicant
136 URL:=http://hostap.epitest.fi/
137 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
141 $(call Package/wpad/Default)
143 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
147 define Package/wpad/description
148 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
149 Authenticator and Supplicant
152 define Package/wpad-mini
153 $(call Package/wpad/Default)
154 TITLE+= (WPA-PSK only)
155 DEPENDS:=$(DRV_DEPENDS)
159 define Package/wpad-mini/description
160 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
163 define Package/wpa-supplicant
166 TITLE:=WPA Supplicant
167 URL:=http://hostap.epitest.fi/wpa_supplicant/
168 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
169 VARIANT:=supplicant-full
170 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
173 define Package/wpa-supplicant/Description
177 define Package/wpa-supplicant/config
178 source "$(SOURCE)/Config.in"
181 define Package/wpa-supplicant-mini
182 $(Package/wpa-supplicant)
183 TITLE:=WPA Supplicant (minimal version)
184 DEPENDS:=$(DRV_DEPENDS)
185 VARIANT:=supplicant-mini
188 define Package/wpa-supplicant-mini/Description
189 WPA Supplicant (minimal version)
192 define Package/wpa-cli
195 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpad-mini||PACKAGE_wpad
196 TITLE:=WPA Supplicant command line interface
197 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
200 define Package/wpa-cli/Description
201 WPA Supplicant control utility
205 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
206 define Build/Configure/rebuild
207 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
208 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
209 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
210 rm -f $(PKG_BUILD_DIR)/.config_*
211 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
215 define Build/Configure
216 $(Build/Configure/rebuild)
217 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
218 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
222 -I$(STAGING_DIR)/usr/include/libnl-tiny \
223 -I$(PKG_BUILD_DIR)/src/crypto \
225 -I$(STAGING_DIR)/usr/include/madwifi \
228 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
230 TARGET_CFLAGS += -ffunction-sections -fdata-sections
231 TARGET_LDFLAGS += -Wl,--gc-sections
233 ifdef CONFIG_PACKAGE_kmod-mac80211
234 TARGET_LDFLAGS += -lm -lnl-tiny
238 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
239 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
240 $(TARGET_CONFIGURE_OPTS) \
242 LIBS="$(TARGET_LDFLAGS)" \
247 define Build/Compile/wpad
249 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
250 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
251 sed -e 's,-n ,,g' -e 's,$(TARGET_CFLAGS),,' \
252 ` > $(PKG_BUILD_DIR)/.cflags
253 +$(call Build/RunMake,hostapd, \
254 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
256 hostapd_cli hostapd_multi.a \
258 +$(call Build/RunMake,wpa_supplicant, \
259 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
261 wpa_cli wpa_supplicant_multi.a \
263 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
265 ./files/multicall.c \
266 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
267 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
271 define Build/Compile/hostapd
272 $(call Build/RunMake,hostapd, \
273 hostapd hostapd_cli \
277 define Build/Compile/supplicant
278 $(call Build/RunMake,wpa_supplicant, \
279 wpa_cli wpa_supplicant \
284 $(Build/Compile/$(LOCAL_TYPE))
287 define Install/hostapd
288 $(INSTALL_DIR) $(1)/lib/wifi
289 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
290 $(INSTALL_DIR) $(1)/usr/sbin
293 define Install/supplicant
294 $(INSTALL_DIR) $(1)/lib/wifi
295 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
296 $(INSTALL_DIR) $(1)/usr/sbin
299 define Package/hostapd/install
300 $(call Install/hostapd,$(1))
301 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
303 Package/hostapd-mini/install = $(Package/hostapd/install)
305 ifneq ($(LOCAL_TYPE),supplicant)
306 define Package/hostapd-utils/install
307 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/hotplug.d/button
308 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
309 $(INSTALL_DATA) ./files/wps-hotplug.sh $(1)/etc/hotplug.d/button/50-wps
313 define Package/wpad/install
314 $(call Install/hostapd,$(1))
315 $(call Install/supplicant,$(1))
316 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
317 ln -sf wpad $(1)/usr/sbin/hostapd
318 ln -sf wpad $(1)/usr/sbin/wpa_supplicant
320 Package/wpad-mini/install = $(Package/wpad/install)
322 define Package/wpa-supplicant/install
323 $(call Install/supplicant,$(1))
324 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
326 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
328 ifneq ($(LOCAL_TYPE),hostapd)
329 define Package/wpa-cli/install
330 $(INSTALL_DIR) $(1)/usr/sbin
331 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
335 $(eval $(call BuildPackage,hostapd))
336 $(eval $(call BuildPackage,hostapd-mini))
337 $(eval $(call BuildPackage,wpad))
338 $(eval $(call BuildPackage,wpad-mini))
339 $(eval $(call BuildPackage,wpa-supplicant))
340 $(eval $(call BuildPackage,wpa-supplicant-mini))
341 $(eval $(call BuildPackage,wpa-cli))
342 $(eval $(call BuildPackage,hostapd-utils))