openwrt-packages/net/net-snmp/Makefile

292 lines
7.0 KiB
Makefile
Raw Normal View History

#
# Copyright (C) 2006-2017 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=net-snmp
PKG_VERSION:=5.8
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/net-snmp
PKG_HASH:=b2fc3500840ebe532734c4786b0da4ef0a5f67e51ef4c86b3345d697e4976adf
PKG_MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
PKG_LICENSE:=MIT BSD-3-Clause-Clear
PKG_CPE_ID:=cpe:/a:net-snmp:net-snmp
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>
2017-01-06 16:07:38 +01:00
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/net-snmp/Default
SECTION:=net
CATEGORY:=Network
URL:=http://www.net-snmp.org/
endef
define Package/net-snmp/Default/description
Simple Network Management Protocol (SNMP) is a widely used protocol for
monitoring the health and welfare of network equipment (eg. routers),
computer equipment and even devices like UPSs. Net-SNMP is a suite of
applications used to implement SNMP v1, SNMP v2c and SNMP v3 using both
IPv4 and IPv6.
endef
define Package/libnetsnmp
$(call Package/net-snmp/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libnl-tiny +libpci
TITLE:=Open source SNMP implementation (libraries)
endef
define Package/libnetsnmp/description
$(call Package/net-snmp/Default/description)
.
This package contains shared libraries, needed by other programs.
endef
define Package/snmp-mibs
$(call Package/net-snmp/Default)
TITLE:=Open source SNMP implementation (MIB-files)
endef
define Package/snmp-mibs/description
$(call Package/net-snmp/Default/description)
.
This package contains SNMP MIB-Files.
endef
define Package/snmp-utils
$(call Package/net-snmp/Default)
DEPENDS:=+libnetsnmp
TITLE:=Open source SNMP implementation (utilities)
endef
define Package/snmp-utils/description
$(call Package/net-snmp/Default/description)
.
This package contains SNMP client utilities:
- snmpget
- snmpset
- snmpstatus
- snmptest
- snmptrap
- snmpwalk
endef
define Package/snmpd
$(call Package/net-snmp/Default)
DEPENDS:=+libnetsnmp
TITLE:=Open source SNMP implementation (daemon)
endef
define Package/snmpd/description
$(call Package/net-snmp/Default/description)
.
This package contains the SNMP agent, dynamically linked.
endef
define Package/snmpd-static
$(call Package/net-snmp/Default)
DEPENDS:=+snmpd
TITLE:=Open source SNMP implementation (daemon)
endef
define Package/snmptrapd
$(call Package/net-snmp/Default)
DEPENDS:=+libnetsnmp
TITLE:=Open source SNMP implementation (notification receiver)
endef
define Package/snmptrapd/description
$(call Package/net-snmp/Default/description)
.
This package contains the SNMP notification receiver.
endef
SNMP_MIB_MODULES_INCLUDED = \
agent/extend \
agentx \
host/hr_device \
host/hr_disk \
host/hr_filesys \
host/hr_network \
host/hr_partition \
host/hr_proc \
host/hr_storage \
host/hr_system \
ieee802dot11 \
if-mib/ifXTable \
ip-mib/inetNetToMediaTable \
mibII/at \
mibII/icmp \
mibII/ifTable \
mibII/ip \
mibII/snmp_mib \
mibII/sysORTable \
mibII/system_mib \
mibII/tcp \
mibII/udp \
mibII/vacm_context \
mibII/vacm_vars \
snmpv3/snmpEngine \
snmpv3/snmpMPDStats \
snmpv3/usmConf \
snmpv3/usmStats \
snmpv3/usmUser \
tunnel \
ucd-snmp/disk \
ucd-snmp/dlmod \
ucd-snmp/extensible \
ucd-snmp/loadave \
ucd-snmp/memory \
ucd-snmp/pass \
2015-03-12 16:49:39 +01:00
ucd-snmp/pass_persist \
ucd-snmp/proc \
ucd-snmp/vmstat \
util_funcs \
utilities/execute \
SNMP_MIB_MODULES_EXCLUDED = \
agent_mibs \
disman/event \
disman/schedule \
hardware \
host \
if-mib \
ip-mib \
mibII \
notification \
notification-log-mib \
snmpv3mibs \
target \
tcp-mib \
ucd_snmp \
udp-mib \
utilities \
SNMP_TRANSPORTS_INCLUDED = Callback UDP Unix
SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6
TARGET_CFLAGS += $(FPIC)
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>
2017-01-06 16:07:38 +01:00
TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
CONFIGURE_ARGS += \
--enable-mfd-rewrites \
--enable-shared \
--enable-static \
--with-endianness=$(if $(CONFIG_BIG_ENDIAN),big,little) \
--with-logfile=/var/log/snmpd.log \
--with-persistent-directory=/usr/lib/snmp/ \
--with-default-snmp-version=1 \
--with-sys-contact=root@localhost \
--with-sys-location=Unknown \
--enable-applications \
--disable-debugging \
--disable-manuals \
--disable-scripts \
--with-out-mib-modules="$(SNMP_MIB_MODULES_EXCLUDED)" \
--with-mib-modules="$(SNMP_MIB_MODULES_INCLUDED)" \
--with-out-transports="$(SNMP_TRANSPORTS_EXCLUDED)" \
--with-transports="$(SNMP_TRANSPORTS_INCLUDED)" \
--without-openssl \
--without-libwrap \
--without-mysql \
--without-rpm \
--without-zlib \
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>
2017-01-06 16:07:38 +01:00
--with-nl \
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
--disable-perl-cc-checks \
--disable-embedded-perl \
--without-perl-modules
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>
2017-01-06 16:07:38 +01:00
CONFIGURE_VARS += \
ac_cv_header_netlink_netlink_h=yes \
ac_cv_header_pcre_h=no \
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>
2017-01-06 16:07:38 +01:00
netsnmp_cv_func_nl_connect_LIBS=-lnl-tiny \
ifeq ($(CONFIG_IPV6),y)
SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
endif
TARGET_LDFLAGS += -L$(TOOLCHAIN_DIR)/usr/lib
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
LDFLAGS="$(TARGET_LDFLAGS) -lm -lc" \
all install
endef
define Build/InstallDev
$(INSTALL_DIR) $(2)/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(2)/bin/
$(SED) 's,=/usr,=$(STAGING_DIR)/usr,g' $(2)/bin/net-snmp-config
$(INSTALL_DIR) $(STAGING_DIR)/usr/bin
$(LN) $(STAGING_DIR)/host/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(1)/usr/lib/
endef
define Package/libnetsnmp/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
endef
define Package/snmp-mibs/install
$(INSTALL_DIR) $(1)/usr/share/snmp/mibs
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/snmp/mibs/* $(1)/usr/share/snmp/mibs/
endef
define Package/snmp-utils/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
endef
define Package/snmpd/conffiles
/etc/config/snmpd
endef
define Package/snmpd/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
$(INSTALL_DIR) $(1)/etc/snmp
$(LN) /var/run/snmpd.conf $(1)/etc/snmp/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/snmpd.init $(1)/etc/init.d/snmpd
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd $(1)/usr/sbin/snmpd
endef
define Package/snmptrapd/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/snmptrapd.init $(1)/etc/init.d/snmptrapd
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmptrapd.so.* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmptrapd $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,libnetsnmp))
$(eval $(call BuildPackage,snmp-mibs))
$(eval $(call BuildPackage,snmp-utils))
$(eval $(call BuildPackage,snmpd))
$(eval $(call BuildPackage,snmpd-static))
$(eval $(call BuildPackage,snmptrapd))