[admin] pmacct: Moved pmacct package from Network|pmacct to Administration because...
[openwrt/svn-archive/archive.git] / admin / pmacct / Makefile
1 #
2 # Copyright (C) 2006-2009 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.pmacct.net/
16 PKG_MD5SUM:=0be1ffd9d4bda73575caa3240abbf4cb
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 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
102 all
103 mv -f $(PKG_BUILD_DIR)/src/nfacctd $(PKG_BUILD_DIR)/nfacctd$(1)
104 mv -f $(PKG_BUILD_DIR)/src/pmacctd $(PKG_BUILD_DIR)/pmacctd$(1)
105
106 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/nfacctd$(1) $(PKG_BUILD_DIR)/pmacctd$(1)
107
108 endef
109
110
111 define Install/Template
112
113 define Package/$(1)$(2)/conffiles
114 /etc/default/$(1)
115 /etc/$(1).conf
116 endef
117
118 define Package/$(1)$(2)/install
119 $(INSTALL_DIR) $$(1)/usr/sbin
120 $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(1)$(2) $$(1)/usr/sbin/$(1)
121 $(INSTALL_DIR) $$(1)/etc
122 $(INSTALL_DATA) ./files/$(1).conf $$(1)/etc/
123 $(INSTALL_DIR) $$(1)/etc/default
124 $(INSTALL_DATA) ./files/$(1).default $$(1)/etc/default/$(1)
125 $(INSTALL_DIR) $$(1)/etc/init.d
126 $(INSTALL_BIN) ./files/$(1).init $$(1)/etc/init.d/$(1)
127 endef
128
129 endef
130
131 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd)$(CONFIG_PACKAGE_pmacctd),)
132 define Compile/pmacct/basic
133 $(call Compile/Template,, \
134 --disable-mysql \
135 --disable-pgsql \
136 --disable-sqlite3 \
137 )
138 $(call Install/Template,nfacctd,)
139 $(call Install/Template,pmacctd,)
140 endef
141 endif
142 $(eval $(Compile/pmacct/basic))
143
144 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-mysql)$(CONFIG_PACKAGE_pmacctd-mysql),)
145 define Compile/pmacct/mysql
146 $(call Compile/Template,-mysql, \
147 --enable-mysql \
148 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
149 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
150 )
151 $(call Install/Template,nfacctd,-mysql)
152 $(call Install/Template,pmacctd,-mysql)
153 endef
154 endif
155 $(eval $(Compile/pmacct/mysql))
156
157 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-pgsql)$(CONFIG_PACKAGE_pmacctd-pgsql),)
158 define Compile/pmacct/pgsql
159 $(call Compile/Template,-pgsql, \
160 --enable-pgsql \
161 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
162 --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
163 )
164 $(call Install/Template,nfacctd,-pgsql)
165 $(call Install/Template,pmacctd,-pgsql)
166 endef
167 endif
168 $(eval $(Compile/pmacct/pgsql))
169
170 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-sqlite)$(CONFIG_PACKAGE_pmacctd-sqlite),)
171 define Compile/pmacct/sqlite
172 $(call Compile/Template,-sqlite, \
173 --enable-sqlite3 \
174 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
175 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
176 )
177 $(call Install/Template,nfacctd,-sqlite)
178 $(call Install/Template,pmacctd,-sqlite)
179 endef
180 endif
181 $(eval $(Compile/pmacct/sqlite))
182
183 define Build/Configure
184 endef
185
186 define Build/Compile
187 endef
188
189 define Package/pmacct-client/install
190 $(INSTALL_DIR) $(1)/usr/sbin
191 $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
192 endef
193
194 $(eval $(call BuildPackage,nfacctd))
195 $(eval $(call BuildPackage,nfacctd-mysql))
196 $(eval $(call BuildPackage,nfacctd-pgsql))
197 $(eval $(call BuildPackage,nfacctd-sqlite))
198 $(eval $(call BuildPackage,pmacctd))
199 $(eval $(call BuildPackage,pmacctd-mysql))
200 $(eval $(call BuildPackage,pmacctd-pgsql))
201 $(eval $(call BuildPackage,pmacctd-sqlite))
202 $(eval $(call BuildPackage,pmacct-client))