hostapd: update hostapd to 2015-03-25
[openwrt/openwrt.git] / package / network / services / hostapd / Makefile
1 #
2 # Copyright (C) 2006-2014 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:=2015-03-25
12 PKG_RELEASE:=1
13 PKG_REV:=8278138e679174b1ec8af7f169c2810a8888e202
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 PKG_LICENSE:=BSD-3-Clause
24
25 PKG_BUILD_PARALLEL:=1
26
27 PKG_CONFIG_DEPENDS:= \
28 CONFIG_WPA_SUPPLICANT_NO_TIMESTAMP_CHECK \
29 CONFIG_PACKAGE_kmod-ath9k \
30 CONFIG_PACKAGE_kmod-cfg80211 \
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 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(CONFIG_WPA_MSG_MIN_PRIORITY)
58
59 ifneq ($(CONFIG_DRIVER_11N_SUPPORT),)
60 HOSTAPD_IEEE80211N:=y
61 endif
62
63 DRIVER_MAKEOPTS= \
64 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-cfg80211) \
65 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
66 CONFIG_IEEE80211N=$(HOSTAPD_IEEE80211N) \
67 CONFIG_IEEE80211W=$(CONFIG_PACKAGE_kmod-ath9k) \
68 CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
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 ifdef CONFIG_WPA_RFKILL_SUPPORT
81 DRIVER_MAKEOPTS += NEED_RFKILL=y
82 endif
83 DRIVER_MAKEOPTS += \
84 CONFIG_DRIVER_ROBOSWITCH=$(CONFIG_PACKAGE_kmod-switch)
85 endif
86
87 ifdef CONFIG_USE_GLIBC
88 TARGET_LDFLAGS += -lrt
89 TARGET_LDFLAGS_C += -lrt
90 endif
91
92 DRV_DEPENDS:=+PACKAGE_kmod-cfg80211:libnl-tiny
93
94 define Package/hostapd/Default
95 SECTION:=net
96 CATEGORY:=Network
97 TITLE:=IEEE 802.1x Authenticator
98 URL:=http://hostap.epitest.fi/
99 DEPENDS:=$(DRV_DEPENDS) +libubus
100 endef
101
102 define Package/hostapd
103 $(call Package/hostapd/Default)
104 TITLE+= (full)
105 VARIANT:=full
106 CONFLICTS:=wpad wpad-mini
107 endef
108
109 define Package/hostapd/description
110 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
111 Authenticator.
112 endef
113
114 define Package/hostapd-mini
115 $(call Package/hostapd/Default)
116 TITLE+= (WPA-PSK only)
117 VARIANT:=mini
118 CONFLICTS:=wpad wpad-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 CONFLICTS:=wpad wpad-mini
173 VARIANT:=supplicant-full
174 endef
175
176 define Package/wpa-supplicant/Description
177 WPA Supplicant
178 endef
179
180 define Package/wpa-supplicant/config
181 source "$(SOURCE)/Config.in"
182 endef
183
184 define Package/wpa-supplicant-p2p
185 $(Package/wpa-supplicant)
186 TITLE:=WPA Supplicant (with Wi-Fi P2P support)
187 DEPENDS:=$(DRV_DEPENDS)
188 CONFLICTS:=wpad wpad-mini
189 VARIANT:=supplicant-p2p
190 endef
191
192 define Package/wpa-supplicant-p2p/Description
193 WPA Supplicant (with Wi-Fi P2P support)
194 endef
195
196 define Package/wpa-supplicant-mini
197 $(Package/wpa-supplicant)
198 TITLE:=WPA Supplicant (minimal version)
199 DEPENDS:=$(DRV_DEPENDS)
200 CONFLICTS:=wpad wpad-mini
201 VARIANT:=supplicant-mini
202 endef
203
204 define Package/wpa-supplicant-mini/Description
205 WPA Supplicant (minimal version)
206 endef
207
208 define Package/wpa-cli
209 SECTION:=net
210 CATEGORY:=Network
211 DEPENDS:=@PACKAGE_wpa-supplicant||PACKAGE_wpa-supplicant-p2p||PACKAGE_wpad-mini||PACKAGE_wpad
212 TITLE:=WPA Supplicant command line interface
213 endef
214
215 define Package/wpa-cli/Description
216 WPA Supplicant control utility
217 endef
218
219 define Package/hostapd-common
220 TITLE:=hostapd/wpa_supplicant common support files
221 SECTION:=net
222 CATEGORY:=Network
223 endef
224
225 define Package/hostapd-common-old
226 TITLE:=hostapd/wpa_supplicant common support files (legacy drivers)
227 SECTION:=net
228 CATEGORY:=Network
229 endef
230
231 define Package/eapol-test
232 TITLE:=802.1x authentication test utility
233 SECTION:=net
234 CATEGORY:=Network
235 VARIANT:=supplicant-full
236 DEPENDS:=$(DRV_DEPENDS)
237 endef
238
239
240 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
241 define Build/Configure/rebuild
242 $(FIND) $(PKG_BUILD_DIR) -name \*.o -or -name \*.a | $(XARGS) rm -f
243 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
244 rm -f $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant
245 rm -f $(PKG_BUILD_DIR)/.config_*
246 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
247 endef
248 endif
249
250 define Build/Configure
251 $(Build/Configure/rebuild)
252 $(if $(wildcard ./files/hostapd-$(LOCAL_VARIANT).config), \
253 $(CP) ./files/hostapd-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config \
254 )
255 $(CP) ./files/wpa_supplicant-$(LOCAL_VARIANT).config $(PKG_BUILD_DIR)/wpa_supplicant/.config
256 endef
257
258 TARGET_CPPFLAGS := \
259 -I$(STAGING_DIR)/usr/include/libnl-tiny \
260 -I$(PKG_BUILD_DIR)/src/crypto \
261 $(TARGET_CPPFLAGS) \
262 -DCONFIG_LIBNL20 \
263 -D_GNU_SOURCE \
264 $(if $(CONFIG_WPA_MSG_MIN_PRIORITY),-DCONFIG_MSG_MIN_PRIORITY=$(CONFIG_WPA_MSG_MIN_PRIORITY))
265
266 TARGET_CFLAGS += -ffunction-sections -fdata-sections
267 TARGET_LDFLAGS += -Wl,--gc-sections
268 ifeq ($(findstring supplicant,$(BUILD_VARIANT)),)
269 TARGET_LDFLAGS += -lubox -lubus
270 endif
271
272 ifdef CONFIG_PACKAGE_kmod-cfg80211
273 TARGET_LDFLAGS += -lm -lnl-tiny
274 endif
275
276 define Build/RunMake
277 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
278 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(1) \
279 $(TARGET_CONFIGURE_OPTS) \
280 $(DRIVER_MAKEOPTS) \
281 LIBS="$(TARGET_LDFLAGS)" \
282 LIBS_c="$(TARGET_LDFLAGS_C)" \
283 BCHECK= \
284 $(2)
285 endef
286
287 define Build/Compile/wpad
288 echo ` \
289 $(call Build/RunMake,hostapd,-s MULTICALL=1 dump_cflags); \
290 $(call Build/RunMake,wpa_supplicant,-s MULTICALL=1 dump_cflags) | \
291 sed -e 's,-n ,,g' -e 's^$(TARGET_CFLAGS)^^' \
292 ` > $(PKG_BUILD_DIR)/.cflags
293 +$(call Build/RunMake,hostapd, \
294 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
295 MULTICALL=1 \
296 hostapd_cli hostapd_multi.a \
297 )
298 +$(call Build/RunMake,wpa_supplicant, \
299 CFLAGS="$$$$(cat $(PKG_BUILD_DIR)/.cflags)" \
300 MULTICALL=1 \
301 wpa_cli wpa_supplicant_multi.a \
302 )
303 $(TARGET_CC) -o $(PKG_BUILD_DIR)/wpad \
304 $(TARGET_CFLAGS) \
305 ./files/multicall.c \
306 $(PKG_BUILD_DIR)/hostapd/hostapd_multi.a \
307 $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant_multi.a \
308 $(TARGET_LDFLAGS)
309 endef
310
311 define Build/Compile/hostapd
312 $(call Build/RunMake,hostapd, \
313 hostapd hostapd_cli \
314 )
315 endef
316
317 define Build/Compile/supplicant
318 $(call Build/RunMake,wpa_supplicant, \
319 wpa_cli wpa_supplicant \
320 )
321 endef
322
323 define Build/Compile/supplicant-full
324 $(call Build/RunMake,wpa_supplicant, \
325 eapol_test \
326 )
327 endef
328
329 define Build/Compile
330 $(Build/Compile/$(LOCAL_TYPE))
331 $(Build/Compile/$(BUILD_VARIANT))
332 endef
333
334 define Install/hostapd
335 $(INSTALL_DIR) $(1)/usr/sbin
336 endef
337
338 define Install/supplicant
339 $(INSTALL_DIR) $(1)/usr/sbin
340 endef
341
342 define Package/hostapd-common/install
343 $(INSTALL_DIR) $(1)/lib/netifd
344 $(INSTALL_DATA) ./files/netifd.sh $(1)/lib/netifd/hostapd.sh
345 endef
346
347 define Package/hostapd-common-old/install
348 $(INSTALL_DIR) $(1)/lib/wifi
349 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
350 $(INSTALL_DATA) ./files/wpa_supplicant.sh $(1)/lib/wifi/wpa_supplicant.sh
351 endef
352
353 define Package/hostapd/install
354 $(call Install/hostapd,$(1))
355 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
356 endef
357 Package/hostapd-mini/install = $(Package/hostapd/install)
358
359 ifneq ($(LOCAL_TYPE),supplicant)
360 define Package/hostapd-utils/install
361 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/rc.button
362 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
363 $(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
364 endef
365 endif
366
367 define Package/wpad/install
368 $(call Install/hostapd,$(1))
369 $(call Install/supplicant,$(1))
370 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpad $(1)/usr/sbin/
371 $(LN) wpad $(1)/usr/sbin/hostapd
372 $(LN) wpad $(1)/usr/sbin/wpa_supplicant
373 endef
374 Package/wpad-mini/install = $(Package/wpad/install)
375
376 define Package/wpa-supplicant/install
377 $(call Install/supplicant,$(1))
378 $(INSTALL_BIN) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_supplicant $(1)/usr/sbin/
379 endef
380 Package/wpa-supplicant-mini/install = $(Package/wpa-supplicant/install)
381 Package/wpa-supplicant-p2p/install = $(Package/wpa-supplicant/install)
382
383 ifneq ($(LOCAL_TYPE),hostapd)
384 define Package/wpa-cli/install
385 $(INSTALL_DIR) $(1)/usr/sbin
386 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/wpa_cli $(1)/usr/sbin/
387 endef
388 endif
389
390 ifeq ($(BUILD_VARIANT),supplicant-full)
391 define Package/eapol-test/install
392 $(INSTALL_DIR) $(1)/usr/sbin
393 $(CP) $(PKG_BUILD_DIR)/wpa_supplicant/eapol_test $(1)/usr/sbin/
394 endef
395 endif
396
397 $(eval $(call BuildPackage,hostapd))
398 $(eval $(call BuildPackage,hostapd-mini))
399 $(eval $(call BuildPackage,wpad))
400 $(eval $(call BuildPackage,wpad-mini))
401 $(eval $(call BuildPackage,wpa-supplicant))
402 $(eval $(call BuildPackage,wpa-supplicant-mini))
403 $(eval $(call BuildPackage,wpa-supplicant-p2p))
404 $(eval $(call BuildPackage,wpa-cli))
405 $(eval $(call BuildPackage,hostapd-utils))
406 $(eval $(call BuildPackage,hostapd-common))
407 $(eval $(call BuildPackage,hostapd-common-old))
408 $(eval $(call BuildPackage,eapol-test))