f0604d4326b7f380547b884e0d3e18d6456ded19
[packages.git] / utils / rrdcollect / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=rrdcollect
12 PKG_VERSION:=0.2.3
13 PKG_RELEASE:=1
14 PKG_MD5SUM:=5e4305c612bc3cccbaf802c275c81a11
15
16 PKG_SOURCE_URL:=@SF/rrdcollect
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 PKG_CAT:=zcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 ifneq ($(BR2_PACKAGE_LIBRRD),)
24 RRDTOOL_LIBS:=-lart_lgpl_2 -lfreetype -lpng
25 endif
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/rrdcollect
30   SECTION:=utils
31   CATEGORY:=Utilities
32   DEPENDS:=+librrd1
33   TITLE:=Round-Robin Database (RRD) collecting daemon
34   DESCRIPTION:=RRDcollect is a daemon which polls ceratin files in /proc/\\\
35         directory, gathering data and storing it inside RRDtool's\\\
36         database files.  Being written in C should be both fast\\\
37         and resources-friendly.  Supports both scanf(3)-style\\\
38         pattern matches and perl compatible regular expressions.\\\
39   URL:=http://rrdcollect.sourceforge.net/
40   MENU:=1
41 endef
42
43 define Package/rrdcollect-example
44   SECTION:=utils
45   CATEGORY:=Utilities
46   DEPENDS:=rrdcollect
47   TITLE:=Example setup for RRD collecting daemon above
48   DESCRIPTION:=RRDcollect is a daemon which polls ceratin files in /proc/\\\
49         directory, gathering data and storing it inside RRDtool's\\\
50         database files.  Being written in C should be both fast\\\
51         and resources-friendly.  Supports both scanf(3)-style\\\
52         pattern matches and perl compatible regular expressions.\\\
53   URL:=http://rrdcollect.sourceforge.net/
54 endef
55
56 define Package/rrdcollect-example/conffiles
57 /etc/rrd.conf
58 /etc/rrdcollect.conf
59 endef
60
61 define Build/Configure
62 $(call Build/Configure/Default,--enable-shared \
63                         --disable-static \
64                         --disable-rpath \
65                         --with-gnu-ld \
66                         --enable-exec \
67                         --without-rrdtool \
68                         --with-librrd \
69                         --without-libpcre \
70                         --without-libpcap, CFLAGS="$(TARGET_CFLAGS) -DSOCKET_COMM" \
71                 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
72                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
73                 LIBS="$(RRDTOOL_LIBS) -lz" \
74                 PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
75                 ac_cv_func_malloc_0_nonnull=yes)
76 endef
77
78 define Build/Compile    
79         rm -rf $(PKG_INSTALL_DIR)
80         mkdir -p $(PKG_INSTALL_DIR)
81         $(MAKE) -C $(PKG_BUILD_DIR) \
82                 DESTDIR="$(PKG_INSTALL_DIR)" \
83                 all install
84 endef
85
86 define Package/rrdcollect/install       
87         install -d -m0755 $(1)/usr/sbin
88         $(CP) $(PKG_INSTALL_DIR)/usr/sbin/rrdcollect $(1)/usr/sbin/
89 endef
90
91 define Package/rrdcollect-example/install       
92         install -d -m0755 $(1)/etc
93         install -m0644 ./files/rrd.conf $(1)/etc/
94         install -m0644 ./files/rrdcollect.conf $(1)/etc/
95         install -d -m0755 $(1)/etc/init.d
96         install -m0755 ./files/rrdcollect.init $(1)/etc/init.d/S98rrdcollect
97         install -d -m0755 $(1)/usr/bin
98         install -m0755 ./files/rrd.sh $(1)/usr/bin/
99         install -d -m0755 $(1)/www/cgi-bin
100         ln -sf /var/lib/rrdcollect/rrd.cgi $(1)/www/cgi-bin/rrd.cgi
101         ln -sf /var/lib/rrdcollect/img $(1)/www/img
102 endef
103
104 $(eval $(call BuildPackage,rrdcollect))
105 $(eval $(call BuildPackage,rrdcollect-example))