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