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.

257 lines
6.1 KiB

  1. #
  2. # Copyright (C) 2006-2015 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:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=@SF/net-snmp
  13. PKG_MD5SUM:=95aa054f3c99a1ce242807d7eaf98619
  14. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
  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-utils
  42. $(call Package/net-snmp/Default)
  43. DEPENDS:=+libnetsnmp
  44. TITLE:=Open source SNMP implementation (utilities)
  45. endef
  46. define Package/snmp-utils/description
  47. $(call Package/net-snmp/Default/description)
  48. .
  49. This package contains SNMP client utilities.
  50. endef
  51. define Package/snmpd
  52. $(call Package/net-snmp/Default)
  53. DEPENDS:=+libnetsnmp
  54. TITLE:=Open source SNMP implementation (daemon)
  55. endef
  56. define Package/snmpd/description
  57. $(call Package/net-snmp/Default/description)
  58. .
  59. This package contains the SNMP agent, dynamically linked.
  60. endef
  61. define Package/snmpd-static
  62. $(call Package/net-snmp/Default)
  63. TITLE:=Open source SNMP implementation (daemon)
  64. endef
  65. define Package/snmpd-static/description
  66. $(call Package/net-snmp/Default/description)
  67. .
  68. This package contains the SNMP agent, statically linked.
  69. endef
  70. SNMP_MIB_MODULES_INCLUDED = \
  71. host/hr_device \
  72. host/hr_disk \
  73. host/hr_filesys \
  74. host/hr_network \
  75. host/hr_partition \
  76. host/hr_proc \
  77. host/hr_storage \
  78. host/hr_system \
  79. ieee802dot11 \
  80. if-mib/ifXTable \
  81. mibII/at \
  82. mibII/icmp \
  83. mibII/ifTable \
  84. mibII/ip \
  85. mibII/snmp_mib \
  86. mibII/sysORTable \
  87. mibII/system_mib \
  88. mibII/tcp \
  89. mibII/udp \
  90. mibII/vacm_context \
  91. mibII/vacm_vars \
  92. snmpv3/snmpEngine \
  93. snmpv3/snmpMPDStats \
  94. snmpv3/usmConf \
  95. snmpv3/usmStats \
  96. snmpv3/usmUser \
  97. tunnel \
  98. ucd-snmp/disk \
  99. ucd-snmp/dlmod \
  100. ucd-snmp/extensible \
  101. ucd-snmp/loadave \
  102. ucd-snmp/memory \
  103. ucd-snmp/pass \
  104. ucd-snmp/pass_persist \
  105. ucd-snmp/proc \
  106. ucd-snmp/vmstat \
  107. util_funcs \
  108. utilities/execute \
  109. SNMP_MIB_MODULES_EXCLUDED = \
  110. agent_mibs \
  111. agentx \
  112. disman/event \
  113. disman/schedule \
  114. hardware \
  115. host \
  116. if-mib \
  117. mibII \
  118. notification \
  119. notification-log-mib \
  120. snmpv3mibs \
  121. target \
  122. tcp-mib \
  123. ucd_snmp \
  124. udp-mib \
  125. utilities \
  126. SNMP_TRANSPORTS_INCLUDED = Callback UDP
  127. SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
  128. TARGET_CFLAGS += $(FPIC)
  129. CONFIGURE_ARGS += \
  130. --enable-mfd-rewrites \
  131. --enable-shared \
  132. --enable-static \
  133. --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
  134. --with-logfile=/var/log/snmpd.log \
  135. --with-persistent-directory=/usr/lib/snmp/ \
  136. --with-default-snmp-version=1 \
  137. --with-sys-contact=root@localhost \
  138. --with-sys-location=Unknown \
  139. --enable-applications \
  140. --disable-debugging \
  141. --disable-manuals \
  142. --disable-mibs \
  143. --disable-scripts \
  144. --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
  145. --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
  146. --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
  147. --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
  148. --without-openssl \
  149. --without-libwrap \
  150. --without-rpm \
  151. --without-zlib \
  152. $(call autoconf_bool,CONFIG_IPV6,ipv6) \
  153. ifeq ($(CONFIG_IPV6),y)
  154. SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
  155. endif
  156. TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
  157. ifdef CONFIG_PACKAGE_snmpd-static
  158. define Build/Compile/static
  159. $(MAKE) -C $(PKG_BUILD_DIR)/agent \
  160. LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
  161. EXEEXT="-static" \
  162. snmpd-static
  163. endef
  164. endif
  165. define Build/Compile
  166. $(MAKE) -C $(PKG_BUILD_DIR) \
  167. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  168. LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
  169. all install
  170. $(Build/Compile/static)
  171. endef
  172. define Build/InstallDev
  173. $(INSTALL_DIR) $(2)/bin
  174. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
  175. $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
  176. $(INSTALL_DIR) $(1)/usr/include
  177. $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
  178. $(INSTALL_DIR) $(1)/usr/lib
  179. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
  180. endef
  181. define Package/libnetsnmp/install
  182. $(INSTALL_DIR) $(1)/usr/lib
  183. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
  184. endef
  185. define Package/snmpd/conffiles
  186. /etc/config/snmpd
  187. endef
  188. define Package/snmpd/install
  189. $(INSTALL_DIR) $(1)/etc/config
  190. $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
  191. $(INSTALL_DIR) $(1)/etc/snmp
  192. ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
  193. $(INSTALL_DIR) $(1)/etc/init.d
  194. $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
  195. $(INSTALL_DIR) $(1)/usr/sbin
  196. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
  197. endef
  198. define Package/snmpd-static/conffiles
  199. /etc/config/snmpd
  200. endef
  201. define Package/snmpd-static/install
  202. $(INSTALL_DIR) $(1)/etc/config
  203. $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
  204. $(INSTALL_DIR) $(1)/etc/snmp
  205. ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
  206. $(INSTALL_DIR) $(1)/etc/init.d
  207. $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
  208. $(INSTALL_DIR) $(1)/usr/sbin
  209. $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
  210. endef
  211. define Package/snmp-utils/install
  212. $(INSTALL_DIR) $(1)/usr/bin
  213. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
  214. endef
  215. $(eval $(call BuildPackage,libnetsnmp))
  216. $(eval $(call BuildPackage,snmp-utils))
  217. $(eval $(call BuildPackage,snmpd))
  218. $(eval $(call BuildPackage,snmpd-static))