hostapd: add a package for eapol_test
[openwrt/staging/dedeckeh.git] / package / network / services / hostapd / Makefile
1 #
2 # Copyright (C) 2006-2012 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:=2014-04-24
12 PKG_RELEASE:=1
13 PKG_REV:=3cf48c4f2e2d558130253457fea02ef4047cf8e1
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:=4e7c1f97edd7514535056fce54ae053a
21
22 PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
23
24 PKG_BUILD_PARALLEL:=1
25
26 PKG_BUILD_DEPENDS:= \
27 PACKAGE_kmod-madwifi:madwifi \
28
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
40
41 LOCAL_TYPE=$(strip \
42 $(if $(findstring wpad,$(BUILD_VARIANT)),wpad, \
43 $(if $(findstring supplicant,$(BUILD_VARIANT)),supplicant, \
44 hostapd \
45 )))
46 LOCAL_VARIANT=$(patsubst wpad-%,%,$(patsubst supplicant-%,%,$(BUILD_VARIANT)))
47
48 ifeq ($(LOCAL_TYPE),supplicant)
49 ifeq ($(LOCAL_VARIANT),full)
50 PKG_CONFIG_DEPENDS += \
51 CONFIG_WPA_SUPPLICANT_INTERNAL \
52 CONFIG_WPA_SUPPLICANT_OPENSSL
53 endif
54 endif
55
56 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
57
58 include $(INCLUDE_DIR)/package.mk
59
60 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
61
62 ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
63 HOSTAPD_IEEE80211N:=y
64 endif
65
66 DRIVER_MAKEOPTS= \
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)
74
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
80 endif
81 endif
82 ifdef CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK
83 TARGET_CFLAGS += -DNO_TIMESTAMP_CHECK
84 endif
85 DRIVER_MAKEOPTS += \
86 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
87 endif
88
89 ifdef CONFIG_USE_EGLIBC
90 TARGET_LDFLAGS += -lrt
91 TARGET_LDFLAGS_C += -lrt
92 endif
93
94 DRV_DEPENDS:=+PACKAGE_kmod-mac80211:libnl-tiny @(!TARGET_avr32||BROKEN)
95
96 define Package/hostapd/Default
97 SECTION:=net
98 CATEGORY:=Network
99 TITLE:=IEEE 802.1x Authenticator
100 URL:=http://hostap.epitest.fi/
101 DEPENDS:=$(DRV_DEPENDS) +libubus
102 endef
103
104 define Package/hostapd
105 $(call Package/hostapd/Default)
106 TITLE+= (full)
107 VARIANT:=full
108 endef
109
110 define Package/hostapd/description
111 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
112 Authenticator.
113 endef
114
115 define Package/hostapd-mini
116 $(call Package/hostapd/Default)
117 TITLE+= (WPA-PSK only)
118 VARIANT:=mini
119 endef
120
121 define Package/hostapd-mini/description
122 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
123 endef
124
125 define Package/hostapd-utils
126 $(call Package/hostapd/Default)
127 TITLE+= (utils)
128 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini||PACKAGE_wpad||PACKAGE_wpad-mini
129 endef
130
131 define Package/hostapd-utils/description
132 This package contains a command line utility to control the
133 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
134 endef
135
136 define Package/wpad/Default
137 SECTION:=net
138 CATEGORY:=Network
139 TITLE:=IEEE 802.1x Authenticator/Supplicant
140 URL:=http://hostap.epitest.fi/
141 endef
142
143 define Package/wpad
144 $(call Package/wpad/Default)
145 TITLE+= (full)
146 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl +libubus
147 VARIANT:=wpad-full
148 endef
149
150 define Package/wpad/description
151 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
152 Authenticator and Supplicant
153 endef
154
155 define Package/wpad-mini
156 $(call Package/wpad/Default)
157 TITLE+= (WPA-PSK only)
158 DEPENDS:=$(DRV_DEPENDS) +libubus
159 VARIANT:=wpad-mini
160 endef
161
162 define Package/wpad-mini/description
163 This package contains a minimal IEEE 802.1x/WPA Authenticator and Supplicant (WPA-PSK only).
164 endef
165
166 define Package/wpa-supplicant
167 SECTION:=net
168 CATEGORY:=Network
169 TITLE:=WPA Supplicant
170 URL:=http://hostap.epitest.fi/wpa_supplicant/
171 DEPENDS:=$(DRV_DEPENDS) +WPA_SUPPLICANT_OPENSSL:libopenssl
172 VARIANT:=supplicant-full
173 endef
174
175 define Package/wpa-supplicant/Description
176 WPA Supplicant
177 endef
178
179 define Package/wpa-supplicant/config
180 source "$(SOURCE)/Config.in"
181 endef
182
183 define Package/wpa-supplicant-p2p
184 $(Package/wpa-supplicant)
185 TITLE:=WPA Supplicant (with Wi-Fi P2P support)
186 DEPENDS:=$(DRV_DEPENDS)
187 VARIANT:=supplicant-p2p
188 endef
189
190 define Package/wpa-supplicant-p2p/Description
191 WPA Supplicant (with Wi-Fi P2P support)
192 endef
193
194 define Package/wpa-supplicant-mini
195 $(Package/wpa-supplicant)
196 TITLE:=WPA Supplicant (minimal version)
197 DEPENDS:=$(DRV_DEPENDS)
198 VARIANT:=supplicant-mini
199 endef
200
201 define Package/wpa-supplicant-mini/Description
202 WPA Supplicant (minimal version)
203 endef
204
205 define Package/wpa-cli
206 SECTION:=net
207 CATEGORY:=Network
208 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad
209 TITLE:=WPA Supplicant command line interface
210 endef
211
212 define Package/wpa-cli/Description
213 WPA Supplicant control utility
214 endef
215
216 define Package/hostapd-common
217 TITLE:=hostapd/wpa_supplicant common support files
218 SECTION:=net
219 CATEGORY:=Network
220 endef
221
222 define Package/hostapd-common-old
223 TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
224 SECTION:=net
225 CATEGORY:=Network
226 endef
227
228 define Package/eapol-test
229 TITLE:=802.1x authentication test utility
230 SECTION:=net
231 CATEGORY:=Network
232 VARIANT:=supplicant-full
233 DEPENDS:=$(DRV_DEPENDS)
234 endef
235
236
237 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
238 define Build/Configure/rebuild
239 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
240 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
241 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
242 rm -f $(PKG_BUILD_DIR)/.config_*
243 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
244 endef
245 endif
246
247 define Build/Configure
248 $(Build/Configure/rebuild)
249 $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
250 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
251 )
252 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
253 endef
254
255 TARGET_CPPFLAGS := \
256 -I$(STAGING_DIR)/usr/include/libnl-tiny \
257 -I$(PKG_BUILD_DIR)/src/crypto \
258 $(TARGET_CPPFLAGS) \
259 -I$(CURDIR)/madwifi \
260 -DCONFIG_LIBNL20 \
261 -D_GNU_SOURCE \
262 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
263
264 TARGET_CFLAGS += -ffunction-sections -fdata-sections
265 TARGET_LDFLAGS += -Wl,--gc-sections
266 ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
267 TARGET_LDFLAGS += -lubox -lubus
268 endif
269
270 ifdef CONFIG_PACKAGE_kmod-mac80211
271 TARGET_LDFLAGS += -lm -lnl-tiny
272 endif
273
274 define Build/RunMake
275 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
276 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
277 $(TARGET_CONFIGURE_OPTS) \
278 $(DRIVER_MAKEOPTS) \
279 LIBS="$(TARGET_LDFLAGS)" \
280 LIBS_c="$(TARGET_LDFLAGS_C)" \
281 BCHECK= \
282 $(2)
283 endef
284
285 define Build/Compile/wpad
286 echo ` \
287 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
288 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
289 sed -e 's,-n ,,g' -e 's,$(TARGET_CFLAGS),,' \
290 ` > $(PKG_BUILD_DIR)/.cflags
291 +$(call Build/RunMake,hostapd, \
292 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
293 MULTICALL=1 \
294 hostapd_cli hostapd_multi.a \
295 )
296 +$(call Build/RunMake,wpa_supplicant, \
297 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
298 MULTICALL=1 \
299 wpa_cli wpa_supplicant_multi.a \
300 )
301 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
302 $(TARGET_CFLAGS) \
303 ./files/multicall.c \
304 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
305 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
306 $(TARGET_LDFLAGS)
307 endef
308
309 define Build/Compile/hostapd
310 $(call Build/RunMake,hostapd, \
311 hostapd hostapd_cli \
312 )
313 endef
314
315 define Build/Compile/supplicant
316 $(call Build/RunMake,wpa_supplicant, \
317 wpa_cli wpa_supplicant \
318 )
319 endef
320
321 define Build/Compile/supplicant-full
322 $(call Build/RunMake,wpa_supplicant, \
323 eapol_test \
324 )
325 endef
326
327 define Build/Compile
328 $(Build/Compile/$(LOCAL_TYPE))
329 $(Build/Compile/$(BUILD_VARIANT))
330 endef
331
332 define Install/hostapd
333 $(INSTALL_DIR) $(1)/usr/sbin
334 endef
335
336 define Install/supplicant
337 $(INSTALL_DIR) $(1)/usr/sbin
338 endef
339
340 define Package/hostapd-common/install
341 $(INSTALL_DIR) $(1)/lib/netifd
342 $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
343 endef
344
345 define Package/hostapd-common-old/install
346 $(INSTALL_DIR) $(1)/lib/wifi
347 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
348 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
349 endef
350
351 define Package/hostapd/install
352 $(call Install/hostapd,$(1))
353 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
354 endef
355 Package/hostapd-mini/install = $(Package/hostapd/install)
356
357 ifneq ($(LOCAL_TYPE),supplicant)
358 define Package/hostapd-utils/install
359 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
360 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
361 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
362 endef
363 endif
364
365 define Package/wpad/install
366 $(call Install/hostapd,$(1))
367 $(call Install/supplicant,$(1))
368 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
369 ln -sf wpad $(1)/usr/sbin/hostapd
370 ln -sf wpad $(1)/usr/sbin/wpa_supplicant
371 endef
372 Package/wpad-mini/install = $(Package/wpad/install)
373
374 define Package/wpa-supplicant/install
375 $(call Install/supplicant,$(1))
376 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
377 endef
378 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
379 Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
380
381 ifneq ($(LOCAL_TYPE),hostapd)
382 define Package/wpa-cli/install
383 $(INSTALL_DIR) $(1)/usr/sbin
384 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
385 endef
386 endif
387
388 ifeq ($(BUILD_VARIANT),supplicant-full)
389 define Package/eapol-test/install
390 $(INSTALL_DIR) $(1)/usr/sbin
391 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
392 endef
393 endif
394
395 $(eval $(call BuildPackage,hostapd))
396 $(eval $(call BuildPackage,hostapd-mini))
397 $(eval $(call BuildPackage,wpad))
398 $(eval $(call BuildPackage,wpad-mini))
399 $(eval $(call BuildPackage,wpa-supplicant))
400 $(eval $(call BuildPackage,wpa-supplicant-mini))
401 $(eval $(call BuildPackage,wpa-supplicant-p2p))
402 $(eval $(call BuildPackage,wpa-cli))
403 $(eval $(call BuildPackage,hostapd-utils))
404 $(eval $(call BuildPackage,hostapd-common))
405 $(eval $(call BuildPackage,hostapd-common-old))
406 $(eval $(call BuildPackage,eapol-test))