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