Convert net-snmp to autotargets

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
This commit is contained in:
Gustavo Zacarias 2010-07-20 15:30:07 -03:00 committed by Thomas Petazzoni
parent d47c73ee9b
commit d54f37fb08
2 changed files with 36 additions and 137 deletions

View File

@ -1,13 +1,8 @@
config BR2_PACKAGE_NETSNMP config BR2_PACKAGE_NETSNMP
bool "netsnmp" bool "netsnmp"
# Build with external toolchains is broken, libtool strips
# --sysroot at link time
depends on !BR2_TOOLCHAIN_EXTERNAL
help help
Suite of applications used to implement SNMP v1, SNMP v2c, and Suite of applications used to implement SNMP v1, SNMP v2c, and
SNMP v3 using both IPv4 and IPv6. SNMP v3 using both IPv4 and IPv6.
http://net-snmp.sourceforge.net/ http://net-snmp.sourceforge.net/
comment "lmbench is broken with external toolchains"
depends on BR2_TOOLCHAIN_EXTERNAL

View File

@ -3,150 +3,54 @@
# netsnmp # netsnmp
# #
############################################################# #############################################################
NETSNMP_VERSION:=5.5
NETSNMP_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/net-snmp/
NETSNMP_DIR:=$(BUILD_DIR)/net-snmp-$(NETSNMP_VERSION)
NETSNMP_SOURCE:=net-snmp-$(NETSNMP_VERSION).tar.gz
NETSNMP_WO_TRANSPORT:= NETSNMP_VERSION = 5.5
ifneq ($(BR2_INET_IPX),y) NETSNMP_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/net-snmp
NETSNMP_WO_TRANSPORT+= IPX NETSNMP_SOURCE = net-snmp-$(NETSNMP_VERSION).tar.gz
endif NETSNMP_INSTALL_STAGING = YES
ifneq ($(BR2_INET_IPV6),y) NETSNMP_INSTALL_TARGET_OPT = DESTDIR=$(TARGET_DIR) install
NETSNMP_WO_TRANSPORT+= UDPIPv6 TCPIPv6 NETSNMP_LIBTOOL_PATCH = NO
endif NETSNMP_CONF_ENV = ac_cv_NETSNMP_CAN_USE_SYSCTL=yes
NETSNMP_CONF_OPT = --with-persistent-directory=/var/lib/snmp --disable-static \
$(DL_DIR)/$(NETSNMP_SOURCE): --with-defaults --enable-mini-agent --without-rpm \
$(call DOWNLOAD,$(NETSNMP_SITE),$(NETSNMP_SOURCE)) --with-logfile=none --without-kmem-usage $(DISABLE_IPV6) \
--enable-as-needed --disable-debugging --without-perl-modules \
$(NETSNMP_DIR)/.unpacked: $(DL_DIR)/$(NETSNMP_SOURCE) --disable-embedded-perl --disable-perl-cc-checks \
$(ZCAT) $(DL_DIR)/$(NETSNMP_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - --with-sys-contact="root@unknown" \
toolchain/patch-kernel.sh $(NETSNMP_DIR) package/netsnmp/ \*$(NETSNMP_VERSION)\*.patch --with-sys-location="Unknown" \
$(CONFIG_UPDATE) $(@D) --with-mib-modules="host smux ucd-snmp/dlmod"
touch $@
ifeq ($(BR2_ENDIAN),"BIG") ifeq ($(BR2_ENDIAN),"BIG")
NETSNMP_ENDIAN=big NETSNMP_CONF_OPT += --with-endianness=big
else else
NETSNMP_ENDIAN=little NETSNMP_CONF_OPT += --with-endianness=little
endif
ifeq ($(BR2_HAVE_PERL),y)
NETSNMP_CONFIGURE_PERL_ENV:=\
PERLCC="$(TARGET_CC)"
NETSNMP_CONFIGURE_PERL:=\
--disable-embedded-perl \
--disable-perl-cc-checks \
--enable-as-needed
else
NETSNMP_CONFIGURE_PERL_ENV:=
NETSNMP_CONFIGURE_PERL:=\
--disable-embedded-perl \
--disable-perl-cc-checks \
--without-perl-modules
endif endif
# OpenSSL
ifeq ($(BR2_PACKAGE_OPENSSL),y) ifeq ($(BR2_PACKAGE_OPENSSL),y)
NETSNMP_CONFIGURE_OPENSSL:=--with-openssl=$(STAGING_DIR)/usr/include/openssl NETSNMP_CONF_OPT += \
--with-openssl=$(STAGING_DIR)/usr/include/openssl
else else
NETSNMP_CONFIGURE_OPENSSL:=--without-openssl NETSNMP_CONF_OPT += --without-openssl
endif endif
# Docs
ifneq ($(BR2_HAVE_DOCUMENTATION),y) ifneq ($(BR2_HAVE_DOCUMENTATION),y)
NETSNMP_DOCS:=--disable-manuals NETSNMP_CONF_OPT += --disable-manuals
endif endif
$(NETSNMP_DIR)/.configured: $(NETSNMP_DIR)/.unpacked define NETSNMP_INSTALL_TARGET_CMDS
(cd $(NETSNMP_DIR); rm -f config.cache; \ $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
$(AUTOCONF) && \ DESTDIR=$(TARGET_DIR) install
ac_cv_NETSNMP_CAN_USE_SYSCTL=yes \ $(INSTALL) -D -m 0755 package/netsnmp/S59snmpd \
$(NETSNMP_CONFIGURE_PERL_ENV) \ $(TARGET_DIR)/etc/init.d/S59snmpd
$(TARGET_CONFIGURE_OPTS) \ endef
$(TARGET_CONFIGURE_ARGS) \
./configure $(QUIET) \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--with-cc=$(TARGET_CROSS)gcc \
--with-linkcc=$(TARGET_CROSS)gcc \
--with-ar=$(TARGET_CROSS)ar \
--with-cflags="$(TARGET_CFLAGS)" \
--with-ldflags="$(TARGET_LDFLAGS)" \
--with-endianness=$(NETSNMP_ENDIAN) \
--with-persistent-directory=/var/lib/snmp \
--enable-ucd-snmp-compatibility \
--enable-shared \
--disable-static \
--with-logfile=none \
--without-rpm \
$(NETSNMP_CONFIGURE_OPENSSL) \
$(NETSNMP_DOCS) \
$(NETSNMP_CONFIGURE_PERL) \
--without-dmalloc \
--without-efence \
--without-rsaref \
--with-sys-contact="root" \
--with-sys-location="Unknown" \
--with-mib-modules="host smux ucd-snmp/dlmod" \
--with-out-transports="$(NETSNMP_WO_TRANSPORT)" \
--with-defaults \
--disable-debugging \
--prefix=/usr \
--sysconfdir=/etc \
--enable-mini-agent \
--without-kmem-usage \
$(DISABLE_IPV6) \
)
touch $@
$(NETSNMP_DIR)/agent/snmpd: $(NETSNMP_DIR)/.configured define NETSNMP_UNINSTALL_TARGET_CMDS
$(MAKE1) -C $(NETSNMP_DIR) $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
touch -c $@ DESTDIR=$(TARGET_DIR) uninstall
rm -f $(TARGET_DIR)/etc/init.d/S59snmpd
rm -f $(TARGET_DIR)/usr/lib/libnetsnmp*
endef
$(TARGET_DIR)/usr/sbin/snmpd: $(NETSNMP_DIR)/agent/snmpd $(eval $(call AUTOTARGETS,package,netsnmp))
$(MAKE) PREFIX=$(TARGET_DIR)/usr \
prefix=$(TARGET_DIR)/usr \
exec_prefix=$(TARGET_DIR)/usr \
persistentdir=$(TARGET_DIR)/var/lib/snmp \
includedir=$(STAGING_DIR)/usr/include/net-snmp \
ucdincludedir=$(STAGING_DIR)/usr/include/ucd-snmp \
-C $(NETSNMP_DIR) install
# Copy the .conf files.
$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/EXAMPLE.conf $(TARGET_DIR)/etc/snmp/snmpd.conf
-mv $(TARGET_DIR)/usr/share/snmp/mib2c*.conf $(TARGET_DIR)/etc/snmp
# Remove the unsupported snmpcheck program
rm -f $(TARGET_DIR)/usr/bin/snmpcheck
# Install the "broken" headers
$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/struct.h $(STAGING_DIR)/usr/include/net-snmp/agent/struct.h
$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/util_funcs.h $(STAGING_DIR)/usr/include/net-snmp/util_funcs.h
$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/mibincl.h $(STAGING_DIR)/usr/include/net-snmp/library/mibincl.h
$(INSTALL) -D -m 0644 $(NETSNMP_DIR)/agent/mibgroup/header_complex.h $(STAGING_DIR)/usr/include/net-snmp/agent/header_complex.h
$(INSTALL) -D -m 0755 package/netsnmp/S59snmpd $(TARGET_DIR)/etc/init.d/S59snmpd
netsnmp: host-autoconf $(if $(BR2_PACKAGE_OPENSSL),openssl) $(TARGET_DIR)/usr/sbin/snmpd
netsnmp-headers: $(TARGET_DIR)/usr/include/net-snmp/net-snmp-config.h
$(INSTALL) -d $(TARGET_DIR)/usr/include/net-snmp
cp -a $(STAGING_DIR)/usr/include/net-snmp $(TARGET_DIR)/usr/include/net-snmp
cp -a $(STAGING_DIR)/usr/include/ucd-snmp $(TARGET_DIR)/usr/include/net-snmp
netsnmp-source: $(DL_DIR)/$(NETSNMP_SOURCE)
netsnmp-clean:
-$(MAKE) PREFIX=$(TARGET_DIR) INSTALL_PREFIX=$(TARGET_DIR) DESTDIR=$(TARGET_DIR) CC="$(TARGET_CC)" -C $(NETSNMP_DIR) uninstall
-$(MAKE) -C $(NETSNMP_DIR) clean
-rm -rf $(TARGET_DIR)/etc/snmp/{snmpd{,trapd},mib2c*}.conf \
$(TARGET_DIR)/etc/default/snmpd \
$(TARGET_DIR)/usr/include/net-snmp
netsnmp-dirclean:
rm -rf $(NETSNMP_DIR)
#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(BR2_PACKAGE_NETSNMP),y)
TARGETS+=netsnmp
endif