fix hostap dependencies
[openwrt-10.03/.git] / package / hostapd / Makefile
1
2 # Copyright (C) 2006 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.5.8
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_MD5SUM:=40416b48cae9c78e5a2452caf214aff3
18
19 PKG_BUILD_DEPENDS:= mac80211 madwifi
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/hostapd/Default
24   SECTION:=net
25   CATEGORY:=Network
26   TITLE:=IEEE 802.1x Authenticator
27   URL:=http://hostap.epitest.fi/
28   DEPENDS:=@!TARGET_avr32 @!TARGET_etrax
29 endef
30
31 define Package/hostapd
32 $(call Package/hostapd/Default)
33   TITLE+= (full)
34   DEPENDS+= +libopenssl
35 endef
36
37 define Package/hostapd/conffiles
38 /etc/hostapd.conf
39 endef
40
41 define Package/hostapd/description
42  This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS 
43  Authenticator.
44 endef
45
46 define Package/hostapd-mini
47 $(call Package/hostapd/Default)
48   TITLE+= (WPA-PSK only)
49 endef
50
51 define Package/hostapd-mini/conffiles
52 /etc/hostapd.conf
53 endef
54
55 define Package/hostapd-mini/description
56  This package contains a minimal IEEE 802.1x/WPA/EAP/RADIUS Authenticator 
57  (WPA-PSK only).
58 endef
59
60 define Package/hostapd-utils
61   $(call Package/hostapd/Default)
62   TITLE+= (utils)
63   DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini
64 endef
65
66 define Package/hostapd-utils/description
67  This package contains a command line utility to control the 
68  IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
69 endef
70
71 define Build/ConfigureTarget
72         $(CP) $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)_$(1)
73         $(CP) ./files/$(1).config $(PKG_BUILD_DIR)_$(1)/.config
74 ifneq ($(CONFIG_PACKAGE_kmod-madwifi),)
75         echo "CONFIG_DRIVER_MADWIFI=y" >> $(PKG_BUILD_DIR)_$(1)/.config
76 endif
77 ifneq ($(CONFIG_PACKAGE_kmod-mac80211),)
78         echo "CONFIG_DRIVER_DEVICESCAPE=y" >> $(PKG_BUILD_DIR)_$(1)/.config
79 endif
80 endef
81
82 define Build/CompileTarget
83         $(MAKE) -C $(PKG_BUILD_DIR)_$(1) \
84                 $(TARGET_CONFIGURE_OPTS) \
85                 OPTFLAGS="$(TARGET_CFLAGS)" \
86                 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/include/madwifi -I$(STAGING_DIR)/usr/include/mac80211" \
87                 LDFLAGS="$(TARGET_LDFLAGS)" \
88                 hostapd hostapd_cli
89         $(CP) $(PKG_BUILD_DIR)_$(1)/hostapd_cli $(PKG_BUILD_DIR)/
90 endef
91
92 define Package/InstallTemplate
93         if [ \! -f "$(PKG_BUILD_DIR)_$(2)/hostapd" ]; then \
94                 rm -f $(PKG_BUILD_DIR)/.built; \
95                 $(MAKE) $(PKG_BUILD_DIR)/.built; \
96         fi
97         $(INSTALL_DIR) $$(1)/lib/wifi
98         $(INSTALL_DATA) ./files/hostapd.sh $$(1)/lib/wifi/hostapd.sh
99         $(INSTALL_DIR) $$(1)/etc
100 ifneq ($(CONFIG_PACKAGE_kmod-madwifi),)
101         $(INSTALL_CONF) $(PKG_BUILD_DIR)_$(2)/madwifi.conf $$(1)/etc/hostapd.conf
102 else
103         $(INSTALL_CONF) $(PKG_BUILD_DIR)_$(2)/hostapd.conf $$(1)/etc/hostapd.conf
104 endif
105         $(INSTALL_DIR) $$(1)/usr/sbin
106         $(INSTALL_BIN) $(PKG_BUILD_DIR)_$(2)/hostapd $$(1)/usr/sbin/
107 endef
108
109 define Package/Template
110  ifneq ($(CONFIG_PACKAGE_$(1)),)
111   define Build/Configure/$(2)
112         $(call Build/ConfigureTarget,$(2))
113   endef
114   define Build/Compile/$(2)
115         $(call Build/CompileTarget,$(2))
116   endef
117   define Package/$(1)/install
118         $(call Package/InstallTemplate,$(1),$(2))
119   endef
120  endif
121 endef
122
123 define Build/Configure
124         $(call Build/Configure/default)
125         $(call Build/Configure/mini)
126 endef
127
128 define Build/Compile
129         $(call Build/Compile/default)
130         $(call Build/Compile/mini)
131 endef
132
133 define Build/Clean
134         rm -rf $(PKG_BUILD_DIR)_default
135         rm -rf $(PKG_BUILD_DIR)_mini
136 endef
137
138 define Package/hostapd-utils/install
139         $(INSTALL_DIR) $(1)/usr/sbin
140         $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
141 endef
142
143 $(eval $(call Package/Template,hostapd,default))
144 $(eval $(call Package/Template,hostapd-mini,mini))
145
146 $(eval $(call BuildPackage,hostapd))
147 $(eval $(call BuildPackage,hostapd-mini))
148 $(eval $(call BuildPackage,hostapd-utils))