build system: introduce a new feature called build variants.
[openwrt.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
24 PKG_CONFIG_DEPENDS:= \
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 CONFIG_PACKAGE_kmod-hostap
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_DRIVER_HOSTAP=$(CONFIG_PACKAGE_kmod-hostap) \
38 CONFIG_IEEE80211N=$(CONFIG_PACKAGE_kmod-ath9k)
39
40 define Package/hostapd/Default
41 SECTION:=net
42 CATEGORY:=Network
43 TITLE:=IEEE 802.1x Authenticator
44 URL:=http://hostap.epitest.fi/
45 DEPENDS:=@!TARGET_avr32 @!TARGET_etrax +PACKAGE_kmod-mac80211:libnl-tiny
46 endef
47
48 define Package/hostapd
49 $(call Package/hostapd/Default)
50 TITLE+= (full)
51 DEPENDS+= +PACKAGE_hostapd:libopenssl
52 endef
53
54 #define Package/hostapd/conffiles
55 #/etc/hostapd.conf
56 #endef
57
58 define Package/hostapd/description
59 This package contains a full featured IEEE 802.1x/WPA/EAP/RADIUS
60 Authenticator.
61 endef
62
63 define Package/hostapd-mini
64 $(call Package/hostapd/Default)
65 TITLE+= (WPA-PSK only)
66 endef
67
68 #define Package/hostapd-mini/conffiles
69 #/etc/hostapd.conf
70 #endef
71
72 define Package/hostapd-mini/description
73 This package contains a minimal IEEE 802.1x/WPA/EAP/RADIUS Authenticator
74 (WPA-PSK only).
75 endef
76
77 define Package/hostapd-utils
78 $(call Package/hostapd/Default)
79 TITLE+= (utils)
80 DEPENDS:=@PACKAGE_hostapd||PACKAGE_hostapd-mini
81 endef
82
83 define Package/hostapd-utils/description
84 This package contains a command line utility to control the
85 IEEE 802.1x/WPA/EAP/RADIUS Authenticator.
86 endef
87
88 define Build/ConfigureTarget
89 rm -rf $(PKG_BUILD_DIR)/hostapd.$(1)
90 mkdir -p $(PKG_BUILD_DIR)/hostapd.$(1)
91 $(CP) \
92 $(PKG_BUILD_DIR)/hostapd \
93 $(PKG_BUILD_DIR)/src \
94 $(PKG_BUILD_DIR)/hostapd.$(1)/
95 $(CP) ./files/$(1).config $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/.config
96 endef
97
98 TARGET_CPPFLAGS := \
99 -I$(STAGING_DIR)/usr/include/libnl-tiny \
100 -I$(PKG_BUILD_DIR)/src/crypto \
101 $(TARGET_CPPFLAGS) \
102 -I$(STAGING_DIR)/usr/include/madwifi \
103 -I$(STAGING_DIR)/usr/include/mac80211 \
104 -DCONFIG_LIBNL20 \
105 -D_GNU_SOURCE
106
107 define Build/CompileTarget
108 CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
109 $(MAKE) -C $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd \
110 $(TARGET_CONFIGURE_OPTS) \
111 $(DRIVER_MAKEOPTS) \
112 LIBS="$(TARGET_LDFLAGS) \
113 $(if $(CONFIG_PACKAGE_kmod-mac80211),-lm -lnl-tiny) \
114 $(if $(findstring default,$(1)),-lssl -lcrypto)" \
115 hostapd hostapd_cli
116 $(CP) $(PKG_BUILD_DIR)/hostapd.$(1)/hostapd/hostapd_cli $(PKG_BUILD_DIR)/
117 endef
118
119 define Package/InstallTemplate
120 $(INSTALL_DIR) $$(1)/lib/wifi
121 $(INSTALL_DATA) ./files/hostapd.sh $$(1)/lib/wifi/hostapd.sh
122 $(INSTALL_DIR) $$(1)/usr/sbin
123 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd $$(1)/usr/sbin/
124 # config is managed through uci
125 # $(INSTALL_DIR) $$(1)/etc
126 # $(INSTALL_CONF) $(PKG_BUILD_DIR)/hostapd.$(2)/hostapd/hostapd.conf $$(1)/etc/hostapd.conf
127 endef
128
129 define Package/Template
130 ifneq ($(CONFIG_PACKAGE_$(1)),)
131 define Build/Configure/$(2)
132 $(call Build/ConfigureTarget,$(2))
133 endef
134 define Build/Compile/$(2)
135 $(call Build/CompileTarget,$(2))
136 endef
137 define Package/$(1)/install
138 $(call Package/InstallTemplate,$(1),$(2))
139 endef
140 endif
141 endef
142
143 define Build/Configure
144 rm -f $(PKG_BUILD_DIR)/.configured*
145 $(call Build/Configure/default)
146 $(call Build/Configure/mini)
147 endef
148
149 define Build/Compile
150 $(call Build/Compile/default)
151 $(call Build/Compile/mini)
152 endef
153
154 define Build/Clean
155 rm -rf $(PKG_BUILD_DIR)_default
156 rm -rf $(PKG_BUILD_DIR)_mini
157 endef
158
159 define Package/hostapd-utils/install
160 $(INSTALL_DIR) $(1)/usr/sbin
161 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hostapd_cli $(1)/usr/sbin/
162 endef
163
164 $(eval $(call Package/Template,hostapd,default))
165 $(eval $(call Package/Template,hostapd-mini,mini))
166
167 $(eval $(call BuildPackage,hostapd))
168 $(eval $(call BuildPackage,hostapd-mini))
169 $(eval $(call BuildPackage,hostapd-utils))
This page took 0.056752 seconds and 5 git commands to generate.