replace lots of manual install commands with INSTALL_* variables
[packages.git] / libs / net-snmp / Makefile
index 4cb66fc..02e30bc 100644 (file)
@@ -20,6 +20,81 @@ PKG_CAT:=zcat
 
 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libnetsnmp
+  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/
+endef
+
+define Package/snmp-utils
+  SECTION:=net
+  CATEGORY:=Network
+  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/snmpd
+  SECTION:=net
+  CATEGORY:=Network
+  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
+endef
+
+define Package/snmpd-static
+  SECTION:=net
+  CATEGORY:=Network
+  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/
+endef
+
+define Package/snmpd-static/conffiles
+/etc/default/snmpd
+/etc/snmp/snmpd.conf
+endef
+
 SNMP_MIB_MODULES_INCLUDED = \
        host/hr_device \
        host/hr_disk \
@@ -99,81 +174,6 @@ PKG_CONFIGURE_OPTIONS = \
        --without-rpm \
        --without-zlib \
 
-include $(INCLUDE_DIR)/package.mk
-
-define Package/libnetsnmp
-  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/
-endef
-
-define Package/snmp-utils
-  SECTION:=net
-  CATEGORY:=Network
-  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/snmpd
-  SECTION:=net
-  CATEGORY:=Network
-  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
-endef
-
-define Package/snmpd-static
-  SECTION:=net
-  CATEGORY:=Network
-  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/
-endef
-
-define Package/snmpd-static/conffiles
-/etc/default/snmpd
-/etc/snmp/snmpd.conf
-endef
-
 define Build/Configure
        (cd $(PKG_BUILD_DIR); rm -f config.cache; \
                $(TARGET_CONFIGURE_OPTS) \
@@ -212,45 +212,45 @@ define Build/Compile
                INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
                all install
        ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-shared; )
-ifneq ($(CONFIG_PACKAGE_snmpd-static),)
+       #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" \
                INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
                all install
        ( cd $(PKG_INSTALL_DIR); mv ./usr/sbin/snmpd ./usr/sbin/snmpd-static; )
-endif
+       #endif
 endef
 
 define Package/libnetsnmp/install
-       install -d -m0755 $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnetsnmp{,agent,helpers,mibs}.so.* $(1)/usr/lib/
 endef
 
 define Package/snmpd/install
-       install -d -m0755 $(1)/etc/snmp
-       install -m0644 ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
-       install -d -m0755 $(1)/etc/default
-       install -m0644 ./files/snmpd.default $(1)/etc/default/snmpd
-       install -d -m0755 $(1)/etc/init.d
-       install -m0755 ./files/snmpd.init $(1)/etc/init.d/snmpd
-       install -d -m0755 $(1)/usr/sbin
-       install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/snmpd-shared $(1)/usr/sbin/snmpd
+       $(INSTALL_DIR) $(1)/etc/snmp
+       $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
+       $(INSTALL_DIR) $(1)/etc/default
+       $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
+       $(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-shared $(1)/usr/sbin/snmpd
 endef
 
 define Package/snmpd-static/install
-       install -d -m0755 $(1)/etc/snmp
-       install -m0644 ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
-       install -d -m0755 $(1)/etc/default
-       install -m0644 ./files/snmpd.default $(1)/etc/default/snmpd
-       install -d -m0755 $(1)/etc/init.d
-       install -m0755 ./files/snmpd.init $(1)/etc/init.d/snmpd
-       install -d -m0755 $(1)/usr/sbin
-       install -m0755 $(PKG_INSTALL_DIR)/usr/sbin/snmpd-static $(1)/usr/sbin/snmpd
+       $(INSTALL_DIR) $(1)/etc/snmp
+       $(INSTALL_DATA) ./files/snmpd.conf $(1)/etc/snmp/snmpd.conf
+       $(INSTALL_DIR) $(1)/etc/default
+       $(INSTALL_DATA) ./files/snmpd.default $(1)/etc/default/snmpd
+       $(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-static $(1)/usr/sbin/snmpd
 endef
 
 define Package/snmp-utils/install
-       install -d -m0755 $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/bin
        $(CP) $(PKG_INSTALL_DIR)/usr/bin/snmp{get,set,status,test,trap,walk} $(1)/usr/bin/
 endef