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