31ef18d8be78f0642906f916bfdb94797f913443
[openwrt/svn-archive/archive.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_REV:=03ec0ec5cdb974d51a4a2a566bea4c4568138576
13 PKG_VERSION:=20071107_$(PKG_REV)
14 PKG_RELEASE:=1
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=git://w1.fi/srv/git/hostap.git
18 PKG_SOURCE_SUBDIR:=hostapd-$(PKG_VERSION)
19 PKG_SOURCE_VERSION:=$(PKG_REV)
20 PKG_BUILD_DEPENDS:=madwifi mac80211
21
22 include $(INCLUDE_DIR)/package.mk
23 $(eval $(call confvar,STAMP_CONFIGURED,CONFIG_PACKAGE_kmod-mac80211 CONFIG_PACKAGE_kmod-madwifi))
24
25 define Package/hostapd/Default
26 SECTION:=net
27 CATEGORY:=Network
28 TITLE:=IEEE 802.1x Authenticator
29 URL:=http://hostap.epitest.fi/
30 DEPENDS:=@!TARGET_avr32 @!TARGET_etrax $(if $(DUMP)$(CONFIG_LINUX_2_6_23),+libnl)
31 endef
32
33 define Package/hostapd
34 $(call Package/hostapd/Default)
35 TITLE+= (full)
36 DEPENDS+= +libopenssl
37 endef
38
39 #define Package/hostapd/conffiles
40 #/etc/hostapd.conf
41 #endef
42
43 define Package/hostapd/description
44 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
45 Authenticator.
46 endef
47
48 define Package/hostapd-mini
49 $(call Package/hostapd/Default)
50 TITLE+= (WPA-PSK only)
51 endef
52
53 #define Package/hostapd-mini/conffiles
54 #/etc/hostapd.conf
55 #endef
56
57 define Package/hostapd-mini/description
58 This package contains a minimal IEEE 802.1x/WPA/EAP/RADIUS Authenticator
59 (WPA-PSK only).
60 endef
61
62 define Package/hostapd-utils
63 $(call Package/hostapd/Default)
64 TITLE+= (utils)
65 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini
66 endef
67
68 define Package/hostapd-utils/description
69 This package contains a command line utility to control the
70 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
71 endef
72
73 define Build/ConfigureTarget
74 rm -rf $(PKG_BUILD_DIR)/hostapd.$(1)
75 $(CP) $(PKG_BUILD_DIR)/hostapd $(PKG_BUILD_DIR)/hostapd.$(1)
76 $(CP) ./files/$(1).config $(PKG_BUILD_DIR)/hostapd.$(1)/.config
77 $(if $(CONFIG_PACKAGE_kmod-mac80211),,$(SED) 's,^CONFIG_DRIVER_DEVICESCAPE,#CONFIG_DRIVER_DEVICESCAPE,g' $(PKG_BUILD_DIR)/hostapd.$(1)/.config)
78 $(if $(CONFIG_PACKAGE_kmod-madwifi),,$(SED) 's,^CONFIG_DRIVER_MADWIFI,#CONFIG_DRIVER_MADWIFI,g' $(PKG_BUILD_DIR)/hostapd.$(1)/.config)
79 endef
80
81 define Build/CompileTarget
82 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/madwifi -I$(STAGING_DIR)/usr/include/mac80211 -I$(STAGING_DIR)/usr/include" \
83 $(MAKE) -C $(PKG_BUILD_DIR)/hostapd.$(1) \
84 $(TARGET_CONFIGURE_OPTS) \
85 LIBS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib \
86 $(if $(CONFIG_PACKAGE_kmod-mac80211),-lm $(STAGING_DIR)/usr/lib/libnl.a)" \
87 hostapd hostapd_cli
88 $(CP) $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd_cli $(PKG_BUILD_DIR)/
89 endef
90
91 define Package/InstallTemplate
92 $(INSTALL_DIR) $$(1)/lib/wifi
93 $(INSTALL_DATA) ./files/hostapd.sh $$(1)/lib/wifi/hostapd.sh
94 # config is managed through uci
95 # $(INSTALL_DIR) $$(1)/etc
96 # $(INSTALL_CONF) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd.conf $$(1)/etc/hostapd.conf
97 $(INSTALL_DIR) $$(1)/usr/sbin
98 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd $$(1)/usr/sbin/
99 endef
100
101 define Package/Template
102 ifneq ($(CONFIG_PACKAGE_$(1)),)
103 define Build/Configure/$(2)
104 $(call Build/ConfigureTarget,$(2))
105 endef
106 define Build/Compile/$(2)
107 $(call Build/CompileTarget,$(2))
108 endef
109 define Package/$(1)/install
110 $(call Package/InstallTemplate,$(1),$(2))
111 endef
112 endif
113 endef
114
115 define Build/Configure
116 $(call Build/Configure/default)
117 $(call Build/Configure/mini)
118 endef
119
120 define Build/Compile
121 $(call Build/Compile/default)
122 $(call Build/Compile/mini)
123 endef
124
125 define Build/Clean
126 rm -rf $(PKG_BUILD_DIR)_default
127 rm -rf $(PKG_BUILD_DIR)_mini
128 endef
129
130 define Package/hostapd-utils/install
131 $(INSTALL_DIR) $(1)/usr/sbin
132 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
133 endef
134
135 $(eval $(call Package/Template,hostapd,default))
136 $(eval $(call Package/Template,hostapd-mini,mini))
137
138 $(eval $(call BuildPackage,hostapd))
139 $(eval $(call BuildPackage,hostapd-mini))
140 $(eval $(call BuildPackage,hostapd-utils))