2 # Copyright (C) 2006-2017 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_HASH:=b2fc3500840ebe532734c4786b0da4ef0a5f67e51ef4c86b3345d697e4976adf
17 PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
18 PKG_LICENSE:=MIT BSD-3-Clause-Clear
22 include $(INCLUDE_DIR)/package.mk
24 define Package/net-snmp/Default
27 URL:=http://www.net-snmp.org/
30 define Package/net-snmp/Default/description
31 Simple Network Management Protocol (SNMP) is a widely used protocol for
32 monitoring the health and welfare of network equipment (eg. routers),
33 computer equipment and even devices like UPSs. Net-SNMP is a suite of
34 applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both
39 define Package/libnetsnmp
40 $(call Package/net-snmp/Default)
43 DEPENDS:=+libnl-tiny +libpci
44 TITLE:=Open source SNMP implementation (libraries)
47 define Package/libnetsnmp/description
48 $(call Package/net-snmp/Default/description)
50 This package contains shared libraries, needed by other programs.
54 define Package/snmp-mibs
55 $(call Package/net-snmp/Default)
56 TITLE:=Open source SNMP implementation (MIB-files)
59 define Package/snmp-mibs/description
60 $(call Package/net-snmp/Default/description)
62 This package contains SNMP MIB-Files.
66 define Package/snmp-utils
67 $(call Package/net-snmp/Default)
69 TITLE:=Open source SNMP implementation (utilities)
72 define Package/snmp-utils/description
73 $(call Package/net-snmp/Default/description)
75 This package contains SNMP client utilities:
86 $(call Package/net-snmp/Default)
88 TITLE:=Open source SNMP implementation (daemon)
91 define Package/snmpd/description
92 $(call Package/net-snmp/Default/description)
94 This package contains the SNMP agent, dynamically linked.
98 define Package/snmpd-static
99 $(call Package/net-snmp/Default)
101 TITLE:=Open source SNMP implementation (daemon)
105 define Package/snmptrapd
106 $(call Package/net-snmp/Default)
108 TITLE:=Open source SNMP implementation (notification receiver)
111 define Package/snmptrapd/description
112 $(call Package/net-snmp/Default/description)
114 This package contains the SNMP notification receiver.
118 SNMP_MIB_MODULES_INCLUDED = \
131 ip-mib/inetNetToMediaTable \
144 snmpv3/snmpMPDStats \
151 ucd-snmp/extensible \
155 ucd-snmp/pass_persist \
161 SNMP_MIB_MODULES_EXCLUDED = \
171 notification-log-mib \
179 SNMP_TRANSPORTS_INCLUDED = Callback UDP Unix
181 SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6
183 TARGET_CFLAGS += $(FPIC)
184 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
187 --enable-mfd-rewrites \
190 --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
191 --with-logfile=/var/log/snmpd.log \
192 --with-persistent-directory=/usr/lib/snmp/ \
193 --with-default-snmp-version=1 \
194 --with-sys-contact=root@localhost \
195 --with-sys-location=Unknown \
196 --enable-applications \
197 --disable-debugging \
200 --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
201 --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
202 --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
203 --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
210 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
211 --disable-perl-cc-checks \
212 --disable-embedded-perl \
213 --without-perl-modules
216 ac_cv_header_netlink_netlink_h=yes \
217 ac_cv_header_pcre_h=no \
218 netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
220 ifeq ($(CONFIG_IPV6),y)
221 SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
224 TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
227 $(MAKE) -C $(PKG_BUILD_DIR) \
228 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
229 LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
233 define Build/InstallDev
234 $(INSTALL_DIR) $(2)/bin
235 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
236 $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
237 $(INSTALL_DIR) $(STAGING_DIR)/usr/bin
238 $(LN) $(STAGING_DIR)/host/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
240 $(INSTALL_DIR) $(1)/usr/include
241 $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
242 $(INSTALL_DIR) $(1)/usr/lib
243 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
246 define Package/libnetsnmp/install
247 $(INSTALL_DIR) $(1)/usr/lib
248 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
251 define Package/snmp-mibs/install
252 $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
253 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
256 define Package/snmp-utils/install
257 $(INSTALL_DIR) $(1)/usr/bin
258 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
261 define Package/snmpd/conffiles
265 define Package/snmpd/install
266 $(INSTALL_DIR) $(1)/etc/config
267 $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
268 $(INSTALL_DIR) $(1)/etc/snmp
269 $(LN) /var/run/snmpd.conf $(1)/etc/snmp/
270 $(INSTALL_DIR) $(1)/etc/init.d
271 $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
272 $(INSTALL_DIR) $(1)/usr/sbin
273 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
276 define Package/snmptrapd/install
277 $(INSTALL_DIR) $(1)/etc/init.d
278 $(INSTALL_BIN) ./files/snmptrapd.init $(1)/etc/init.d/snmptrapd
279 $(INSTALL_DIR) $(1)/usr/lib
280 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmptrapd.so.* $(1)/usr/lib/
281 $(INSTALL_DIR) $(1)/usr/sbin
282 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmptrapd $(1)/usr/sbin/
285 $(eval $(call BuildPackage,libnetsnmp))
286 $(eval $(call BuildPackage,snmp-mibs))
287 $(eval $(call BuildPackage,snmp-utils))
288 $(eval $(call BuildPackage,snmpd))
289 $(eval $(call BuildPackage,snmpd-static))
290 $(eval $(call BuildPackage,snmptrapd))