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