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