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:=594516b4c28a94ca686b17f1e463dfd6712b75a7
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>
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 ifdef CONFIG_USE_EGLIBC
90 TARGET_LDFLAGS += -lrt
93 DRV_DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny @(!TARGET_avr32||BROKEN)
95 define Package/hostapd/Default
98 TITLE:=IEEE 802.1x Authenticator
99 URL:=http://hostap.epitest.fi/
100 DEPENDS:=$(DRV_DEPENDS) +libubus
103 define Package/hostapd
104 $(call Package/hostapd/Default)
109 define Package/hostapd/description
110 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
114 define Package/hostapd-mini
115 $(call Package/hostapd/Default)
116 TITLE+= (WPA-PSK only)
120 define Package/hostapd-mini/description
121 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
124 define Package/hostapd-utils
125 $(call Package/hostapd/Default)
127 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
130 define Package/hostapd-utils/description
131 This package contains a command line utility to control the
132 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
135 define Package/wpad/Default
138 TITLE:=IEEE 802.1x Authenticator/Supplicant
139 URL:=http://hostap.epitest.fi/
143 $(call Package/wpad/Default)
145 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +libubus
149 define Package/wpad/description
150 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
151 Authenticator and Supplicant
154 define Package/wpad-mini
155 $(call Package/wpad/Default)
156 TITLE+= (WPA-PSK only)
157 DEPENDS:=$(DRV_DEPENDS) +libubus
161 define Package/wpad-mini/description
162 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
165 define Package/wpa-supplicant
168 TITLE:=WPA Supplicant
169 URL:=http://hostap.epitest.fi/wpa_supplicant/
170 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
171 VARIANT:=supplicant-full
174 define Package/wpa-supplicant/Description
178 define Package/wpa-supplicant/config
179 source "$(SOURCE)/Config.in"
182 define Package/wpa-supplicant-p2p
183 $(Package/wpa-supplicant)
184 TITLE:=WPA Supplicant (with Wi-Fi P2P support)
185 DEPENDS:=$(DRV_DEPENDS)
186 VARIANT:=supplicant-p2p
189 define Package/wpa-supplicant-p2p/Description
190 WPA Supplicant (with Wi-Fi P2P support)
193 define Package/wpa-supplicant-mini
194 $(Package/wpa-supplicant)
195 TITLE:=WPA Supplicant (minimal version)
196 DEPENDS:=$(DRV_DEPENDS)
197 VARIANT:=supplicant-mini
200 define Package/wpa-supplicant-mini/Description
201 WPA Supplicant (minimal version)
204 define Package/wpa-cli
207 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad
208 TITLE:=WPA Supplicant command line interface
211 define Package/wpa-cli/Description
212 WPA Supplicant control utility
215 define Package/hostapd-common
216 TITLE:=hostapd/wpa_supplicant common support files
221 define Package/hostapd-common-old
222 TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
227 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
228 define Build/Configure/rebuild
229 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
230 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
231 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
232 rm -f $(PKG_BUILD_DIR)/.config_*
233 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
237 define Build/Configure
238 $(Build/Configure/rebuild)
239 $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
240 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
242 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
246 -I$(STAGING_DIR)/usr/include/libnl-tiny \
247 -I$(PKG_BUILD_DIR)/src/crypto \
249 -I$(CURDIR)/madwifi \
252 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
254 TARGET_CFLAGS += -ffunction-sections -fdata-sections
255 TARGET_LDFLAGS += -Wl,--gc-sections
256 ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
257 TARGET_LDFLAGS += -lubox -lubus
260 ifdef CONFIG_PACKAGE_kmod-mac80211
261 TARGET_LDFLAGS += -lm -lnl-tiny
265 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
266 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
267 $(TARGET_CONFIGURE_OPTS) \
269 LIBS="$(TARGET_LDFLAGS)" \
275 define Build/Compile/wpad
277 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
278 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
279 sed -e 's,-n ,,g' -e 's,$(TARGET_CFLAGS),,' \
280 ` > $(PKG_BUILD_DIR)/.cflags
281 +$(call Build/RunMake,hostapd, \
282 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
284 hostapd_cli hostapd_multi.a \
286 +$(call Build/RunMake,wpa_supplicant, \
287 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
289 wpa_cli wpa_supplicant_multi.a \
291 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
293 ./files/multicall.c \
294 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
295 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
299 define Build/Compile/hostapd
300 $(call Build/RunMake,hostapd, \
301 hostapd hostapd_cli \
305 define Build/Compile/supplicant
306 $(call Build/RunMake,wpa_supplicant, \
307 wpa_cli wpa_supplicant \
312 $(Build/Compile/$(LOCAL_TYPE))
315 define Install/hostapd
316 $(INSTALL_DIR) $(1)/usr/sbin
319 define Install/supplicant
320 $(INSTALL_DIR) $(1)/usr/sbin
323 define Package/hostapd-common/install
324 $(INSTALL_DIR) $(1)/lib/netifd
325 $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
328 define Package/hostapd-common-old/install
329 $(INSTALL_DIR) $(1)/lib/wifi
330 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
331 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
334 define Package/hostapd/install
335 $(call Install/hostapd,$(1))
336 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
338 Package/hostapd-mini/install = $(Package/hostapd/install)
340 ifneq ($(LOCAL_TYPE),supplicant)
341 define Package/hostapd-utils/install
342 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
343 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
344 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
348 define Package/wpad/install
349 $(call Install/hostapd,$(1))
350 $(call Install/supplicant,$(1))
351 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
352 ln -sf wpad $(1)/usr/sbin/hostapd
353 ln -sf wpad $(1)/usr/sbin/wpa_supplicant
355 Package/wpad-mini/install = $(Package/wpad/install)
357 define Package/wpa-supplicant/install
358 $(call Install/supplicant,$(1))
359 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
361 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
362 Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
364 ifneq ($(LOCAL_TYPE),hostapd)
365 define Package/wpa-cli/install
366 $(INSTALL_DIR) $(1)/usr/sbin
367 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
371 $(eval $(call BuildPackage,hostapd))
372 $(eval $(call BuildPackage,hostapd-mini))
373 $(eval $(call BuildPackage,wpad))
374 $(eval $(call BuildPackage,wpad-mini))
375 $(eval $(call BuildPackage,wpa-supplicant))
376 $(eval $(call BuildPackage,wpa-supplicant-mini))
377 $(eval $(call BuildPackage,wpa-supplicant-p2p))
378 $(eval $(call BuildPackage,wpa-cli))
379 $(eval $(call BuildPackage,hostapd-utils))
380 $(eval $(call BuildPackage,hostapd-common))
381 $(eval $(call BuildPackage,hostapd-common-old))