hostapd: upgrade to latest version
[openwrt/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:=20100108
12 PKG_RELEASE:=1
13 PKG_REV:=d97572a40fd7ec77094e2e4ef83424a4c0f7e24d
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_PACKAGE_kmod-ath9k \
27 CONFIG_PACKAGE_kmod-mac80211 \
28 CONFIG_PACKAGE_kmod-madwifi \
29 CONFIG_PACKAGE_hostapd \
30 CONFIG_PACKAGE_hostapd-mini \
31 CONFIG_PACKAGE_kmod-hostap
32
33 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
34
35 include $(INCLUDE_DIR)/package.mk
36
37 DRIVER_MAKEOPTS= \
38 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-mac80211) \
39 CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
40 CONFIG_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
41 CONFIG_IEEE80211N=$(CONFIG_PACKAGE_kmod-ath9k)
42
43 define Package/hostapd/Default
44 SECTION:=net
45 CATEGORY:=Network
46 TITLE:=IEEE 802.1x Authenticator
47 URL:=http://hostap.epitest.fi/
48 DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
49 endef
50
51 define Package/hostapd
52 $(call Package/hostapd/Default)
53 TITLE+= (full)
54 VARIANT:=full
55 endef
56
57 define Package/hostapd/description
58 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
59 Authenticator.
60 endef
61
62 define Package/hostapd-mini
63 $(call Package/hostapd/Default)
64 TITLE+= (WPA-PSK only)
65 VARIANT:=mini
66 endef
67
68 define Package/hostapd-mini/description
69 This package contains a minimal IEEE 802.1x/WPA Authenticator (WPA-PSK only).
70 endef
71
72 define Package/hostapd-utils
73 $(call Package/hostapd/Default)
74 TITLE+= (utils)
75 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini
76 endef
77
78 define Package/hostapd-utils/description
79 This package contains a command line utility to control the
80 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
81 endef
82
83 ifneq ($(wildcard $(PKG_BUILD_DIR)/.config_*),$(subst .configured_,.config_,$(STAMP_CONFIGURED)))
84 $(warning $(wildcard $(PKG_BUILD_DIR)/.config_*) != $(subst .configured_,.config_,$(STAMP_CONFIGURED)))
85 define Build/Configure/rebuild
86 rm -f $(PKG_BUILD_DIR)/hostapd/hostapd
87 rm -f $(PKG_BUILD_DIR)/hostapd/*.o
88 rm -f $(PKG_BUILD_DIR)/src/drivers/drivers.o
89 rm -f $(PKG_BUILD_DIR)/.config_*
90 touch $(subst .configured_,.config_,$(STAMP_CONFIGURED))
91 endef
92 endif
93
94 define Build/Configure
95 $(Build/Configure/rebuild)
96 $(CP) ./files/$(BUILD_VARIANT).config $(PKG_BUILD_DIR)/hostapd/.config
97 endef
98
99 TARGET_CPPFLAGS := \
100 -I$(STAGING_DIR)/usr/include/libnl-tiny \
101 -I$(PKG_BUILD_DIR)/src/crypto \
102 $(TARGET_CPPFLAGS) \
103 -I$(STAGING_DIR)/usr/include/madwifi \
104 -I$(STAGING_DIR)/usr/include/mac80211 \
105 -DCONFIG_LIBNL20 \
106 -D_GNU_SOURCE
107
108 ifdef CONFIG_PACKAGE_kmod-mac80211
109 TARGET_LDFLAGS += -lm -lnl-tiny
110 endif
111
112 define Build/Compile
113 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
114 $(MAKE) -C $(PKG_BUILD_DIR)/hostapd \
115 $(TARGET_CONFIGURE_OPTS) \
116 $(DRIVER_MAKEOPTS) \
117 LIBS="$(TARGET_LDFLAGS)" \
118 hostapd hostapd_cli
119 endef
120
121 define Package/hostapd/install
122 $(INSTALL_DIR) $(1)/etc/hotplug.d/net
123 $(INSTALL_DATA) ./files/hostapd.hotplug $(1)/etc/hotplug.d/net/
124 $(INSTALL_DIR) $(1)/lib/wifi
125 $(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/wifi/hostapd.sh
126 $(INSTALL_DIR) $(1)/usr/sbin
127 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd $(1)/usr/sbin/
128 endef
129 Package/hostapd-mini/install = $(Package/hostapd/install)
130
131 define Package/hostapd-utils/install
132 $(INSTALL_DIR) $(1)/usr/sbin
133 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd/hostapd_cli $(1)/usr/sbin/
134 endef
135
136 $(eval $(call BuildPackage,hostapd))
137 $(eval $(call BuildPackage,hostapd-mini))
138 $(eval $(call BuildPackage,hostapd-utils))