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