add tspc package (freenet6 client)
[openwrt/svn-archive/archive.git] / net / pmacct / 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:=pmacct
12 PKG_VERSION:=0.10.3
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.ba.cnr.it/~paolo/pmacct/
17 PKG_MD5SUM:=0be1ffd9d4bda73575caa3240abbf4cb
18 PKG_CAT:=zcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21
22 PKG_BUILD_DEPENDS:=libpcap
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/pmacct/Default
27 SECTION:=net
28 CATEGORY:=Network
29 SUBMENU:=pmacct (accounting and aggregation tools)
30 URL:=http://www.ba.cnr.it/~paolo/pmacct/
31 endef
32
33 define Package/nfacctd/Default
34 $(call Package/pmacct/Default)
35 TITLE:=NetFlow accounting daemon
36 endef
37
38 define Package/nfacctd
39 $(call Package/nfacctd/Default)
40 endef
41
42 define Package/nfacctd-mysql
43 $(call Package/nfacctd/Default)
44 TITLE+= with MySQL support
45 DEPENDS+= +libmysqlclient
46 endef
47
48 define Package/nfacctd-pgsql
49 $(call Package/nfacctd/Default)
50 TITLE+= with PostreSQL support
51 DEPENDS+= +libpq
52 endef
53
54 define Package/nfacctd-sqlite
55 $(call Package/nfacctd/Default)
56 TITLE+= with SQLite support
57 DEPENDS+= +libsqlite3
58 endef
59
60 define Package/pmacctd/Default
61 $(call Package/pmacct/Default)
62 DEPENDS+= +libpcap
63 TITLE:=IP pcap-based accounting daemon
64 endef
65
66 define Package/pmacctd
67 $(call Package/pmacctd/Default)
68 endef
69
70 define Package/pmacctd-mysql
71 $(call Package/pmacctd/Default)
72 TITLE+= with MySQL support
73 DEPENDS+= +libmysqlclient
74 endef
75
76 define Package/pmacctd-pgsql
77 $(call Package/pmacctd/Default)
78 TITLE+= with PostreSQL support
79 DEPENDS+= +libpq
80 endef
81
82 define Package/pmacctd-sqlite
83 $(call Package/pmacctd/Default)
84 TITLE+= with SQLite support
85 DEPENDS+= +libsqlite3
86 endef
87
88 define Package/sfacctd/Default
89 $(call Package/pmacct/Default)
90 TITLE:=sFlow accounting daemon
91 endef
92
93 define Package/pmacct-client
94 $(call Package/pmacct/Default)
95 TITLE:=Command-line client to gather data from the IMT plugin
96 endef
97
98 ifneq ($(SDK),)
99 CONFIG_PACKAGE_nfacctd:=m
100 CONFIG_PACKAGE_nfacctd-mysql:=m
101 CONFIG_PACKAGE_nfacctd-pgsql:=m
102 CONFIG_PACKAGE_nfacctd-sqlite:=m
103 CONFIG_PACKAGE_pmacctd:=m
104 CONFIG_PACKAGE_pmacctd-mysql:=m
105 CONFIG_PACKAGE_pmacctd-pgsql:=m
106 CONFIG_PACKAGE_pmacctd-sqlite:=m
107 endif
108
109 define Compile/Template
110
111 $(PKG_BUILD_DIR)/nfacctd-$(1) $(PKG_BUILD_DIR)/pmacctd-$(1): $(PKG_BUILD_DIR)/.configured
112 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
113 $(call Build/Configure/Default, \
114 --with-pcap-includes="$(STAGING_DIR)/usr/include" \
115 --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
116 $(2) \
117 ,\
118 LIBS="-lz" \
119 ,
120 );
121 $(MAKE) -C $(PKG_BUILD_DIR) \
122 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
123 all
124 mv -f $(PKG_BUILD_DIR)/src/nfacctd $(PKG_BUILD_DIR)/nfacctd-$(1)
125 mv -f $(PKG_BUILD_DIR)/src/pmacctd $(PKG_BUILD_DIR)/pmacctd-$(1)
126
127 ifneq ($(CONFIG_PACKAGE_nfacctd$(3))$(CONFIG_PACKAGE_pmacctd$(3)),)
128 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/nfacctd-$(1) $(PKG_BUILD_DIR)/pmacctd-$(1)
129 endif
130
131 endef
132
133
134 define Install/Template
135
136 define Package/$(1)/conffiles
137 /etc/default/$(3)
138 /etc/$(3).conf
139 endef
140
141 define Package/$(1)/install
142 $(INSTALL_DIR) $$(1)/usr/sbin
143 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2) $$(1)/usr/sbin/$(3)
144 $(INSTALL_DIR) $$(1)/etc
145 $(INSTALL_DATA) ./files/$(3).conf $$(1)/etc/
146 $(INSTALL_DIR) $$(1)/etc/default
147 $(INSTALL_DATA) ./files/$(3).default $$(1)/etc/default/$(3)
148 $(INSTALL_DIR) $$(1)/etc/init.d
149 $(INSTALL_BIN) ./files/$(3).init $$(1)/etc/init.d/$(3)
150 endef
151
152 endef
153
154
155 $(eval $(call Compile/Template,basic,,))
156 $(eval $(call Install/Template,nfacctd,nfacctd-basic,nfacctd))
157 $(eval $(call Install/Template,pmacctd,pmacctd-basic,pmacctd))
158
159 $(eval $(call Compile/Template,mysql, \
160 --enable-mysql \
161 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
162 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
163 ,-mysql))
164 $(eval $(call Install/Template,nfacctd-mysql,nfacctd-mysql,nfacctd))
165 $(eval $(call Install/Template,pmacctd-mysql,pmacctd-mysql,pmacctd))
166
167 $(eval $(call Compile/Template,pgsql, \
168 --enable-pgsql \
169 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
170 --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
171 ,-pgsql))
172
173 $(eval $(call Install/Template,nfacctd-pgsql,nfacctd-pgsql,nfacctd))
174 $(eval $(call Install/Template,pmacctd-pgsql,pmacctd-pgsql,pmacctd))
175
176 $(eval $(call Compile/Template,sqlite, \
177 --enable-sqlite3 \
178 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
179 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
180 ,-sqlite))
181 $(eval $(call Install/Template,nfacctd-sqlite,nfacctd-sqlite,nfacctd))
182 $(eval $(call Install/Template,pmacctd-sqlite,pmacctd-sqlite,pmacctd))
183
184 define Build/Configure
185 endef
186
187 define Build/Compile
188 endef
189
190 define Package/pmacct-client/install
191 $(INSTALL_DIR) $(1)/usr/sbin
192 $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
193 endef
194
195 $(eval $(call BuildPackage,nfacctd))
196 $(eval $(call BuildPackage,nfacctd-mysql))
197 $(eval $(call BuildPackage,nfacctd-pgsql))
198 $(eval $(call BuildPackage,nfacctd-sqlite))
199 $(eval $(call BuildPackage,pmacctd))
200 $(eval $(call BuildPackage,pmacctd-mysql))
201 $(eval $(call BuildPackage,pmacctd-pgsql))
202 $(eval $(call BuildPackage,pmacctd-sqlite))
203 $(eval $(call BuildPackage,pmacct-client))