2 # Copyright (C) 2006-2009 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:=43a7fe2e0e614e52fa05ff4d78af91bd4e17d3b2
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
17 PKG_SOURCE_SUBDIR:=hostapd-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=$(PKG_REV)
22 PACKAGE_kmod-madwifi:madwifi \
23 PACKAGE_kmod-mac80211:mac80211 \
25 PKG_CONFIG_DEPENDS:= \
26 CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
27 CONFIG_PACKAGE_kmod-ath9k \
28 CONFIG_PACKAGE_kmod-mac80211 \
29 CONFIG_PACKAGE_kmod-madwifi \
30 CONFIG_PACKAGE_hostapd \
31 CONFIG_PACKAGE_hostapd-mini \
32 CONFIG_PACKAGE_kmod-hostap
35 $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
36 $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
39 LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
41 ifeq ($(LOCAL_TYPE),supplicant)
42 ifeq ($(LOCAL_VARIANT),full)
43 PKG_CONFIG_DEPENDS += \
44 CONFIG_WPA_SUPPLICANT_INTERNAL \
45 CONFIG_WPA_SUPPLICANT_OPENSSL
49 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
51 include $(INCLUDE_DIR)/package.mk
54 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-mac80211) \
55 CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
56 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
57 CONFIG_IEEE80211N=$(CONFIG_PACKAGE_kmod-ath9k)
59 ifeq ($(LOCAL_TYPE),supplicant)
60 ifeq ($(LOCAL_VARIANT),full)
61 DRIVER_MAKEOPTS += $(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),CONFIG_TLS=openssl)
65 ifneq ($(LOCAL_TYPE),hostapd)
66 ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
67 TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
69 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
73 define Package/hostapd/Default
76 TITLE:=IEEE 802.1x Authenticator
77 URL:=http://hostap.epitest.fi/
78 DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
81 define Package/hostapd
82 $(call Package/hostapd/Default)
87 define Package/hostapd/description
88 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
92 define Package/hostapd-mini
93 $(call Package/hostapd/Default)
94 TITLE+= (WPA-PSK only)
98 define Package/hostapd-mini/description
99 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
102 define Package/hostapd-utils
103 $(call Package/hostapd/Default)
105 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini
108 define Package/hostapd-utils/description
109 This package contains a command line utility to control the
110 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
113 define Package/wpad/Default
116 TITLE:=IEEE 802.1x Authenticator/Supplicant
117 URL:=http://hostap.epitest.fi/
118 DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
122 $(call Package/wpad/Default)
127 define Package/wpad/description
128 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
129 Authenticator and Supplicant
132 define Package/wpad-mini
133 $(call Package/wpad/Default)
134 TITLE+= (WPA-PSK only)
138 define Package/wpad-mini/description
139 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
142 define Package/wpa-supplicant
145 TITLE:=WPA Supplicant
146 URL:=http://hostap.epitest.fi/wpa_supplicant/
147 DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
148 VARIANT:=supplicant-full
151 define Package/wpa-supplicant/Description
155 define Package/wpa-supplicant/config
156 source "$(SOURCE)/Config.in"
159 define Package/wpa-supplicant-mini
160 $(Package/wpa-supplicant)
161 TITLE:=WPA Supplicant (minimal version)
162 DEPENDS:=$(if $(CONFIG_WPA_SUPPLICANT_OPENSSL),+libopenssl)
163 VARIANT:=supplicant-mini
166 define Package/wpa-supplicant-mini/Description
167 WPA Supplicant (minimal version)
170 define Package/wpa-cli
173 DEPENDS:=wpa-supplicant
174 TITLE:=WPA Supplicant command line interface
177 define Package/wpa-cli/Description
178 WPA Supplicant control utility
182 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
183 define Build/Configure/rebuild
184 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
185 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
186 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
187 rm -f $(PKG_BUILD_DIR)/.config_*
188 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
192 define Build/Configure
193 $(Build/Configure/rebuild)
194 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
195 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
199 -I$(STAGING_DIR)/usr/include/libnl-tiny \
200 -I$(PKG_BUILD_DIR)/src/crypto \
202 -I$(STAGING_DIR)/usr/include/madwifi \
203 -I$(STAGING_DIR)/usr/include/mac80211 \
207 ifdef CONFIG_PACKAGE_kmod-mac80211
208 TARGET_LDFLAGS += -lm -lnl-tiny
212 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
213 $(MAKE) -C $(PKG_BUILD_DIR)/$(1) \
214 $(TARGET_CONFIGURE_OPTS) \
216 LIBS="$(TARGET_LDFLAGS)" \
220 define Build/Compile/wpad
222 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
223 $(call Build/RunMake,wpa_supplicant,-s dump_cflags) | sed -e 's,$(TARGET_CFLAGS),,' \
224 ` > $(PKG_BUILD_DIR)/.cflags
225 $(call Build/RunMake,hostapd, \
226 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
228 hostapd_cli hostapd_multi.a \
230 $(call Build/RunMake,wpa_supplicant, \
231 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
233 wpa_cli wpa_supplicant_multi.a \
235 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
237 ./files/multicall.c \
238 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
239 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
243 define Build/Compile/hostapd
244 $(call Build/RunMake,hostapd, \
245 hostapd hostapd_cli \
249 define Build/Compile/supplicant
250 $(call Build/RunMake,wpa_supplicant, \
251 wpa_cli wpa_supplicant \
256 $(Build/Compile/$(LOCAL_TYPE))
259 define Install/hostapd
260 $(INSTALL_DIR) $(1)/etc/hotplug.d/net
261 $(INSTALL_DATA) ./files/hostapd.hotplug $(1)/etc/hotplug.d/net/
262 $(INSTALL_DIR) $(1)/lib/wifi
263 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
264 $(INSTALL_DIR) $(1)/usr/sbin
267 define Install/supplicant
268 $(INSTALL_DIR) $(1)/lib/wifi
269 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
270 $(INSTALL_DIR) $(1)/usr/sbin
273 define Package/hostapd/install
274 $(call Install/hostapd,$(1))
275 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
277 Package/hostapd-mini/install = $(Package/hostapd/install)
279 ifneq ($(LOCAL_TYPE),supplicant)
280 define Package/hostapd-utils/install
281 $(INSTALL_DIR) $(1)/usr/sbin
282 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
286 define Package/wpad/install
287 $(call Install/hostapd,$(1))
288 $(call Install/supplicant,$(1))
289 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
290 ln -sf wpad $(1)/usr/sbin/hostapd
291 ln -sf wpad $(1)/usr/sbin/wpa_supplicant
293 Package/wpad-mini/install = $(Package/wpad/install)
295 define Package/wpa-supplicant/install
296 $(call Install/supplicant,$(1))
297 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
299 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
301 ifneq ($(LOCAL_TYPE),hostapd)
302 define Package/wpa-cli/install
303 $(INSTALL_DIR) $(1)/usr/sbin
304 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
308 $(eval $(call BuildPackage,hostapd))
309 $(eval $(call BuildPackage,hostapd-mini))
310 $(eval $(call BuildPackage,wpad))
311 $(eval $(call BuildPackage,wpad-mini))
312 $(eval $(call BuildPackage,wpa-supplicant))
313 $(eval $(call BuildPackage,wpa-supplicant-mini))
314 $(eval $(call BuildPackage,wpa-cli))
315 $(eval $(call BuildPackage,hostapd-utils))