2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.ba.cnr.it/~paolo/pmacct/
17 PKG_MD5SUM:=0be1ffd9d4bda73575caa3240abbf4cb
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21 PKG_BUILD_DEPENDS:=libpcap
23 include $(INCLUDE_DIR)/package.mk
25 define Package/pmacct/Default
28 SUBMENU:=pmacct (accounting and aggregation tools)
29 URL:=http://www.ba.cnr.it/~paolo/pmacct/
32 define Package/nfacctd/Default
33 $(call Package/pmacct/Default)
34 TITLE:=NetFlow accounting daemon
37 define Package/nfacctd
38 $(call Package/nfacctd/Default)
41 define Package/nfacctd-mysql
42 $(call Package/nfacctd/Default)
43 TITLE+= with MySQL support
44 DEPENDS+= +libmysqlclient
47 define Package/nfacctd-pgsql
48 $(call Package/nfacctd/Default)
49 TITLE+= with PostreSQL support
53 define Package/nfacctd-sqlite
54 $(call Package/nfacctd/Default)
55 TITLE+= with SQLite support
59 define Package/pmacctd/Default
60 $(call Package/pmacct/Default)
62 TITLE:=IP pcap-based accounting daemon
65 define Package/pmacctd
66 $(call Package/pmacctd/Default)
69 define Package/pmacctd-mysql
70 $(call Package/pmacctd/Default)
71 TITLE+= with MySQL support
72 DEPENDS+= +libmysqlclient
75 define Package/pmacctd-pgsql
76 $(call Package/pmacctd/Default)
77 TITLE+= with PostreSQL support
81 define Package/pmacctd-sqlite
82 $(call Package/pmacctd/Default)
83 TITLE+= with SQLite support
87 define Package/pmacct-client
88 $(call Package/pmacct/Default)
89 TITLE:=Command-line client to gather data from the IMT plugin
92 define Compile/Template
94 $(PKG_BUILD_DIR)/nfacctd$(1) $(PKG_BUILD_DIR)/pmacctd$(1): $(PKG_BUILD_DIR)/.configured
95 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
96 $(call Build/Configure/Default, \
97 --with-pcap-includes="$(STAGING_DIR)/usr/include" \
98 --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
104 $(MAKE) -C $(PKG_BUILD_DIR) \
105 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
107 mv -f $(PKG_BUILD_DIR)/src/nfacctd $(PKG_BUILD_DIR)/nfacctd$(1)
108 mv -f $(PKG_BUILD_DIR)/src/pmacctd $(PKG_BUILD_DIR)/pmacctd$(1)
110 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/nfacctd$(1) $(PKG_BUILD_DIR)/pmacctd$(1)
115 define Install/Template
117 define Package/$(1)$(2)/conffiles
122 define Package/$(1)$(2)/install
123 $(INSTALL_DIR) $$(1)/usr/sbin
124 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(1)$(2) $$(1)/usr/sbin/$(1)
125 $(INSTALL_DIR) $$(1)/etc
126 $(INSTALL_DATA) ./files/$(1).conf $$(1)/etc/
127 $(INSTALL_DIR) $$(1)/etc/default
128 $(INSTALL_DATA) ./files/$(1).default $$(1)/etc/default/$(1)
129 $(INSTALL_DIR) $$(1)/etc/init.d
130 $(INSTALL_BIN) ./files/$(1).init $$(1)/etc/init.d/$(1)
135 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd)$(CONFIG_PACKAGE_pmacctd),)
136 define Compile/pmacct/basic
137 $(call Compile/Template,, \
142 $(call Install/Template,nfacctd,)
143 $(call Install/Template,pmacctd,)
146 $(eval $(Compile/pmacct/basic))
148 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-mysql)$(CONFIG_PACKAGE_pmacctd-mysql),)
149 define Compile/pmacct/mysql
150 $(call Compile/Template,-mysql, \
152 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
153 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
155 $(call Install/Template,nfacctd,-mysql)
156 $(call Install/Template,pmacctd,-mysql)
159 $(eval $(Compile/pmacct/mysql))
161 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-pgsql)$(CONFIG_PACKAGE_pmacctd-pgsql),)
162 define Compile/pmacct/pgsql
163 $(call Compile/Template,-pgsql, \
165 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
166 --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
168 $(call Install/Template,nfacctd,-pgsql)
169 $(call Install/Template,pmacctd,-pgsql)
172 $(eval $(Compile/pmacct/pgsql))
174 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-sqlite)$(CONFIG_PACKAGE_pmacctd-sqlite),)
175 define Compile/pmacct/sqlite
176 $(call Compile/Template,-sqlite, \
178 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
179 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
181 $(call Install/Template,nfacctd,-sqlite)
182 $(call Install/Template,pmacctd,-sqlite)
185 $(eval $(Compile/pmacct/sqlite))
187 define Build/Configure
193 define Package/pmacct-client/install
194 $(INSTALL_DIR) $(1)/usr/sbin
195 $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
198 $(eval $(call BuildPackage,nfacctd))
199 $(eval $(call BuildPackage,nfacctd-mysql))
200 $(eval $(call BuildPackage,nfacctd-pgsql))
201 $(eval $(call BuildPackage,nfacctd-sqlite))
202 $(eval $(call BuildPackage,pmacctd))
203 $(eval $(call BuildPackage,pmacctd-mysql))
204 $(eval $(call BuildPackage,pmacctd-pgsql))
205 $(eval $(call BuildPackage,pmacctd-sqlite))
206 $(eval $(call BuildPackage,pmacct-client))