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.

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