2 # Copyright (C) 2006-2009 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.pmacct.net/
16 PKG_MD5SUM:=0be1ffd9d4bda73575caa3240abbf4cb
18 PKG_BUILD_DEPENDS:=libpcap
20 include $(INCLUDE_DIR)/package.mk
22 define Package/pmacct/Default
25 SUBMENU:=pmacct (accounting and aggregation tools)
26 URL:=http://www.pmacct.net/
29 define Package/nfacctd/Default
30 $(call Package/pmacct/Default)
31 TITLE:=NetFlow accounting daemon
34 define Package/nfacctd
35 $(call Package/nfacctd/Default)
38 define Package/nfacctd-mysql
39 $(call Package/nfacctd/Default)
40 TITLE+= with MySQL support
41 DEPENDS+= +libmysqlclient
44 define Package/nfacctd-pgsql
45 $(call Package/nfacctd/Default)
46 TITLE+= with PostreSQL support
50 define Package/nfacctd-sqlite
51 $(call Package/nfacctd/Default)
52 TITLE+= with SQLite support
56 define Package/pmacctd/Default
57 $(call Package/pmacct/Default)
59 TITLE:=IP pcap-based accounting daemon
62 define Package/pmacctd
63 $(call Package/pmacctd/Default)
66 define Package/pmacctd-mysql
67 $(call Package/pmacctd/Default)
68 TITLE+= with MySQL support
69 DEPENDS+= +libmysqlclient
72 define Package/pmacctd-pgsql
73 $(call Package/pmacctd/Default)
74 TITLE+= with PostreSQL support
78 define Package/pmacctd-sqlite
79 $(call Package/pmacctd/Default)
80 TITLE+= with SQLite support
84 define Package/pmacct-client
85 $(call Package/pmacct/Default)
86 TITLE:=Command-line client to gather data from the IMT plugin
89 define Compile/Template
91 $(PKG_BUILD_DIR)/nfacctd$(1) $(PKG_BUILD_DIR)/pmacctd$(1): $(STAMP_CONFIGURED)
92 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
93 $(call Build/Configure/Default, \
94 --with-pcap-includes="$(STAGING_DIR)/usr/include" \
95 --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
101 $(MAKE) -C $(PKG_BUILD_DIR) \
102 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
104 mv -f $(PKG_BUILD_DIR)/src/nfacctd $(PKG_BUILD_DIR)/nfacctd$(1)
105 mv -f $(PKG_BUILD_DIR)/src/pmacctd $(PKG_BUILD_DIR)/pmacctd$(1)
107 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/nfacctd$(1) $(PKG_BUILD_DIR)/pmacctd$(1)
112 define Install/Template
114 define Package/$(1)$(2)/conffiles
119 define Package/$(1)$(2)/install
120 $(INSTALL_DIR) $$(1)/usr/sbin
121 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(1)$(2) $$(1)/usr/sbin/$(1)
122 $(INSTALL_DIR) $$(1)/etc
123 $(INSTALL_DATA) ./files/$(1).conf $$(1)/etc/
124 $(INSTALL_DIR) $$(1)/etc/default
125 $(INSTALL_DATA) ./files/$(1).default $$(1)/etc/default/$(1)
126 $(INSTALL_DIR) $$(1)/etc/init.d
127 $(INSTALL_BIN) ./files/$(1).init $$(1)/etc/init.d/$(1)
132 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd)$(CONFIG_PACKAGE_pmacctd),)
133 define Compile/pmacct/basic
134 $(call Compile/Template,, \
139 $(call Install/Template,nfacctd,)
140 $(call Install/Template,pmacctd,)
143 $(eval $(Compile/pmacct/basic))
145 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-mysql)$(CONFIG_PACKAGE_pmacctd-mysql),)
146 define Compile/pmacct/mysql
147 $(call Compile/Template,-mysql, \
149 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
150 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
152 $(call Install/Template,nfacctd,-mysql)
153 $(call Install/Template,pmacctd,-mysql)
156 $(eval $(Compile/pmacct/mysql))
158 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-pgsql)$(CONFIG_PACKAGE_pmacctd-pgsql),)
159 define Compile/pmacct/pgsql
160 $(call Compile/Template,-pgsql, \
162 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
163 --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
165 $(call Install/Template,nfacctd,-pgsql)
166 $(call Install/Template,pmacctd,-pgsql)
169 $(eval $(Compile/pmacct/pgsql))
171 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-sqlite)$(CONFIG_PACKAGE_pmacctd-sqlite),)
172 define Compile/pmacct/sqlite
173 $(call Compile/Template,-sqlite, \
175 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
176 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
178 $(call Install/Template,nfacctd,-sqlite)
179 $(call Install/Template,pmacctd,-sqlite)
182 $(eval $(Compile/pmacct/sqlite))
184 define Build/Configure
190 define Package/pmacct-client/install
191 $(INSTALL_DIR) $(1)/usr/sbin
192 $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
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))