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