85f42dc6a19761612452c391d4db46a0b680ea95
[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:=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 endef
78
79 define Build/CompileTarget
80         $(MAKE) -C $(PKG_BUILD_DIR)_$(1) \
81                 $(TARGET_CONFIGURE_OPTS) \
82                 OPTFLAGS="$(TARGET_CFLAGS)" \
83                 CPPFLAGS="$(TARGET_CPPFLAGS) -I$(STAGING_DIR)/usr/include/madwifi" \
84                 LDFLAGS="$(TARGET_LDFLAGS)" \
85                 hostapd hostapd_cli
86         $(CP) $(PKG_BUILD_DIR)_$(1)/hostapd_cli $(PKG_BUILD_DIR)/
87 endef
88
89 define Package/InstallTemplate
90         if [ \! -f "$(PKG_BUILD_DIR)_$(2)/hostapd" ]; then \
91                 rm -f $(PKG_BUILD_DIR)/.built; \
92                 $(MAKE) $(PKG_BUILD_DIR)/.built; \
93         fi
94         $(INSTALL_DIR) $$(1)/lib/wifi
95         $(INSTALL_DATA) ./files/hostapd.sh $$(1)/lib/wifi/hostapd.sh
96         $(INSTALL_DIR) $$(1)/etc
97 ifneq ($(CONFIG_PACKAGE_kmod-madwifi),)
98         $(INSTALL_CONF) $(PKG_BUILD_DIR)_$(2)/madwifi.conf $$(1)/etc/hostapd.conf
99 else
100         $(INSTALL_CONF) $(PKG_BUILD_DIR)_$(2)/hostapd.conf $$(1)/etc/hostapd.conf
101 endif
102         $(INSTALL_DIR) $$(1)/usr/sbin
103         $(INSTALL_BIN) $(PKG_BUILD_DIR)_$(2)/hostapd $$(1)/usr/sbin/
104 endef
105
106 define Package/Template
107  ifneq ($(CONFIG_PACKAGE_$(1)),)
108   define Build/Configure/$(2)
109         $(call Build/ConfigureTarget,$(2))
110   endef
111   define Build/Compile/$(2)
112         $(call Build/CompileTarget,$(2))
113   endef
114   define Package/$(1)/install
115         $(call Package/InstallTemplate,$(1),$(2))
116   endef
117  endif
118 endef
119
120 define Build/Configure
121         $(call Build/Configure/default)
122         $(call Build/Configure/mini)
123 endef
124
125 define Build/Compile
126         $(call Build/Compile/default)
127         $(call Build/Compile/mini)
128 endef
129
130 define Build/Clean
131         rm -rf $(PKG_BUILD_DIR)_default
132         rm -rf $(PKG_BUILD_DIR)_mini
133 endef
134
135 define Package/hostapd-utils/install
136         $(INSTALL_DIR) $(1)/usr/sbin
137         $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
138 endef
139
140 $(eval $(call Package/Template,hostapd,default))
141 $(eval $(call Package/Template,hostapd-mini,mini))
142
143 $(eval $(call BuildPackage,hostapd))
144 $(eval $(call BuildPackage,hostapd-mini))
145 $(eval $(call BuildPackage,hostapd-utils))