[packages] net-snmp: Enable ipv6 support if defined globally
[openwrt/svn-archive/archive.git] / libs / net-snmp / Makefile
index a17e2ca5e72b42f4a7d5718b9f2dae16e380e214..c3f10b79774e1496ad46de70bd124a0cda42417e 100644 (file)
-# 
-# Copyright (C) 2006 OpenWrt.org
+#
+# Copyright (C) 2006-2009 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id$
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=net-snmp
-PKG_VERSION:=5.1.2
-PKG_RELEASE:=2.3
+PKG_VERSION:=5.4.2.1
+PKG_RELEASE:=2
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SF/net-snmp
-PKG_MD5SUM:=8080555ab3f90011f25d5122042d9a8d
-PKG_CAT:=zcat
-
-PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+PKG_MD5SUM:=984932520143f0c8bf7b7ce1fc9e1da1
 
 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:=+libelf
-  TITLE:=Open source SNMP implementation (librairies)
-  DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (libraries).\\\
-    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.\\\
-    \\\
-    This package contains shared libraries, needed by other programs.
-  URL:=http://www.net-snmp.org/
+  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-utils
-  SECTION:=net
-  CATEGORY:=Network
+$(call Package/net-snmp/Default)
   DEPENDS:=+libnetsnmp
   TITLE:=Open source SNMP implementation (utilities)
-  DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (utilities).\\\
-    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.\\\
-    \\\
-    This package contains SNMP client utilities.
-  URL:=http://www.net-snmp.org/
 endef
 
+define Package/snmp-utils/description
+$(call Package/net-snmp/Default/description)
+ .
+ This package contains SNMP client utilities.
+endef
+
+
 define Package/snmpd
-  SECTION:=net
-  CATEGORY:=Network
+$(call Package/net-snmp/Default)
   DEPENDS:=+libnetsnmp
   TITLE:=Open source SNMP implementation (daemon)
-  DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (daemon).\\\
-    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.\\\
-    \\\
-    This package contains the SNMP agent, dynamically linked.
-  URL:=http://www.net-snmp.org/
 endef
 
-define Package/snmpd/conffiles
-/etc/default/snmpd
-/etc/snmp/snmpd.conf
+define Package/snmpd/description
+$(call Package/net-snmp/Default/description)
+ .
+ This package contains the SNMP agent, dynamically linked.
 endef
 
+
 define Package/snmpd-static
-  SECTION:=net
-  CATEGORY:=Network
+$(call Package/net-snmp/Default)
   TITLE:=Open source SNMP implementation (daemon)
-  DESCRIPTION:=Open source SNMP (Simple Network Management Protocol) implementation (daemon).\\\
-    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.\\\
-    \\\
-    This package contains the SNMP agent, statically linked.
-  URL:=http://www.net-snmp.org/
+  DEPENDS:=+libelf
 endef
 
-define Package/snmpd-static/conffiles
-/etc/default/snmpd
-/etc/snmp/snmpd.conf
+define Package/snmpd-static/description
+$(call Package/net-snmp/Default/description)
+ .
+ This package contains the SNMP agent, statically linked.
 endef
 
+
 SNMP_MIB_MODULES_INCLUDED = \
        host/hr_device \
        host/hr_disk \
@@ -104,9 +95,10 @@ SNMP_MIB_MODULES_INCLUDED = \
        host/hr_proc \
        host/hr_storage \
        host/hr_system \
+       ieee802dot11 \
        mibII/at \
        mibII/icmp \
-       mibII/interfaces \
+       mibII/ifTable \
        mibII/ip \
        mibII/snmp_mib \
        mibII/sysORTable \
@@ -119,7 +111,6 @@ SNMP_MIB_MODULES_INCLUDED = \
        snmpv3/snmpMPDStats \
        snmpv3/usmStats \
        snmpv3/usmUser \
-       snmpv3mibs \
        tunnel \
        ucd-snmp/disk \
        ucd-snmp/dlmod \
@@ -135,20 +126,28 @@ SNMP_MIB_MODULES_INCLUDED = \
 SNMP_MIB_MODULES_EXCLUDED = \
        agent_mibs \
        agentx \
+       disman/event \
+       disman/schedule \
+       hardware \
        host \
-       ieee802dot11 \
+       if-mib \
        mibII \
        notification \
+       notification-log-mib \
        snmpv3mibs \
        target \
+       tcp-mib \
        ucd_snmp \
+       udp-mib \
        utilities \
 
-SNMP_TRANSPORTS_INCLUDED = Callback UDP
+SNMP_TRANSPORTS_INCLUDED = Callback UDP 
+
+SNMP_TRANSPORTS_EXCLUDED = TCP TCPIPv6 Unix
 
-SNMP_TRANSPORTS_EXCLUDED = TCP TCPv6 UDPv6 Unix
+TARGET_CFLAGS += $(FPIC)
 
-PKG_CONFIGURE_OPTIONS = \
+CONFIGURE_ARGS += \
        --enable-shared \
        --enable-static \
        --with-endianness=little \
@@ -159,7 +158,6 @@ PKG_CONFIGURE_OPTIONS = \
        --with-sys-location=Unknown \
        --enable-applications \
        --disable-debugging \
-       --disable-ipv6 \
        --disable-manuals \
        --disable-mibs \
        --disable-scripts \
@@ -172,62 +170,55 @@ PKG_CONFIGURE_OPTIONS = \
        --without-rpm \
        --without-zlib \
 
-define Build/Configure
-       (cd $(PKG_BUILD_DIR); rm -f config.cache; \
-               $(TARGET_CONFIGURE_OPTS) \
-               CFLAGS="$(TARGET_CFLAGS)" \
-               CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
-               LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
-               ac_cv_header_pcap_h=no \
-               ./configure \
-                       --target=$(GNU_TARGET_NAME) \
-                       --host=$(GNU_TARGET_NAME) \
-                       --build=$(GNU_HOST_NAME) \
-                       --program-prefix="" \
-                       --program-suffix="" \
-                       --prefix=/usr \
-                       --exec-prefix=/usr \
-                       --bindir=/usr/bin \
-                       --datadir=/usr/share \
-                       --includedir=/usr/include \
-                       --infodir=/usr/share/info \
-                       --libdir=/usr/lib \
-                       --libexecdir=/usr/lib \
-                       --localstatedir=/var \
-                       --mandir=/usr/share/man \
-                       --sbindir=/usr/sbin \
-                       --sysconfdir=/etc \
-                       $(DISABLE_LARGEFILE) \
-                       $(DISABLE_NLS) \
-                       $(PKG_CONFIGURE_OPTIONS) \
-       );
-endef
+ifeq ($(CONFIG_IPV6),y)
+SNMP_TRANSPORTS_INCLUDED+= UDPIPv6
+CONFIGURE_ARGS+= --enable-ipv6
+endif
 
 define Build/Compile
        rm -rf $(PKG_INSTALL_DIR)
        mkdir -p $(PKG_INSTALL_DIR)
        $(MAKE) -C $(PKG_BUILD_DIR) \
+               LDFLAGS="$(TARGET_LDFLAGS) -lm" \
                INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
                all install
        ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
        #ifneq ($(CONFIG_PACKAGE_snmpd-static),)
        ( cd $(PKG_BUILD_DIR); rm -f agent/snmpd; )
        $(MAKE) -C $(PKG_BUILD_DIR) \
-               LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -static" \
+               LDFLAGS="$(TARGET_LDFLAGS) -lm -static" \
                INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
                all install
        ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
        #endif
 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) $(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/snmpd/conffiles
+/etc/default/snmpd
+/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
-       $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
+       ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
        $(INSTALL_DIR) $(1)/etc/default
        $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
        $(INSTALL_DIR) $(1)/etc/init.d
@@ -236,9 +227,16 @@ define Package/snmpd/install
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(1)/usr/sbin/snmpd
 endef
 
+define Package/snmpd-static/conffiles
+/etc/default/snmpd
+/etc/config/snmpd
+endef
+
 define Package/snmpd-static/install
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/config/snmpd
        $(INSTALL_DIR) $(1)/etc/snmp
-       $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
+       ln -sf /var/run/snmpd.conf $(1)/etc/snmp/
        $(INSTALL_DIR) $(1)/etc/default
        $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
        $(INSTALL_DIR) $(1)/etc/init.d
@@ -249,23 +247,7 @@ endef
 
 define Package/snmp-utils/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(CP) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
-endef
-
-define Build/InstallDev
-       mkdir -p $(STAGING_DIR)/usr/bin
-       $(CP) $(PKG_INSTALL_DIR)/usr/bin/net-snmp-config $(STAGING_DIR)/usr/bin/
-       mkdir -p $(STAGING_DIR)/usr/include
-       $(CP) $(PKG_INSTALL_DIR)/usr/include/net-snmp $(STAGING_DIR)/usr/include/
-       mkdir -p $(STAGING_DIR)/usr/lib
-       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*} $(STAGING_DIR)/usr/lib/
-endef
-
-define Build/UninstallDev
-       rm -rf \
-               $(STAGING_DIR)/usr/bin/net-snmp-config \
-               $(STAGING_DIR)/usr/include/net-snmp \
-               $(STAGING_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.{a,so*}
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
 endef
 
 $(eval $(call BuildPackage,libnetsnmp))