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.

262 lines
6.3 KiB

  1. #
  2. # Copyright (C) 2006-2014 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:=1
  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 <jow@openwrt.org>
  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/proc \
  105. ucd-snmp/vmstat \
  106. util_funcs \
  107. utilities/execute \
  108. SNMP_MIB_MODULES_EXCLUDED = \
  109. agent_mibs \
  110. agentx \
  111. disman/event \
  112. disman/schedule \
  113. hardware \
  114. host \
  115. if-mib \
  116. mibII \
  117. notification \
  118. notification-log-mib \
  119. snmpv3mibs \
  120. target \
  121. tcp-mib \
  122. ucd_snmp \
  123. udp-mib \
  124. utilities \
  125. SNMP_TRANSPORTS_INCLUDED = Callback UDP
  126. SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
  127. TARGET_CFLAGS += $(FPIC)
  128. CONFIGURE_ARGS += \
  129. --enable-mfd-rewrites \
  130. --enable-shared \
  131. --enable-static \
  132. --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
  133. --with-logfile=/var/log/snmpd.log \
  134. --with-persistent-directory=/usr/lib/snmp/ \
  135. --with-default-snmp-version=1 \
  136. --with-sys-contact=root@localhost \
  137. --with-sys-location=Unknown \
  138. --enable-applications \
  139. --disable-debugging \
  140. --disable-manuals \
  141. --disable-mibs \
  142. --disable-scripts \
  143. --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
  144. --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
  145. --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
  146. --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
  147. --without-openssl \
  148. --without-libwrap \
  149. --without-rpm \
  150. --without-zlib \
  151. $(call autoconf_bool,CONFIG_IPV6,ipv6) \
  152. ifeq ($(CONFIG_IPV6),y)
  153. SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
  154. endif
  155. TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
  156. ifdef CONFIG_PACKAGE_snmpd-static
  157. define Build/Compile/static
  158. $(MAKE) -C $(PKG_BUILD_DIR)/agent \
  159. LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
  160. EXEEXT="-static" \
  161. snmpd-static
  162. endef
  163. endif
  164. define Build/Compile
  165. $(MAKE) -C $(PKG_BUILD_DIR) \
  166. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  167. LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
  168. all install
  169. $(Build/Compile/static)
  170. endef
  171. define Build/InstallDev
  172. $(INSTALL_DIR) $(2)/bin
  173. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
  174. $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
  175. $(INSTALL_DIR) $(1)/usr/include
  176. $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
  177. $(INSTALL_DIR) $(1)/usr/lib
  178. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
  179. endef
  180. define Package/libnetsnmp/install
  181. $(INSTALL_DIR) $(1)/usr/lib
  182. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
  183. endef
  184. define Package/snmpd/conffiles
  185. /etc/default/snmpd
  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/default
  194. $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
  195. $(INSTALL_DIR) $(1)/etc/init.d
  196. $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
  197. $(INSTALL_DIR) $(1)/usr/sbin
  198. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
  199. endef
  200. define Package/snmpd-static/conffiles
  201. /etc/default/snmpd
  202. /etc/config/snmpd
  203. endef
  204. define Package/snmpd-static/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/default
  210. $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
  211. $(INSTALL_DIR) $(1)/etc/init.d
  212. $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
  213. $(INSTALL_DIR) $(1)/usr/sbin
  214. $(INSTALL_BIN) $(PKG_BUILD_DIR)/agent/snmpd-static $(1)/usr/sbin/snmpd
  215. endef
  216. define Package/snmp-utils/install
  217. $(INSTALL_DIR) $(1)/usr/bin
  218. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
  219. endef
  220. $(eval $(call BuildPackage,libnetsnmp))
  221. $(eval $(call BuildPackage,snmp-utils))
  222. $(eval $(call BuildPackage,snmpd))
  223. $(eval $(call BuildPackage,snmpd-static))