2 # Copyright (C) 2006-2009 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 include $(INCLUDE_DIR)/package.mk
20 define Package/net-snmp/Default
23 URL:=http://www.net-snmp.org/
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
35 define Package/libnetsnmp
36 $(call Package/net-snmp/Default)
40 TITLE:=Open source SNMP implementation (libraries)
43 define Package/libnetsnmp/description
44 $(call Package/net-snmp/Default/description)
46 This package contains shared libraries, needed by other programs.
50 define Package/snmp-utils
51 $(call Package/net-snmp/Default)
53 TITLE:=Open source SNMP implementation (utilities)
56 define Package/snmp-utils/description
57 $(call Package/net-snmp/Default/description)
59 This package contains SNMP client utilities.
64 $(call Package/net-snmp/Default)
66 TITLE:=Open source SNMP implementation (daemon)
69 define Package/snmpd/description
70 $(call Package/net-snmp/Default/description)
72 This package contains the SNMP agent, dynamically linked.
76 define Package/snmpd-static
77 $(call Package/net-snmp/Default)
78 TITLE:=Open source SNMP implementation (daemon)
82 define Package/snmpd-static/description
83 $(call Package/net-snmp/Default/description)
85 This package contains the SNMP agent, statically linked.
89 SNMP_MIB_MODULES_INCLUDED = \
111 snmpv3/snmpMPDStats \
117 ucd-snmp/extensible \
126 SNMP_MIB_MODULES_EXCLUDED = \
136 notification-log-mib \
144 SNMP_TRANSPORTS_INCLUDED = Callback UDP
146 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
148 TARGET_CFLAGS += $(FPIC)
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 \
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)" \
173 ifeq ($(CONFIG_IPV6),y)
174 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
175 CONFIGURE_ARGS+= --enable-ipv6
178 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
180 ifdef CONFIG_PACKAGE_snmpd-static
181 define Build/Compile/static
182 $(MAKE) -C $(PKG_BUILD_DIR)/agent \
183 LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
190 $(MAKE) -C $(PKG_BUILD_DIR) \
191 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
192 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
194 $(Build/Compile/static)
197 define Build/InstallDev
198 $(INSTALL_DIR) $(2)/bin
199 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
200 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
202 $(INSTALL_DIR) $(1)/usr/include
203 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
204 $(INSTALL_DIR) $(1)/usr/lib
205 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
208 define Package/libnetsnmp/install
209 $(INSTALL_DIR) $(1)/usr/lib
210 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
213 define Package/snmpd/conffiles
218 define Package/snmpd/install
219 $(INSTALL_DIR) $(1)/etc/config
220 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
221 $(INSTALL_DIR) $(1)/etc/snmp
222 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
223 $(INSTALL_DIR) $(1)/etc/default
224 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
225 $(INSTALL_DIR) $(1)/etc/init.d
226 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
227 $(INSTALL_DIR) $(1)/usr/sbin
228 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
231 define Package/snmpd-static/conffiles
236 define Package/snmpd-static/install
237 $(INSTALL_DIR) $(1)/etc/config
238 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
239 $(INSTALL_DIR) $(1)/etc/snmp
240 ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
241 $(INSTALL_DIR) $(1)/etc/default
242 $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
243 $(INSTALL_DIR) $(1)/etc/init.d
244 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
245 $(INSTALL_DIR) $(1)/usr/sbin
246 $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
249 define Package/snmp-utils/install
250 $(INSTALL_DIR) $(1)/usr/bin
251 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
254 $(eval $(call BuildPackage,libnetsnmp))
255 $(eval $(call BuildPackage,snmp-utils))
256 $(eval $(call BuildPackage,snmpd))
257 $(eval $(call BuildPackage,snmpd-static))