source: branches/backfire/package/hostapd/Makefile @ 21354

Last change on this file since 21354 was 21354, checked in by nbd, 7 years ago

[backfire] backport mac80211 and hostapd from trunk

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