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.

291 lines
7.0 KiB

net-snmp: build against libnl-tiny Instead of causing nondeterministing conditional compilation depending on whether libnl-core happens to be present or not, fixup the net-snmp package to link against libnl-tiny which is present by default on the majority of systems. In order to successfully build against libnl-tiny, a number of things had to be fixed in both the upstream configure and the outer Makefile: - Add a patch which fixes the upstream configure macros to properly handle cases where the cache variables for nl_connect() and netlink.h tests are predefined. Without this patch, all subsequent link tests in configure will fail, causing the build system to assume functions like opendir() or readdir() to be missing, leading to build failures later on due to conflicting redefinitions of structures and function prototypes - In the same patch, stop probing the host systems /usr/include/libnl-3 if ac_cv_header_netlink_netlink_h is given. This brings the proprietary configure bits in line with the behaviour expected from autoconfig in a cross compile setting - Explicitely request nl support by passing the --with-nl flag to configure - Pass the required cache variables to skip the broken tests for nl_connect() and netlink.h - Amend TARGET_CPPFLAGS to let net-snmp's build system discover nl-tiny's netlink/netlink.h and netlink/socket.h - Enable the autoreconf fixup to regenerate the broken shipped configure from patched macros - Adjust the depends to unconditionally require libnl-tiny Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
net-snmp: build against libnl-tiny Instead of causing nondeterministing conditional compilation depending on whether libnl-core happens to be present or not, fixup the net-snmp package to link against libnl-tiny which is present by default on the majority of systems. In order to successfully build against libnl-tiny, a number of things had to be fixed in both the upstream configure and the outer Makefile: - Add a patch which fixes the upstream configure macros to properly handle cases where the cache variables for nl_connect() and netlink.h tests are predefined. Without this patch, all subsequent link tests in configure will fail, causing the build system to assume functions like opendir() or readdir() to be missing, leading to build failures later on due to conflicting redefinitions of structures and function prototypes - In the same patch, stop probing the host systems /usr/include/libnl-3 if ac_cv_header_netlink_netlink_h is given. This brings the proprietary configure bits in line with the behaviour expected from autoconfig in a cross compile setting - Explicitely request nl support by passing the --with-nl flag to configure - Pass the required cache variables to skip the broken tests for nl_connect() and netlink.h - Amend TARGET_CPPFLAGS to let net-snmp's build system discover nl-tiny's netlink/netlink.h and netlink/socket.h - Enable the autoreconf fixup to regenerate the broken shipped configure from patched macros - Adjust the depends to unconditionally require libnl-tiny Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
net-snmp: build against libnl-tiny Instead of causing nondeterministing conditional compilation depending on whether libnl-core happens to be present or not, fixup the net-snmp package to link against libnl-tiny which is present by default on the majority of systems. In order to successfully build against libnl-tiny, a number of things had to be fixed in both the upstream configure and the outer Makefile: - Add a patch which fixes the upstream configure macros to properly handle cases where the cache variables for nl_connect() and netlink.h tests are predefined. Without this patch, all subsequent link tests in configure will fail, causing the build system to assume functions like opendir() or readdir() to be missing, leading to build failures later on due to conflicting redefinitions of structures and function prototypes - In the same patch, stop probing the host systems /usr/include/libnl-3 if ac_cv_header_netlink_netlink_h is given. This brings the proprietary configure bits in line with the behaviour expected from autoconfig in a cross compile setting - Explicitely request nl support by passing the --with-nl flag to configure - Pass the required cache variables to skip the broken tests for nl_connect() and netlink.h - Amend TARGET_CPPFLAGS to let net-snmp's build system discover nl-tiny's netlink/netlink.h and netlink/socket.h - Enable the autoreconf fixup to regenerate the broken shipped configure from patched macros - Adjust the depends to unconditionally require libnl-tiny Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
net-snmp: build against libnl-tiny Instead of causing nondeterministing conditional compilation depending on whether libnl-core happens to be present or not, fixup the net-snmp package to link against libnl-tiny which is present by default on the majority of systems. In order to successfully build against libnl-tiny, a number of things had to be fixed in both the upstream configure and the outer Makefile: - Add a patch which fixes the upstream configure macros to properly handle cases where the cache variables for nl_connect() and netlink.h tests are predefined. Without this patch, all subsequent link tests in configure will fail, causing the build system to assume functions like opendir() or readdir() to be missing, leading to build failures later on due to conflicting redefinitions of structures and function prototypes - In the same patch, stop probing the host systems /usr/include/libnl-3 if ac_cv_header_netlink_netlink_h is given. This brings the proprietary configure bits in line with the behaviour expected from autoconfig in a cross compile setting - Explicitely request nl support by passing the --with-nl flag to configure - Pass the required cache variables to skip the broken tests for nl_connect() and netlink.h - Amend TARGET_CPPFLAGS to let net-snmp's build system discover nl-tiny's netlink/netlink.h and netlink/socket.h - Enable the autoreconf fixup to regenerate the broken shipped configure from patched macros - Adjust the depends to unconditionally require libnl-tiny Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
  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.9
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=@SF/net-snmp
  13. PKG_HASH:=04303a66f85d6d8b16d3cc53bde50428877c82ab524e17591dfceaeb94df6071
  14. PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
  15. PKG_LICENSE:=MIT BSD-3-Clause-Clear
  16. PKG_CPE_ID:=cpe:/a:net-snmp:net-snmp
  17. PKG_FIXUP:=autoreconf
  18. include $(INCLUDE_DIR)/package.mk
  19. define Package/net-snmp/Default
  20. SECTION:=net
  21. CATEGORY:=Network
  22. URL:=http://www.net-snmp.org/
  23. endef
  24. define Package/net-snmp/Default/description
  25. Simple Network Management Protocol (SNMP) is a widely used protocol for
  26. monitoring the health and welfare of network equipment (eg. routers),
  27. computer equipment and even devices like UPSs. Net-SNMP is a suite of
  28. applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both
  29. IPv4 and IPv6.
  30. endef
  31. define Package/libnetsnmp
  32. $(call Package/net-snmp/Default)
  33. SECTION:=libs
  34. CATEGORY:=Libraries
  35. DEPENDS:=+libnl-tiny +libpci +libpcre
  36. TITLE:=Open source SNMP implementation (libraries)
  37. endef
  38. define Package/libnetsnmp/description
  39. $(call Package/net-snmp/Default/description)
  40. .
  41. This package contains shared libraries, needed by other programs.
  42. endef
  43. define Package/snmp-mibs
  44. $(call Package/net-snmp/Default)
  45. TITLE:=Open source SNMP implementation (MIB-files)
  46. endef
  47. define Package/snmp-mibs/description
  48. $(call Package/net-snmp/Default/description)
  49. .
  50. This package contains SNMP MIB-Files.
  51. endef
  52. define Package/snmp-utils
  53. $(call Package/net-snmp/Default)
  54. DEPENDS:=+libnetsnmp
  55. TITLE:=Open source SNMP implementation (utilities)
  56. endef
  57. define Package/snmp-utils/description
  58. $(call Package/net-snmp/Default/description)
  59. .
  60. This package contains SNMP client utilities:
  61. - snmpget
  62. - snmpset
  63. - snmpstatus
  64. - snmptest
  65. - snmptrap
  66. - snmpwalk
  67. endef
  68. define Package/snmpd
  69. $(call Package/net-snmp/Default)
  70. DEPENDS:=+libnetsnmp
  71. TITLE:=Open source SNMP implementation (daemon)
  72. endef
  73. define Package/snmpd/description
  74. $(call Package/net-snmp/Default/description)
  75. .
  76. This package contains the SNMP agent, dynamically linked.
  77. endef
  78. define Package/snmpd-static
  79. $(call Package/net-snmp/Default)
  80. DEPENDS:=+snmpd
  81. TITLE:=Open source SNMP implementation (daemon)
  82. BUILDONLY:=1
  83. endef
  84. define Package/snmptrapd
  85. $(call Package/net-snmp/Default)
  86. DEPENDS:=+libnetsnmp
  87. TITLE:=Open source SNMP implementation (notification receiver)
  88. endef
  89. define Package/snmptrapd/description
  90. $(call Package/net-snmp/Default/description)
  91. .
  92. This package contains the SNMP notification receiver.
  93. endef
  94. SNMP_MIB_MODULES_INCLUDED = \
  95. agent/extend \
  96. agentx \
  97. host/hr_device \
  98. host/hr_disk \
  99. host/hr_filesys \
  100. host/hr_network \
  101. host/hr_partition \
  102. host/hr_proc \
  103. host/hr_storage \
  104. host/hr_system \
  105. ieee802dot11 \
  106. if-mib/ifXTable \
  107. ip-mib/inetNetToMediaTable \
  108. mibII/at \
  109. mibII/icmp \
  110. mibII/ifTable \
  111. mibII/ip \
  112. mibII/snmp_mib \
  113. mibII/sysORTable \
  114. mibII/system_mib \
  115. mibII/tcp \
  116. mibII/udp \
  117. mibII/vacm_context \
  118. mibII/vacm_vars \
  119. snmpv3/snmpEngine \
  120. snmpv3/snmpMPDStats \
  121. snmpv3/usmConf \
  122. snmpv3/usmStats \
  123. snmpv3/usmUser \
  124. tunnel \
  125. ucd-snmp/disk \
  126. ucd-snmp/dlmod \
  127. ucd-snmp/extensible \
  128. ucd-snmp/loadave \
  129. ucd-snmp/memory \
  130. ucd-snmp/pass \
  131. ucd-snmp/pass_persist \
  132. ucd-snmp/proc \
  133. ucd-snmp/vmstat \
  134. util_funcs \
  135. utilities/execute \
  136. SNMP_MIB_MODULES_EXCLUDED = \
  137. agent_mibs \
  138. disman/event \
  139. disman/schedule \
  140. hardware \
  141. host \
  142. if-mib \
  143. ip-mib \
  144. mibII \
  145. notification \
  146. notification-log-mib \
  147. snmpv3mibs \
  148. target \
  149. tcp-mib \
  150. ucd_snmp \
  151. udp-mib \
  152. utilities \
  153. SNMP_TRANSPORTS_INCLUDED = Callback UDP Unix
  154. SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6
  155. TARGET_CFLAGS += $(FPIC)
  156. TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
  157. CONFIGURE_ARGS += \
  158. --enable-mfd-rewrites \
  159. --enable-shared \
  160. --enable-static \
  161. --with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
  162. --with-logfile=/var/log/snmpd.log \
  163. --with-persistent-directory=/usr/lib/snmp/ \
  164. --with-default-snmp-version=1 \
  165. --with-sys-contact=root@localhost \
  166. --with-sys-location=Unknown \
  167. --enable-applications \
  168. --disable-debugging \
  169. --disable-manuals \
  170. --disable-scripts \
  171. --with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
  172. --with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
  173. --with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
  174. --with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
  175. --without-openssl \
  176. --without-libwrap \
  177. --without-mysql \
  178. --without-rpm \
  179. --without-zlib \
  180. --with-nl \
  181. $(call autoconf_bool,CONFIG_IPV6,ipv6) \
  182. --disable-perl-cc-checks \
  183. --disable-embedded-perl \
  184. --without-perl-modules
  185. CONFIGURE_VARS += \
  186. ac_cv_header_netlink_netlink_h=yes \
  187. netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
  188. ifeq ($(CONFIG_IPV6),y)
  189. SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
  190. endif
  191. TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
  192. define Build/Compile
  193. $(MAKE) -C $(PKG_BUILD_DIR) \
  194. INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
  195. LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
  196. all install
  197. endef
  198. define Build/InstallDev
  199. $(INSTALL_DIR) $(2)/bin
  200. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
  201. $(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
  202. $(INSTALL_DIR) $(STAGING_DIR)/usr/bin
  203. $(LN) $(STAGING_DIR)/host/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
  204. $(INSTALL_DIR) $(1)/usr/include
  205. $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
  206. $(INSTALL_DIR) $(1)/usr/lib
  207. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
  208. endef
  209. define Package/libnetsnmp/install
  210. $(INSTALL_DIR) $(1)/usr/lib
  211. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
  212. endef
  213. define Package/snmp-mibs/install
  214. $(INSTALL_DIR) $(1)/usr/share/snmp/mibs
  215. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
  216. endef
  217. define Package/snmp-utils/install
  218. $(INSTALL_DIR) $(1)/usr/bin
  219. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
  220. endef
  221. define Package/snmpd/conffiles
  222. /etc/config/snmpd
  223. endef
  224. define Package/snmpd/install
  225. $(INSTALL_DIR) $(1)/etc/config
  226. $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
  227. $(INSTALL_DIR) $(1)/etc/snmp
  228. $(LN) /var/run/snmpd.conf $(1)/etc/snmp/
  229. $(INSTALL_DIR) $(1)/etc/init.d
  230. $(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
  231. $(INSTALL_DIR) $(1)/usr/sbin
  232. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
  233. endef
  234. define Package/snmptrapd/install
  235. $(INSTALL_DIR) $(1)/etc/init.d
  236. $(INSTALL_BIN) ./files/snmptrapd.init $(1)/etc/init.d/snmptrapd
  237. $(INSTALL_DIR) $(1)/usr/lib
  238. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmptrapd.so.* $(1)/usr/lib/
  239. $(INSTALL_DIR) $(1)/usr/sbin
  240. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmptrapd $(1)/usr/sbin/
  241. endef
  242. $(eval $(call BuildPackage,libnetsnmp))
  243. $(eval $(call BuildPackage,snmp-mibs))
  244. $(eval $(call BuildPackage,snmp-utils))
  245. $(eval $(call BuildPackage,snmpd))
  246. $(eval $(call BuildPackage,snmpd-static))
  247. $(eval $(call BuildPackage,snmptrapd))