0c1d6fc776758e3ed386324b242c30f9f18bc1db
[openwrt-10.03/.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:=0.6.9
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://hostap.epitest.fi/releases/
16 PKG_SOURCE_SUBDIR:=hostapd-$(PKG_VERSION)
17 PKG_SOURCE_VERSION:=$(PKG_REV)
18 PKG_MD5SUM:=83630d11fa66ade9091f1b304fccd74c
19
20 PKG_BUILD_DEPENDS:= \
21         PACKAGE_kmod-madwifi:madwifi \
22         PACKAGE_kmod-mac80211:mac80211 \
23         PACKAGE_kmod-mac80211:libnl \
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
32 include $(INCLUDE_DIR)/package.mk
33
34 DRIVER_MAKEOPTS= \
35         CONFIG_DRIVER_NL80211=$(CONFIG_PACKAGE_kmod-mac80211) \
36         CONFIG_DRIVER_MADWIFI=$(CONFIG_PACKAGE_kmod-madwifi) \
37         CONFIG_IEEE80211N=$(CONFIG_PACKAGE_kmod-ath9k)
38
39 define Package/hostapd/Default
40   SECTION:=net
41   CATEGORY:=Network
42   TITLE:=IEEE 802.1x Authenticator
43   URL:=http://hostap.epitest.fi/
44   DEPENDS:=@!TARGET_avr32 @!TARGET_etrax
45 endef
46
47 define Package/hostapd
48 $(call Package/hostapd/Default)
49   TITLE+= (full)
50   DEPENDS+= +PACKAGE_hostapd:libopenssl
51 endef
52
53 #define Package/hostapd/conffiles
54 #/etc/hostapd.conf
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 endef
66
67 #define Package/hostapd-mini/conffiles
68 #/etc/hostapd.conf
69 #endef
70
71 define Package/hostapd-mini/description
72  This package contains a minimal IEEE 802.1x/WPA/EAP/RADIUS Authenticator
73  (WPA-PSK only).
74 endef
75
76 define Package/hostapd-utils
77   $(call Package/hostapd/Default)
78   TITLE+= (utils)
79   DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini
80 endef
81
82 define Package/hostapd-utils/description
83  This package contains a command line utility to control the
84  IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
85 endef
86
87 define Build/ConfigureTarget
88         rm -rf $(PKG_BUILD_DIR)/hostapd.$(1)
89         mkdir -p $(PKG_BUILD_DIR)/hostapd.$(1)
90         $(CP) \
91                 $(PKG_BUILD_DIR)/hostapd \
92                 $(PKG_BUILD_DIR)/src \
93                 $(PKG_BUILD_DIR)/hostapd.$(1)/
94         $(CP) ./files/$(1).config $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/.config
95 endef
96
97 define Build/CompileTarget
98         CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/madwifi -I$(STAGING_DIR)/usr/include/mac80211 -I$(STAGING_DIR)/usr/include/libnl $(TARGET_CPPFLAGS)" \
99         $(MAKE) -C $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd \
100                 $(TARGET_CONFIGURE_OPTS) \
101                 $(DRIVER_MAKEOPTS) \
102                 LIBS="$(TARGET_LDFLAGS) \
103                         $(if $(CONFIG_PACKAGE_kmod-mac80211),-lm $(STAGING_DIR)/usr/lib/libnl.a) \
104                         $(if $(findstring default,$(1)),-lssl -lcrypto)" \
105                 hostapd hostapd_cli
106         $(CP) $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/hostapd_cli $(PKG_BUILD_DIR)/
107 endef
108
109 define Package/InstallTemplate
110         $(INSTALL_DIR) $$(1)/lib/wifi
111         $(INSTALL_DATA) ./files/hostapd.sh $$(1)/lib/wifi/hostapd.sh
112         $(INSTALL_DIR) $$(1)/usr/sbin
113         $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd $$(1)/usr/sbin/
114 # config is managed through uci
115 #       $(INSTALL_DIR) $$(1)/etc
116 #       $(INSTALL_CONF) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd.conf $$(1)/etc/hostapd.conf
117 endef
118
119 define Package/Template
120  ifneq ($(CONFIG_PACKAGE_$(1)),)
121   define Build/Configure/$(2)
122         $(call Build/ConfigureTarget,$(2))
123   endef
124   define Build/Compile/$(2)
125         $(call Build/CompileTarget,$(2))
126   endef
127   define Package/$(1)/install
128         $(call Package/InstallTemplate,$(1),$(2))
129   endef
130  endif
131 endef
132
133 define Build/Configure
134         rm -f $(PKG_BUILD_DIR)/.configured*
135         $(call Build/Configure/default)
136         $(call Build/Configure/mini)
137 endef
138
139 define Build/Compile
140         $(call Build/Compile/default)
141         $(call Build/Compile/mini)
142 endef
143
144 define Build/Clean
145         rm -rf $(PKG_BUILD_DIR)_default
146         rm -rf $(PKG_BUILD_DIR)_mini
147 endef
148
149 define Package/hostapd-utils/install
150         $(INSTALL_DIR) $(1)/usr/sbin
151         $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
152 endef
153
154 $(eval $(call Package/Template,hostapd,default))
155 $(eval $(call Package/Template,hostapd-mini,mini))
156
157 $(eval $(call BuildPackage,hostapd))
158 $(eval $(call BuildPackage,hostapd-mini))
159 $(eval $(call BuildPackage,hostapd-utils))