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