net/quagga-unstable: fix a cross-compile issue. this need to go upstream. (thank...
[openwrt/svn-archive/archive.git] / net / 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:=net
24 CATEGORY:=Network
25 SUBMENU:=pmacct (accounting and aggregation tools)
26 URL:=http://www.pmacct.net/
27 endef
28
29 define Package/nfacctd/Default
30 $(call Package/pmacct/Default)
31 TITLE:=NetFlow accounting daemon
32 endef
33
34 define Package/nfacctd
35 $(call Package/nfacctd/Default)
36 endef
37
38 define Package/nfacctd-mysql
39 $(call Package/nfacctd/Default)
40 TITLE+= with MySQL support
41 DEPENDS+= +libmysqlclient
42 endef
43
44 define Package/nfacctd-pgsql
45 $(call Package/nfacctd/Default)
46 TITLE+= with PostreSQL support
47 DEPENDS+= +libpq
48 endef
49
50 define Package/nfacctd-sqlite
51 $(call Package/nfacctd/Default)
52 TITLE+= with SQLite support
53 DEPENDS+= +libsqlite3
54 endef
55
56 define Package/pmacctd/Default
57 $(call Package/pmacct/Default)
58 DEPENDS+= +libpcap
59 TITLE:=IP pcap-based accounting daemon
60 endef
61
62 define Package/pmacctd
63 $(call Package/pmacctd/Default)
64 endef
65
66 define Package/pmacctd-mysql
67 $(call Package/pmacctd/Default)
68 TITLE+= with MySQL support
69 DEPENDS+= +libmysqlclient
70 endef
71
72 define Package/pmacctd-pgsql
73 $(call Package/pmacctd/Default)
74 TITLE+= with PostreSQL support
75 DEPENDS+= +libpq
76 endef
77
78 define Package/pmacctd-sqlite
79 $(call Package/pmacctd/Default)
80 TITLE+= with SQLite support
81 DEPENDS+= +libsqlite3
82 endef
83
84 define Package/pmacct-client
85 $(call Package/pmacct/Default)
86 TITLE:=Command-line client to gather data from the IMT plugin
87 endef
88
89 define Compile/Template
90
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" \
96 $(2) \
97 ,\
98 LIBS="-lz" \
99 ,,\
100 );
101 $(MAKE) -C $(PKG_BUILD_DIR) \
102 CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
103 all
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)
106
107 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/nfacctd$(1) $(PKG_BUILD_DIR)/pmacctd$(1)
108
109 endef
110
111
112 define Install/Template
113
114 define Package/$(1)$(2)/conffiles
115 /etc/default/$(1)
116 /etc/$(1).conf
117 endef
118
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)
128 endef
129
130 endef
131
132 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd)$(CONFIG_PACKAGE_pmacctd),)
133 define Compile/pmacct/basic
134 $(call Compile/Template,, \
135 --disable-mysql \
136 --disable-pgsql \
137 --disable-sqlite3 \
138 )
139 $(call Install/Template,nfacctd,)
140 $(call Install/Template,pmacctd,)
141 endef
142 endif
143 $(eval $(Compile/pmacct/basic))
144
145 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-mysql)$(CONFIG_PACKAGE_pmacctd-mysql),)
146 define Compile/pmacct/mysql
147 $(call Compile/Template,-mysql, \
148 --enable-mysql \
149 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
150 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
151 )
152 $(call Install/Template,nfacctd,-mysql)
153 $(call Install/Template,pmacctd,-mysql)
154 endef
155 endif
156 $(eval $(Compile/pmacct/mysql))
157
158 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-pgsql)$(CONFIG_PACKAGE_pmacctd-pgsql),)
159 define Compile/pmacct/pgsql
160 $(call Compile/Template,-pgsql, \
161 --enable-pgsql \
162 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
163 --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
164 )
165 $(call Install/Template,nfacctd,-pgsql)
166 $(call Install/Template,pmacctd,-pgsql)
167 endef
168 endif
169 $(eval $(Compile/pmacct/pgsql))
170
171 ifneq ($(SDK)$(CONFIG_PACKAGE_nfacctd-sqlite)$(CONFIG_PACKAGE_pmacctd-sqlite),)
172 define Compile/pmacct/sqlite
173 $(call Compile/Template,-sqlite, \
174 --enable-sqlite3 \
175 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
176 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
177 )
178 $(call Install/Template,nfacctd,-sqlite)
179 $(call Install/Template,pmacctd,-sqlite)
180 endef
181 endif
182 $(eval $(Compile/pmacct/sqlite))
183
184 define Build/Configure
185 endef
186
187 define Build/Compile
188 endef
189
190 define Package/pmacct-client/install
191 $(INSTALL_DIR) $(1)/usr/sbin
192 $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
193 endef
194
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))