Makefile 5.9 KB

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