#
# Copyright (C) 2006-2009 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:=rrdcollect
PKG_VERSION:=0.2.4
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

define Package/rrdcollect/Default
  SECTION:=utils
  CATEGORY:=Utilities
  URL:=http://rrdcollect.sourceforge.net/
endef

define Package/rrdcollect/Default/description
 RRDcollect is a daemon which polls ceratin files in /proc/ 
 directory, gathering data and storing it inside RRDtool's 
 database files. Being written in C should be both fast 
 and resources-friendly. Supports both scanf(3)-style 
 pattern matches and perl compatible regular expressions.	
endef

define Package/rrdcollect
$(call Package/rrdcollect/Default)
  DEPENDS:=+librrd1
  TITLE:=Round-Robin Database (RRD) collecting daemon
  MENU:=1
endef

define Package/rrdcollect/description
$(call Package/rrdcollect/Default/description)
 This package contains the RRD collecting daemon.
endef

define Package/rrdcollect-example
$(call Package/rrdcollect/Default)
  DEPENDS:=rrdcollect
  TITLE:=Example setup for RRD collecting daemon above
endef

define Package/rrdcollect-example/description
$(call Package/rrdcollect/Default/description)
 This package contains examples for the RRD collecting daemon.
endef

define Package/rrdcollect-example/conffiles
/etc/rrd.conf
/etc/rrdcollect.conf
endef

CONFIGURE_ARGS+= \
	--enable-shared \
	--disable-static \
	--disable-rpath \
	--enable-exec \
	--without-rrdtool \
	--with-librrd \
	--with-libpcre \
	--with-libpcap \

CONFIGURE_VARS+= \
	CFLAGS="$(TARGET_CFLAGS) -DSOCKET_COMM " \

define Build/Compile	
	@echo "Compiling..................."
	$(INSTALL_DIR) $(PKG_BUILD_DIR)/binary
	tar xzfO $(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_arm.ipk ./data.tar.gz | tar -C $(PKG_BUILD_DIR)/binary -xzf -
endef

define Package/rrdcollect/install	
	@echo "Install.................."
	$(CP) $(PKG_BUILD_DIR)/binary/* $(1)
endef

define Package/rrdcollect-example/install	
endef


$(eval $(call BuildPackage,rrdcollect))
$(eval $(call BuildPackage,rrdcollect-example))
