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