[packages] licensing: Licensing metadata added to many packages
[openwrt/svn-archive/archive.git] / admin / pmacct / Makefile
1 #
2 # Copyright (C) 2006-2012 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.14.0
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:=4588531f0e8033fe82ad7fb22d1bbdb7
17
18 PKG_BUILD_DEPENDS:=libpcap
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
21
22 PKG_CONFIG_DEPENDS:= \
23 CONFIG_IPV6 \
24
25 PKG_INSTALL:=1
26
27 include $(INCLUDE_DIR)/package.mk
28
29 define Package/pmacct/Default
30 SECTION:=admin
31 CATEGORY:=Administration
32 SUBMENU:=Pmacct suite
33 URL:=http://www.pmacct.net/
34 DEPENDS=+libpcap
35 endef
36
37 define Package/pmacct-client
38 $(call Package/pmacct/Default)
39 TITLE:=Command-line client to gather data from the IMT plugin
40 VARIANT:=basic
41 endef
42
43 define Package/nfacctd/Default
44 $(call Package/pmacct/Default)
45 TITLE:=NetFlow accounting daemon
46 endef
47
48 define Package/pmacctd/Default
49 $(call Package/pmacct/Default)
50 TITLE:=IP pcap-based accounting daemon
51 endef
52
53 define Package/sfacctd/Default
54 $(call Package/pmacct/Default)
55 TITLE:=sFlow accounting daemon
56 endef
57
58 define Package/uacctd/Default
59 $(call Package/pmacct/Default)
60 DEPENDS+= +iptables-mod-ulog
61 TITLE:=ulog accounting daemon
62 endef
63
64
65 CONFIGURE_ARGS+= \
66 $(call autoconf_bool,CONFIG_IPV6,ipv6) \
67 --with-pcap-includes="$(STAGING_DIR)/usr/include" \
68 --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
69 --enable-ulog \
70
71 ifeq ($(BUILD_VARIANT),basic)
72
73 CONFIGURE_ARGS += \
74 --disable-mysql \
75 --disable-pgsql \
76 --disable-sqlite3 \
77
78 endif
79
80 ifeq ($(BUILD_VARIANT),mysql)
81
82 CONFIGURE_ARGS += \
83 --enable-mysql \
84 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
85 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql" \
86 --disable-pgsql \
87 --disable-sqlite3 \
88
89 CONFIGURE_VARS+= \
90 LIBS="-lz" \
91
92 endif
93
94 ifeq ($(BUILD_VARIANT),pgsql)
95
96 CONFIGURE_ARGS += \
97 --disable-mysql \
98 --enable-pgsql \
99 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
100 --with-pgsql-libs="$(STAGING_DIR)/usr/lib" \
101 --disable-sqlite3 \
102
103 endif
104
105 ifeq ($(BUILD_VARIANT),sqlite)
106
107 CONFIGURE_ARGS += \
108 --disable-mysql \
109 --disable-pgsql \
110 --enable-sqlite3 \
111 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
112 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib" \
113
114 endif
115
116
117 define Package/pmacct-client/install
118 $(INSTALL_DIR) $(1)/usr/sbin
119 $(CP) $(PKG_BUILD_DIR)/src/pmacct $(1)/usr/sbin/
120 endef
121
122
123 # $(1): build variant {basic,mysql,pgsql,sqlite}
124 # $(2): package name prefix {nfacctd,pmacctd,sfacctd,uacctd}
125 # $(3): package name suffix {,-mysql,-pgsql,-sqlite}
126 # $(4): additional title (with MySQL support, ...)
127 # $(5): additional dependencies (+libmysqlclient, ...)
128
129 define BuildPackage/Template
130
131 define Package/$(2)$(3)
132 $(call Package/$(2)/Default)
133 DEPENDS+= $(5)
134 TITLE+= $(4)
135 VARIANT:=$(1)
136 endef
137
138 define Package/$(2)$(3)/conffiles
139 /etc/default/$(2)
140 /etc/$(2).conf
141 endef
142
143 define Package/$(2)$(3)/install
144 $(INSTALL_DIR) $$(1)/usr/sbin
145 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/$(2) $$(1)/usr/sbin/
146 $(INSTALL_DIR) $$(1)/etc
147 $(INSTALL_DATA) ./files/$(2).conf $$(1)/etc/
148 $(INSTALL_DIR) $$(1)/etc/default
149 $(INSTALL_DATA) ./files/$(2).default $$(1)/etc/default/$(2)
150 $(INSTALL_DIR) $$(1)/etc/init.d
151 $(INSTALL_BIN) ./files/$(2).init $$(1)/etc/init.d/$(2)
152 endef
153
154 $$(eval $$(call BuildPackage,$(2)$(3)))
155
156 endef
157
158 $(eval $(call BuildPackage,pmacct-client))
159
160 $(eval $(call BuildPackage/Template,basic,nfacctd,,,))
161 $(eval $(call BuildPackage/Template,basic,pmacctd,,,))
162 $(eval $(call BuildPackage/Template,basic,sfacctd,,,))
163 $(eval $(call BuildPackage/Template,basic,uacctd,,,))
164
165 $(eval $(call BuildPackage/Template,mysql,nfacctd,-mysql,with MySQL support,+libmysqlclient))
166 $(eval $(call BuildPackage/Template,mysql,pmacctd,-mysql,with MySQL support,+libmysqlclient))
167 $(eval $(call BuildPackage/Template,mysql,sfacctd,-mysql,with MySQL support,+libmysqlclient))
168 $(eval $(call BuildPackage/Template,mysql,uacctd,-mysql,with MySQL support,+libmysqlclient))
169
170 $(eval $(call BuildPackage/Template,pgsql,nfacctd,-pgsql,with PostgreSQL support,+libpq))
171 $(eval $(call BuildPackage/Template,pgsql,pmacctd,-pgsql,with PostgreSQL support,+libpq))
172 $(eval $(call BuildPackage/Template,pgsql,sfacctd,-pgsql,with PostgreSQL support,+libpq))
173 $(eval $(call BuildPackage/Template,pgsql,uacctd,-pgsql,with PostgreSQL support,+libpq))
174
175 $(eval $(call BuildPackage/Template,sqlite,nfacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))
176 $(eval $(call BuildPackage/Template,sqlite,pmacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))
177 $(eval $(call BuildPackage/Template,sqlite,sfacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))
178 $(eval $(call BuildPackage/Template,sqlite,uacctd,-sqlite,with SQLite support,+libsqlite3 +zlib))