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