You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

274 lines
6.6 KiB

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