Makefile 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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.8
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=@SF/net-snmp
  13. PKG_HASH:=b2fc3500840ebe532734c4786b0da4ef0a5f67e51ef4c86b3345d697e4976adf
  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 +libpci
  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. - snmpget
  61. - snmpset
  62. - snmpstatus
  63. - snmptest
  64. - snmptrap
  65. - snmpwalk
  66. endef
  67. define Package/snmpd
  68. $(call Package/net-snmp/Default)
  69. DEPENDS:=+libnetsnmp
  70. TITLE:=Open source SNMP implementation (daemon)
  71. endef
  72. define Package/snmpd/description
  73. $(call Package/net-snmp/Default/description)
  74. .
  75. This package contains the SNMP agent, dynamically linked.
  76. endef
  77. define Package/snmpd-static
  78. $(call Package/net-snmp/Default)
  79. DEPENDS:=+snmpd
  80. TITLE:=Open source SNMP implementation (daemon)
  81. endef
  82. define Package/snmptrapd
  83. $(call Package/net-snmp/Default)
  84. DEPENDS:=+libnetsnmp
  85. TITLE:=Open source SNMP implementation (notification receiver)
  86. endef
  87. define Package/snmptrapd/description
  88. $(call Package/net-snmp/Default/description)
  89. .
  90. This package contains the SNMP notification receiver.
  91. endef
  92. SNMP_MIB_MODULES_INCLUDED = \
  93. agent/extend \
  94. agentx \
  95. host/hr_device \
  96. host/hr_disk \
  97. host/hr_filesys \
  98. host/hr_network \
  99. host/hr_partition \
  100. host/hr_proc \
  101. host/hr_storage \
  102. host/hr_system \
  103. ieee802dot11 \
  104. if-mib/ifXTable \
  105. ip-mib/inetNetToMediaTable \
  106. mibII/at \
  107. mibII/icmp \
  108. mibII/ifTable \
  109. mibII/ip \
  110. mibII/snmp_mib \
  111. mibII/sysORTable \
  112. mibII/system_mib \
  113. mibII/tcp \
  114. mibII/udp \
  115. mibII/vacm_context \
  116. mibII/vacm_vars \
  117. snmpv3/snmpEngine \
  118. snmpv3/snmpMPDStats \
  119. snmpv3/usmConf \
  120. snmpv3/usmStats \
  121. snmpv3/usmUser \
  122. tunnel \
  123. ucd-snmp/disk \
  124. ucd-snmp/dlmod \
  125. ucd-snmp/extensible \
  126. ucd-snmp/loadave \
  127. ucd-snmp/memory \
  128. ucd-snmp/pass \
  129. ucd-snmp/pass_persist \
  130. ucd-snmp/proc \
  131. ucd-snmp/vmstat \
  132. util_funcs \
  133. utilities/execute \
  134. SNMP_MIB_MODULES_EXCLUDED = \
  135. agent_mibs \
  136. disman/event \
  137. disman/schedule \
  138. hardware \
  139. host \
  140. if-mib \
  141. ip-mib \
  142. mibII \
  143. notification \
  144. notification-log-mib \
  145. snmpv3mibs \
  146. target \
  147. tcp-mib \
  148. ucd_snmp \
  149. udp-mib \
  150. utilities \
  151. SNMP_TRANSPORTS_INCLUDED = Callback UDP Unix
  152. SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6
  153. TARGET_CFLAGS += $(FPIC)
  154. TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
  155. CONFIGURE_ARGS += \
  156. --enable-mfd-rewrites \
  157. --enable-shared \
  158. --enable-static \
  159. --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
  160. --with-logfile=/var/log/snmpd.log \
  161. --with-persistent-directory=/usr/lib/snmp/ \
  162. --with-default-snmp-version=1 \
  163. --with-sys-contact=root@localhost \
  164. --with-sys-location=Unknown \
  165. --enable-applications \
  166. --disable-debugging \
  167. --disable-manuals \
  168. --disable-scripts \
  169. --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
  170. --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
  171. --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
  172. --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
  173. --without-openssl \
  174. --without-libwrap \
  175. --without-mysql \
  176. --without-rpm \
  177. --without-zlib \
  178. --with-nl \
  179. $(call autoconf_bool,CONFIG_IPV6,ipv6) \
  180. --disable-perl-cc-checks \
  181. --disable-embedded-perl \
  182. --without-perl-modules
  183. CONFIGURE_VARS += \
  184. ac_cv_header_netlink_netlink_h=yes \
  185. ac_cv_header_pcre_h=no \
  186. netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
  187. ifeq ($(CONFIG_IPV6),y)
  188. SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
  189. endif
  190. TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
  191. define Build/Compile
  192. $(MAKE) -C $(PKG_BUILD_DIR) \
  193. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  194. LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
  195. all install
  196. endef
  197. define Build/InstallDev
  198. $(INSTALL_DIR) $(2)/bin
  199. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
  200. $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
  201. $(INSTALL_DIR) $(STAGING_DIR)/usr/bin
  202. $(LN) $(STAGING_DIR)/host/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
  203. $(INSTALL_DIR) $(1)/usr/include
  204. $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
  205. $(INSTALL_DIR) $(1)/usr/lib
  206. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
  207. endef
  208. define Package/libnetsnmp/install
  209. $(INSTALL_DIR) $(1)/usr/lib
  210. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
  211. endef
  212. define Package/snmp-mibs/install
  213. $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
  214. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
  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. define Package/snmpd/conffiles
  221. /etc/config/snmpd
  222. endef
  223. define Package/snmpd/install
  224. $(INSTALL_DIR) $(1)/etc/config
  225. $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
  226. $(INSTALL_DIR) $(1)/etc/snmp
  227. $(LN) /var/run/snmpd.conf $(1)/etc/snmp/
  228. $(INSTALL_DIR) $(1)/etc/init.d
  229. $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
  230. $(INSTALL_DIR) $(1)/usr/sbin
  231. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
  232. endef
  233. define Package/snmptrapd/install
  234. $(INSTALL_DIR) $(1)/etc/init.d
  235. $(INSTALL_BIN) ./files/snmptrapd.init $(1)/etc/init.d/snmptrapd
  236. $(INSTALL_DIR) $(1)/usr/lib
  237. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmptrapd.so.* $(1)/usr/lib/
  238. $(INSTALL_DIR) $(1)/usr/sbin
  239. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmptrapd $(1)/usr/sbin/
  240. endef
  241. $(eval $(call BuildPackage,libnetsnmp))
  242. $(eval $(call BuildPackage,snmp-mibs))
  243. $(eval $(call BuildPackage,snmp-utils))
  244. $(eval $(call BuildPackage,snmpd))
  245. $(eval $(call BuildPackage,snmpd-static))
  246. $(eval $(call BuildPackage,snmptrapd))