mac80211: update to wireless-testing 2011-10-05 + pending patches
[openwrt.git] / package / hostapd / Makefile
1 #
2 # Copyright (C) 2006-2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=hostapd
11 PKG_VERSION:=20110527
12 PKG_RELEASE:=2
13 PKG_REV:=ceb34f250af7a7082f18c1e0451dc7fbc0f000f3
14
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)
19 PKG_SOURCE_PROTO:=git
20 PKG_MIRROR_MD5SUM:=4b98902d782813b41aca1faff613f677
21
22 PKG_BUILD_DEPENDS:= \
23 PACKAGE_kmod-madwifi:madwifi \
24 PACKAGE_kmod-mac80211:mac80211 \
25
26 PKG_CONFIG_DEPENDS:= \
27 CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
28 CONFIG_PACKAGE_kmod-ath9k \
29 CONFIG_PACKAGE_kmod-mac80211 \
30 CONFIG_PACKAGE_kmod-madwifi \
31 CONFIG_PACKAGE_hostapd \
32 CONFIG_PACKAGE_hostapd-mini \
33 CONFIG_PACKAGE_kmod-hostap \
34 CONFIG_WPA_RFKILL_SUPPORT \
35 CONFIG_DRIVER_WEXT_SUPPORT \
36 CONFIG_DRIVER_11N_SUPPORT
37
38 LOCAL_TYPE=$(strip \
39 $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
40 $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
41 hostapd \
42 )))
43 LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
44
45 ifeq ($(LOCAL_TYPE),supplicant)
46 ifeq ($(LOCAL_VARIANT),full)
47 PKG_CONFIG_DEPENDS += \
48 CONFIG_WPA_SUPPLICANT_INTERNAL \
49 CONFIG_WPA_SUPPLICANT_OPENSSL
50 endif
51 endif
52
53 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
54
55 include $(INCLUDE_DIR)/package.mk
56
57 ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
58 HOSTAPD_IEEE80211N:=y
59 endif
60
61 DRIVER_MAKEOPTS= \
62 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-mac80211) \
63 CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
64 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
65 CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
66 CONFIG_IEEE80211W=$(CONFIG_PACKAGE_kmod-ath9k) \
67 CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
68 $(if $(CONFIG_WPA_RFKILL_SUPPORT),NEED_RFKILL=y)
69
70 ifneq ($(LOCAL_TYPE),hostapd)
71 ifdef CONFIG_WPA_SUPPLICANT_OPENSSL
72 ifeq ($(LOCAL_VARIANT),full)
73 DRIVER_MAKEOPTS += CONFIG_TLS=openssl
74 TARGET_LDFLAGS += -lcrypto -lssl
75 endif
76 endif
77 ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
78 TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
79 endif
80 DRIVER_MAKEOPTS += \
81 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
82 endif
83
84 DRV_DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny @(!(TARGET_avr32||TARGET_etrax)||BROKEN)
85
86 define Package/hostapd/Default
87 SECTION:=net
88 CATEGORY:=Network
89 TITLE:=IEEE 802.1x Authenticator
90 URL:=http://hostap.epitest.fi/
91 DEPENDS:=$(DRV_DEPENDS)
92 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
93 endef
94
95 define Package/hostapd
96 $(call Package/hostapd/Default)
97 TITLE+= (full)
98 VARIANT:=full
99 endef
100
101 define Package/hostapd/description
102 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
103 Authenticator.
104 endef
105
106 define Package/hostapd-mini
107 $(call Package/hostapd/Default)
108 TITLE+= (WPA-PSK only)
109 VARIANT:=mini
110 endef
111
112 define Package/hostapd-mini/description
113 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
114 endef
115
116 define Package/hostapd-utils
117 $(call Package/hostapd/Default)
118 TITLE+= (utils)
119 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
120 endef
121
122 define Package/hostapd-utils/description
123 This package contains a command line utility to control the
124 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
125 endef
126
127 define Package/wpad/Default
128 SECTION:=net
129 CATEGORY:=Network
130 TITLE:=IEEE 802.1x Authenticator/Supplicant
131 URL:=http://hostap.epitest.fi/
132 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
133 endef
134
135 define Package/wpad
136 $(call Package/wpad/Default)
137 TITLE+= (full)
138 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
139 VARIANT:=wpad-full
140 endef
141
142 define Package/wpad/description
143 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
144 Authenticator and Supplicant
145 endef
146
147 define Package/wpad-mini
148 $(call Package/wpad/Default)
149 TITLE+= (WPA-PSK only)
150 DEPENDS:=$(DRV_DEPENDS)
151 VARIANT:=wpad-mini
152 endef
153
154 define Package/wpad-mini/description
155 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
156 endef
157
158 define Package/wpa-supplicant
159 SECTION:=net
160 CATEGORY:=Network
161 TITLE:=WPA Supplicant
162 URL:=http://hostap.epitest.fi/wpa_supplicant/
163 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
164 VARIANT:=supplicant-full
165 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
166 endef
167
168 define Package/wpa-supplicant/Description
169 WPA Supplicant
170 endef
171
172 define Package/wpa-supplicant/config
173 source "$(SOURCE)/Config.in"
174 endef
175
176 define Package/wpa-supplicant-mini
177 $(Package/wpa-supplicant)
178 TITLE:=WPA Supplicant (minimal version)
179 DEPENDS:=$(DRV_DEPENDS)
180 VARIANT:=supplicant-mini
181 endef
182
183 define Package/wpa-supplicant-mini/Description
184 WPA Supplicant (minimal version)
185 endef
186
187 define Package/wpa-cli
188 SECTION:=net
189 CATEGORY:=Network
190 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpad-mini||PACKAGE_wpad
191 TITLE:=WPA Supplicant command line interface
192 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
193 endef
194
195 define Package/wpa-cli/Description
196 WPA Supplicant control utility
197 endef
198
199
200 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
201 define Build/Configure/rebuild
202 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
203 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
204 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
205 rm -f $(PKG_BUILD_DIR)/.config_*
206 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
207 endef
208 endif
209
210 define Build/Configure
211 $(Build/Configure/rebuild)
212 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
213 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
214 endef
215
216 TARGET_CPPFLAGS := \
217 -I$(STAGING_DIR)/usr/include/libnl-tiny \
218 -I$(PKG_BUILD_DIR)/src/crypto \
219 $(TARGET_CPPFLAGS) \
220 -I$(STAGING_DIR)/usr/include/madwifi \
221 -I$(STAGING_DIR)/usr/include/mac80211 \
222 -DCONFIG_LIBNL20 \
223 -D_GNU_SOURCE
224
225 TARGET_CFLAGS += -ffunction-sections -fdata-sections
226 TARGET_LDFLAGS += -Wl,--gc-sections
227
228 ifdef CONFIG_PACKAGE_kmod-mac80211
229 TARGET_LDFLAGS += -lm -lnl-tiny
230 endif
231
232 define Build/RunMake
233 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
234 $(MAKE) -C $(PKG_BUILD_DIR)/$(1) \
235 $(TARGET_CONFIGURE_OPTS) \
236 $(DRIVER_MAKEOPTS) \
237 LIBS="$(TARGET_LDFLAGS)" \
238 $(2)
239 endef
240
241 define Build/Compile/wpad
242 echo ` \
243 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
244 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
245 sed -e 's,-n ,,g' -e 's,$(TARGET_CFLAGS),,' \
246 ` > $(PKG_BUILD_DIR)/.cflags
247 $(call Build/RunMake,hostapd, \
248 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
249 MULTICALL=1 \
250 hostapd_cli hostapd_multi.a \
251 )
252 $(call Build/RunMake,wpa_supplicant, \
253 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
254 MULTICALL=1 \
255 wpa_cli wpa_supplicant_multi.a \
256 )
257 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
258 $(TARGET_CFLAGS) \
259 ./files/multicall.c \
260 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
261 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
262 $(TARGET_LDFLAGS)
263 endef
264
265 define Build/Compile/hostapd
266 $(call Build/RunMake,hostapd, \
267 hostapd hostapd_cli \
268 )
269 endef
270
271 define Build/Compile/supplicant
272 $(call Build/RunMake,wpa_supplicant, \
273 wpa_cli wpa_supplicant \
274 )
275 endef
276
277 define Build/Compile
278 $(Build/Compile/$(LOCAL_TYPE))
279 endef
280
281 define Install/hostapd
282 $(INSTALL_DIR) $(1)/lib/wifi
283 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
284 $(INSTALL_DIR) $(1)/usr/sbin
285 endef
286
287 define Install/supplicant
288 $(INSTALL_DIR) $(1)/lib/wifi
289 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
290 $(INSTALL_DIR) $(1)/usr/sbin
291 endef
292
293 define Package/hostapd/install
294 $(call Install/hostapd,$(1))
295 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
296 endef
297 Package/hostapd-mini/install = $(Package/hostapd/install)
298
299 ifneq ($(LOCAL_TYPE),supplicant)
300 define Package/hostapd-utils/install
301 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/hotplug.d/button
302 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
303 $(INSTALL_DATA) ./files/wps-hotplug.sh $(1)/etc/hotplug.d/button/50-wps
304 endef
305 endif
306
307 define Package/wpad/install
308 $(call Install/hostapd,$(1))
309 $(call Install/supplicant,$(1))
310 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
311 ln -sf wpad $(1)/usr/sbin/hostapd
312 ln -sf wpad $(1)/usr/sbin/wpa_supplicant
313 endef
314 Package/wpad-mini/install = $(Package/wpad/install)
315
316 define Package/wpa-supplicant/install
317 $(call Install/supplicant,$(1))
318 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
319 endef
320 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
321
322 ifneq ($(LOCAL_TYPE),hostapd)
323 define Package/wpa-cli/install
324 $(INSTALL_DIR) $(1)/usr/sbin
325 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
326 endef
327 endif
328
329 $(eval $(call BuildPackage,hostapd))
330 $(eval $(call BuildPackage,hostapd-mini))
331 $(eval $(call BuildPackage,wpad))
332 $(eval $(call BuildPackage,wpad-mini))
333 $(eval $(call BuildPackage,wpa-supplicant))
334 $(eval $(call BuildPackage,wpa-supplicant-mini))
335 $(eval $(call BuildPackage,wpa-cli))
336 $(eval $(call BuildPackage,hostapd-utils))
This page took 0.053572 seconds and 5 git commands to generate.