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