[package] convert lighttpd and net-snmp to use autoconf_bool for ipv6
[openwrt/svn-archive/archive.git] / net / net-snmp / Makefile
1 #
2 # Copyright (C) 2006-2010 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:=net-snmp
11 PKG_VERSION:=5.4.2.1
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/net-snmp
16 PKG_MD5SUM:=984932520143f0c8bf7b7ce1fc9e1da1
17
18 PKG_FIXUP = libtool no-autoreconf
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/net-snmp/Default
23 SECTION:=net
24 CATEGORY:=Network
25 URL:=http://www.net-snmp.org/
26 endef
27
28 define Package/net-snmp/Default/description
29 Simple Network Management Protocol (SNMP) is a widely used protocol for
30 monitoring the health and welfare of network equipment (eg. routers),
31 computer equipment and even devices like UPSs. Net-SNMP is a suite of
32 applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both
33 IPv4 and IPv6.
34 endef
35
36
37 define Package/libnetsnmp
38 $(call Package/net-snmp/Default)
39 SECTION:=libs
40 CATEGORY:=Libraries
41 DEPENDS:=+libelf
42 TITLE:=Open source SNMP implementation (libraries)
43 endef
44
45 define Package/libnetsnmp/description
46 $(call Package/net-snmp/Default/description)
47 .
48 This package contains shared libraries, needed by other programs.
49 endef
50
51
52 define Package/snmp-utils
53 $(call Package/net-snmp/Default)
54 DEPENDS:=+libnetsnmp
55 TITLE:=Open source SNMP implementation (utilities)
56 endef
57
58 define Package/snmp-utils/description
59 $(call Package/net-snmp/Default/description)
60 .
61 This package contains SNMP client utilities.
62 endef
63
64
65 define Package/snmpd
66 $(call Package/net-snmp/Default)
67 DEPENDS:=+libnetsnmp
68 TITLE:=Open source SNMP implementation (daemon)
69 endef
70
71 define Package/snmpd/description
72 $(call Package/net-snmp/Default/description)
73 .
74 This package contains the SNMP agent, dynamically linked.
75 endef
76
77
78 define Package/snmpd-static
79 $(call Package/net-snmp/Default)
80 TITLE:=Open source SNMP implementation (daemon)
81 DEPENDS:=+libelf
82 endef
83
84 define Package/snmpd-static/description
85 $(call Package/net-snmp/Default/description)
86 .
87 This package contains the SNMP agent, statically linked.
88 endef
89
90
91 SNMP_MIB_MODULES_INCLUDED = \
92 host/hr_device \
93 host/hr_disk \
94 host/hr_filesys \
95 host/hr_network \
96 host/hr_partition \
97 host/hr_proc \
98 host/hr_storage \
99 host/hr_system \
100 ieee802dot11 \
101 mibII/at \
102 mibII/icmp \
103 mibII/ifTable \
104 mibII/ip \
105 mibII/snmp_mib \
106 mibII/sysORTable \
107 mibII/system_mib \
108 mibII/tcp \
109 mibII/udp \
110 mibII/vacm_context \
111 mibII/vacm_vars \
112 snmpv3/snmpEngine \
113 snmpv3/snmpMPDStats \
114 snmpv3/usmConf \
115 snmpv3/usmStats \
116 snmpv3/usmUser \
117 tunnel \
118 ucd-snmp/disk \
119 ucd-snmp/dlmod \
120 ucd-snmp/extensible \
121 ucd-snmp/loadave \
122 ucd-snmp/memory \
123 ucd-snmp/pass \
124 ucd-snmp/proc \
125 ucd-snmp/vmstat \
126 util_funcs \
127 utilities/execute \
128
129 SNMP_MIB_MODULES_EXCLUDED = \
130 agent_mibs \
131 agentx \
132 disman/event \
133 disman/schedule \
134 hardware \
135 host \
136 if-mib \
137 mibII \
138 notification \
139 notification-log-mib \
140 snmpv3mibs \
141 target \
142 tcp-mib \
143 ucd_snmp \
144 udp-mib \
145 utilities \
146
147 SNMP_TRANSPORTS_INCLUDED = Callback UDP
148
149 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
150
151 TARGET_CFLAGS += $(FPIC)
152
153 CONFIGURE_ARGS += \
154 --enable-shared \
155 --enable-static \
156 --with-endianness=little \
157 --with-logfile=/var/log/snmpd.log \
158 --with-persistent-directory=/usr/lib/snmp/ \
159 --with-default-snmp-version=1 \
160 --with-sys-contact=root@localhost \
161 --with-sys-location=Unknown \
162 --enable-applications \
163 --disable-debugging \
164 --disable-manuals \
165 --disable-mibs \
166 --disable-scripts \
167 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
168 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
169 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
170 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
171 --without-openssl \
172 --without-libwrap \
173 --without-rpm \
174 --without-zlib \
175 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
176
177 ifeq ($(CONFIG_IPV6),y)
178 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
179 endif
180
181 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
182
183 ifdef CONFIG_PACKAGE_snmpd-static
184 define Build/Compile/static
185 $(MAKE) -C $(PKG_BUILD_DIR)/agent \
186 LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
187 EXEEXT="-static" \
188 snmpd-static
189 endef
190 endif
191
192 define Build/Compile
193 $(MAKE) -C $(PKG_BUILD_DIR) \
194 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
195 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
196 all install
197 $(Build/Compile/static)
198 endef
199
200 define Build/InstallDev
201 $(INSTALL_DIR) $(2)/bin
202 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
203 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
204
205 $(INSTALL_DIR) $(1)/usr/include
206 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
207 $(INSTALL_DIR) $(1)/usr/lib
208 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
209 endef
210
211 define Package/libnetsnmp/install
212 $(INSTALL_DIR) $(1)/usr/lib
213 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
214 endef
215
216 define Package/snmpd/conffiles
217 /etc/default/snmpd
218 /etc/config/snmpd
219 endef
220
221 define Package/snmpd/install
222 $(INSTALL_DIR) $(1)/etc/config
223 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
224 $(INSTALL_DIR) $(1)/etc/snmp
225 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
226 $(INSTALL_DIR) $(1)/etc/default
227 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
228 $(INSTALL_DIR) $(1)/etc/init.d
229 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
230 $(INSTALL_DIR) $(1)/usr/sbin
231 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
232 endef
233
234 define Package/snmpd-static/conffiles
235 /etc/default/snmpd
236 /etc/config/snmpd
237 endef
238
239 define Package/snmpd-static/install
240 $(INSTALL_DIR) $(1)/etc/config
241 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
242 $(INSTALL_DIR) $(1)/etc/snmp
243 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
244 $(INSTALL_DIR) $(1)/etc/default
245 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
246 $(INSTALL_DIR) $(1)/etc/init.d
247 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
248 $(INSTALL_DIR) $(1)/usr/sbin
249 $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
250 endef
251
252 define Package/snmp-utils/install
253 $(INSTALL_DIR) $(1)/usr/bin
254 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
255 endef
256
257 $(eval $(call BuildPackage,libnetsnmp))
258 $(eval $(call BuildPackage,snmp-utils))
259 $(eval $(call BuildPackage,snmpd))
260 $(eval $(call BuildPackage,snmpd-static))