2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/net-snmp
16 PKG_MD5SUM:=984932520143f0c8bf7b7ce1fc9e1da1
18 PKG_FIXUP = libtool no-autoreconf
20 include $(INCLUDE_DIR)/package.mk
22 define Package/net-snmp/Default
25 URL:=http://www.net-snmp.org/
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
37 define Package/libnetsnmp
38 $(call Package/net-snmp/Default)
42 TITLE:=Open source SNMP implementation (libraries)
45 define Package/libnetsnmp/description
46 $(call Package/net-snmp/Default/description)
48 This package contains shared libraries, needed by other programs.
52 define Package/snmp-utils
53 $(call Package/net-snmp/Default)
55 TITLE:=Open source SNMP implementation (utilities)
58 define Package/snmp-utils/description
59 $(call Package/net-snmp/Default/description)
61 This package contains SNMP client utilities.
66 $(call Package/net-snmp/Default)
68 TITLE:=Open source SNMP implementation (daemon)
71 define Package/snmpd/description
72 $(call Package/net-snmp/Default/description)
74 This package contains the SNMP agent, dynamically linked.
78 define Package/snmpd-static
79 $(call Package/net-snmp/Default)
80 TITLE:=Open source SNMP implementation (daemon)
84 define Package/snmpd-static/description
85 $(call Package/net-snmp/Default/description)
87 This package contains the SNMP agent, statically linked.
91 SNMP_MIB_MODULES_INCLUDED = \
114 snmpv3/snmpMPDStats \
121 ucd-snmp/extensible \
130 SNMP_MIB_MODULES_EXCLUDED = \
140 notification-log-mib \
148 SNMP_TRANSPORTS_INCLUDED = Callback UDP
150 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
152 TARGET_CFLAGS += $(FPIC)
155 --enable-mfd-rewrites \
158 --with-endianness=little \
159 --with-logfile=/var/log/snmpd.log \
160 --with-persistent-directory=/usr/lib/snmp/ \
161 --with-default-snmp-version=1 \
162 --with-sys-contact=root@localhost \
163 --with-sys-location=Unknown \
164 --enable-applications \
165 --disable-debugging \
169 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
170 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
171 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
172 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
177 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
179 ifeq ($(CONFIG_IPV6),y)
180 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
183 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
185 ifdef CONFIG_PACKAGE_snmpd-static
186 define Build/Compile/static
187 $(MAKE) -C $(PKG_BUILD_DIR)/agent \
188 LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
195 $(MAKE) -C $(PKG_BUILD_DIR) \
196 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
197 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
199 $(Build/Compile/static)
202 define Build/InstallDev
203 $(INSTALL_DIR) $(2)/bin
204 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
205 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
207 $(INSTALL_DIR) $(1)/usr/include
208 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
209 $(INSTALL_DIR) $(1)/usr/lib
210 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
213 define Package/libnetsnmp/install
214 $(INSTALL_DIR) $(1)/usr/lib
215 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
218 define Package/snmpd/conffiles
223 define Package/snmpd/install
224 $(INSTALL_DIR) $(1)/etc/config
225 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
226 $(INSTALL_DIR) $(1)/etc/snmp
227 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
228 $(INSTALL_DIR) $(1)/etc/default
229 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
230 $(INSTALL_DIR) $(1)/etc/init.d
231 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
232 $(INSTALL_DIR) $(1)/usr/sbin
233 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
236 define Package/snmpd-static/conffiles
241 define Package/snmpd-static/install
242 $(INSTALL_DIR) $(1)/etc/config
243 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
244 $(INSTALL_DIR) $(1)/etc/snmp
245 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
246 $(INSTALL_DIR) $(1)/etc/default
247 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
248 $(INSTALL_DIR) $(1)/etc/init.d
249 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
250 $(INSTALL_DIR) $(1)/usr/sbin
251 $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
254 define Package/snmp-utils/install
255 $(INSTALL_DIR) $(1)/usr/bin
256 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
259 $(eval $(call BuildPackage,libnetsnmp))
260 $(eval $(call BuildPackage,snmp-utils))
261 $(eval $(call BuildPackage,snmpd))
262 $(eval $(call BuildPackage,snmpd-static))