2 # Copyright (C) 2006-2012 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:=4588531f0e8033fe82ad7fb22d1bbdb7
18 PKG_BUILD_DEPENDS:=libpcap
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
22 PKG_CONFIG_DEPENDS:= \
27 include $(INCLUDE_DIR)/package.mk
29 define Package/pmacct/Default
31 CATEGORY:=Administration
33 URL:=http://www.pmacct.net/
36 define Package/pmacct-client
37 $(call Package/pmacct/Default)
38 TITLE:=Command-line client to gather data from the IMT plugin
42 define Package/nfacctd/Default
43 $(call Package/pmacct/Default)
44 TITLE:=NetFlow accounting daemon
47 define Package/pmacctd/Default
48 $(call Package/pmacct/Default)
50 TITLE:=IP pcap-based accounting daemon
53 define Package/sfacctd/Default
54 $(call Package/pmacct/Default)
56 TITLE:=sFlow accounting daemon
59 define Package/uacctd/Default
60 $(call Package/pmacct/Default)
61 DEPENDS+= +iptables-mod-ulog
62 TITLE:=ulog accounting daemon
67 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
68 --with-pcap-includes="$(STAGING_DIR)/usr/include" \
69 --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
72 ifeq ($(BUILD_VARIANT),basic)
81 ifeq ($(BUILD_VARIANT),mysql)
85 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
86 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
95 ifeq ($(BUILD_VARIANT),pgsql)
100 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
101 --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
106 ifeq ($(BUILD_VARIANT),sqlite)
112 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
113 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
118 define Package/pmacct-client/install
119 $(INSTALL_DIR) $(1)/usr/sbin
120 $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
124 # $(1): build variant {basic,mysql,pgsql,sqlite}
125 # $(2): package name prefix {nfacctd,pmacctd,sfacctd,uacctd}
126 # $(3): package name suffix {,-mysql,-pgsql,-sqlite}
127 # $(4): additional title (with MySQL support, ...)
128 # $(5): additional dependencies (+libmysqlclient, ...)
130 define BuildPackage/Template
132 define Package/$(2)$(3)
133 $(call Package/$(2)/Default)
139 define Package/$(2)$(3)/conffiles
144 define Package/$(2)$(3)/install
145 $(INSTALL_DIR) $$(1)/usr/sbin
146 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(2) $$(1)/usr/sbin/
147 $(INSTALL_DIR) $$(1)/etc
148 $(INSTALL_DATA) ./files/$(2).conf $$(1)/etc/
149 $(INSTALL_DIR) $$(1)/etc/default
150 $(INSTALL_DATA) ./files/$(2).default $$(1)/etc/default/$(2)
151 $(INSTALL_DIR) $$(1)/etc/init.d
152 $(INSTALL_BIN) ./files/$(2).init $$(1)/etc/init.d/$(2)
155 $$(eval $$(call BuildPackage,$(2)$(3)))
159 $(eval $(call BuildPackage,pmacct-client))
161 $(eval $(call BuildPackage/Template,basic,nfacctd,,,))
162 $(eval $(call BuildPackage/Template,basic,pmacctd,,,))
163 $(eval $(call BuildPackage/Template,basic,sfacctd,,,))
164 $(eval $(call BuildPackage/Template,basic,uacctd,,,))
166 $(eval $(call BuildPackage/Template,mysql,nfacctd,-mysql,with MySQL support,+libmysqlclient))
167 $(eval $(call BuildPackage/Template,mysql,pmacctd,-mysql,with MySQL support,+libmysqlclient))
168 $(eval $(call BuildPackage/Template,mysql,sfacctd,-mysql,with MySQL support,+libmysqlclient))
169 $(eval $(call BuildPackage/Template,mysql,uacctd,-mysql,with MySQL support,+libmysqlclient))
171 $(eval $(call BuildPackage/Template,pgsql,nfacctd,-pgsql,with PostgreSQL support,+libpq))
172 $(eval $(call BuildPackage/Template,pgsql,pmacctd,-pgsql,with PostgreSQL support,+libpq))
173 $(eval $(call BuildPackage/Template,pgsql,sfacctd,-pgsql,with PostgreSQL support,+libpq))
174 $(eval $(call BuildPackage/Template,pgsql,uacctd,-pgsql,with PostgreSQL support,+libpq))
176 $(eval $(call BuildPackage/Template,sqlite,nfacctd,-sqlite,with SQLite support,+libsqlite3))
177 $(eval $(call BuildPackage/Template,sqlite,pmacctd,-sqlite,with SQLite support,+libsqlite3))
178 $(eval $(call BuildPackage/Template,sqlite,sfacctd,-sqlite,with SQLite support,+libsqlite3))
179 $(eval $(call BuildPackage/Template,sqlite,uacctd,-sqlite,with SQLite support,+libsqlite3))