fcea01710efa5e4bcf1d1a6a7f2c6829192eb83e
[openwrt/openwrt.git] / package / hostapd / Makefile
1 #
2 # Copyright (C) 2006-2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=hostapd
12 PKG_VERSION:=0.6.7
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/
17 PKG_SOURCE_SUBDIR:=hostapd-$(PKG_VERSION)
18 PKG_SOURCE_VERSION:=$(PKG_REV)
19 PKG_MD5SUM:=0ce66cd5768235b5d2299f9efb9225d8
20 PKG_BUILD_DEPENDS:=PACKAGE_kmod-madwifi:madwifi PACKAGE_kmod-mac80211:mac80211 PACKAGE_kmod-mac80211:libnl
21
22 include $(INCLUDE_DIR)/package.mk
23
24 PKG_CONFDEPS := \
25 CONFIG_PACKAGE_kmod-ath9k \
26 CONFIG_PACKAGE_kmod-mac80211 \
27 CONFIG_PACKAGE_kmod-madwifi \
28 CONFIG_PACKAGE_hostapd \
29 CONFIG_PACKAGE_hostapd-mini
30
31 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(call confvar,$(PKG_CONFDEPS))
32
33 DRIVER_MAKEOPTS= \
34 CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-mac80211) \
35 CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
36 CONFIG_IEEE80211N=$(CONFIG_PACKAGE_kmod-ath9k)
37
38 define Package/hostapd/Default
39 SECTION:=net
40 CATEGORY:=Network
41 TITLE:=IEEE 802.1x Authenticator
42 URL:=http://hostap.epitest.fi/
43 DEPENDS:=@!TARGET_avr32 @!TARGET_etrax
44 endef
45
46 define Package/hostapd
47 $(call Package/hostapd/Default)
48 TITLE+= (full)
49 DEPENDS+= +PACKAGE_hostapd:libopenssl
50 endef
51
52 #define Package/hostapd/conffiles
53 #/etc/hostapd.conf
54 #endef
55
56 define Package/hostapd/description
57 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
58 Authenticator.
59 endef
60
61 define Package/hostapd-mini
62 $(call Package/hostapd/Default)
63 TITLE+= (WPA-PSK only)
64 endef
65
66 #define Package/hostapd-mini/conffiles
67 #/etc/hostapd.conf
68 #endef
69
70 define Package/hostapd-mini/description
71 This package contains a minimal IEEE 802.1x/WPA/EAP/RADIUS Authenticator
72 (WPA-PSK only).
73 endef
74
75 define Package/hostapd-utils
76 $(call Package/hostapd/Default)
77 TITLE+= (utils)
78 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini
79 endef
80
81 define Package/hostapd-utils/description
82 This package contains a command line utility to control the
83 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
84 endef
85
86 define Build/ConfigureTarget
87 rm -rf $(PKG_BUILD_DIR)/hostapd.$(1)
88 mkdir -p $(PKG_BUILD_DIR)/hostapd.$(1)
89 $(CP) \
90 $(PKG_BUILD_DIR)/hostapd \
91 $(PKG_BUILD_DIR)/src \
92 $(PKG_BUILD_DIR)/hostapd.$(1)/
93 $(CP) ./files/$(1).config $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/.config
94 endef
95
96 define Build/CompileTarget
97 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/madwifi -I$(STAGING_DIR)/usr/include/mac80211 -I$(STAGING_DIR)/usr/include/libnl -I$(STAGING_DIR)/usr/include" \
98 $(MAKE) -C $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd \
99 $(TARGET_CONFIGURE_OPTS) \
100 $(DRIVER_MAKEOPTS) \
101 LIBS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib \
102 $(if $(CONFIG_PACKAGE_kmod-mac80211),-lm $(STAGING_DIR)/usr/lib/libnl.a) \
103 $(if $(findstring default,$(1)),-lssl -lcrypto)" \
104 hostapd hostapd_cli
105 $(CP) $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/hostapd_cli $(PKG_BUILD_DIR)/
106 endef
107
108 define Package/InstallTemplate
109 $(INSTALL_DIR) $$(1)/lib/wifi
110 $(INSTALL_DATA) ./files/hostapd.sh $$(1)/lib/wifi/hostapd.sh
111 $(INSTALL_DIR) $$(1)/usr/sbin
112 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd $$(1)/usr/sbin/
113 # config is managed through uci
114 # $(INSTALL_DIR) $$(1)/etc
115 # $(INSTALL_CONF) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd.conf $$(1)/etc/hostapd.conf
116 endef
117
118 define Package/Template
119 ifneq ($(CONFIG_PACKAGE_$(1)),)
120 define Build/Configure/$(2)
121 $(call Build/ConfigureTarget,$(2))
122 endef
123 define Build/Compile/$(2)
124 $(call Build/CompileTarget,$(2))
125 endef
126 define Package/$(1)/install
127 $(call Package/InstallTemplate,$(1),$(2))
128 endef
129 endif
130 endef
131
132 define Build/Configure
133 rm -f $(PKG_BUILD_DIR)/.configured*
134 $(call Build/Configure/default)
135 $(call Build/Configure/mini)
136 endef
137
138 define Build/Compile
139 $(call Build/Compile/default)
140 $(call Build/Compile/mini)
141 endef
142
143 define Build/Clean
144 rm -rf $(PKG_BUILD_DIR)_default
145 rm -rf $(PKG_BUILD_DIR)_mini
146 endef
147
148 define Package/hostapd-utils/install
149 $(INSTALL_DIR) $(1)/usr/sbin
150 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
151 endef
152
153 $(eval $(call Package/Template,hostapd,default))
154 $(eval $(call Package/Template,hostapd-mini,mini))
155
156 $(eval $(call BuildPackage,hostapd))
157 $(eval $(call BuildPackage,hostapd-mini))
158 $(eval $(call BuildPackage,hostapd-utils))