Merge pull request #3742 from diizzyy/patch-6
[feed/packages.git] / utils / bandwidthd / Makefile
1 #
2 # Copyright (C) 2006-2017 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:=bandwidthd
11 PKG_VERSION:=2.0.1-34
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://github.com/NethServer/bandwidthd/archive/$(PKG_VERSION)
16 PKG_MD5SUM:=a4075335d06fe91ae815616ed9e27375
17
18 PKG_MAINTAINER:=Jean-Michel Lacroix <lacroix@lepine-lacroix.info>
19
20 PKG_LICENSE:=GPL-2.0
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23
24 PKG_FIXUP:=autoreconf
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/bandwidthd/Default
29 SECTION:=utils
30 CATEGORY:=Utilities
31 TITLE:=Bandwidthd
32 URL:=http://bandwidthd.sourceforge.net/
33 endef
34
35 define Package/bandwidthd
36 $(call Package/bandwidthd/Default)
37 TITLE += (without database)
38 VARIANT:=no-db
39 DEPENDS:=+libgd +libpcap
40 endef
41
42 define Package/bandwidthd-pgsql
43 $(call Package/bandwidthd/Default)
44 TITLE += (with postgresql enabled)
45 VARIANT:=pgsql
46 DEPENDS:=+libgd +libpcap +libpq
47 endef
48
49 define Package/bandwidthd-sqlite
50 $(call Package/bandwidthd/Default)
51 TITLE += (with sqlite enabled)
52 VARIANT:=sqlite
53 DEPENDS:=+libgd +libpcap +libsqlite3 +php7 +php7-cgi +php7-mod-gd +php7-mod-pdo +php7-mod-pdo-sqlite
54 endef
55
56 define Package/bandwidthd-php
57 $(call Package/bandwidthd/Default)
58 TITLE = PHP files to graph bandwidthd data from postgresql
59 VARIANT:=php
60 DEPENDS:=+libpcre +libxml2 +php7 +php7-cgi +php7-mod-pgsql +php7-mod-gd
61 endef
62
63 define Package/bandwidthd/description
64 A bandwidthd tracking utility.
65 endef
66
67 define Package/bandwidthd-pgsql/description
68 $(call Package/bandwidthd/description)
69 With the ability to store in a postgresql database.
70 endef
71
72 define Package/bandwidthd-sqlite/description
73 $(call Package/bandwidthd/description)
74 With the ability to store in a sqlite database.
75 endef
76
77 define Package/bandwidthd-php/description
78 PHP files to graph bandwidthd data from pgsql.
79 endef
80
81 define Package/bandwidthd/daemon
82 This package contains bandwidthd, a bandwidth tracking utility.
83 endef
84
85 define Package/bandwidthd-pgsql/daemon
86 This package contains bandwidthd, a bandwidth tracking utility.
87 endef
88
89 define Package/bandwidthd-sqlite/daemon
90 This package contains bandwidthd, a bandwidth tracking utility.
91 endef
92
93 define Package/bandwidthd-php/daemon
94 This package contains the PHP files to graph the data from a pgsql database.
95 endef
96
97 ifeq ($(BUILD_VARIANT),no-db)
98 CONFIGURE_ARGS += \
99 ac_cv_file__sw_lib=no \
100 ac_cv_file__sw_include=no \
101 ac_cv_file__usr_pkg_lib=no \
102 ac_cv_file__usr_pkg_include=no \
103 ac_cv_file__usr_local_pgsql_lib=no \
104 ac_cv_file__usr_local_pgsql_include=no \
105 ac_cv_lib_pq_PQconnectdb=no \
106 ac_cv_lib_sqlite3_sqlite3_open=no
107 endif
108
109 ifeq ($(BUILD_VARIANT),pgsql)
110 CONFIGURE_ARGS += \
111 ac_cv_file__sw_lib=no \
112 ac_cv_file__sw_include=no \
113 ac_cv_file__usr_pkg_lib=no \
114 ac_cv_file__usr_pkg_include=no \
115 ac_cv_file__usr_local_pgsql_lib=no \
116 ac_cv_file__usr_local_pgsql_include=no \
117 ac_cv_lib_sqlite3_sqlite3_open=no
118 endif
119
120 ifeq ($(BUILD_VARIANT),sqlite)
121 CONFIGURE_ARGS += \
122 ac_cv_file__sw_lib=no \
123 ac_cv_file__sw_include=no \
124 ac_cv_file__usr_pkg_lib=no \
125 ac_cv_file__usr_pkg_include=no \
126 ac_cv_file__usr_local_pgsql_lib=no \
127 ac_cv_file__usr_local_pgsql_include=no \
128 ac_cv_lib_pq_PQconnectdb=no
129 endif
130
131 ifeq ($(BUILD_VARIANT),php)
132 CONFIGURE_ARGS += \
133 ac_cv_file__sw_lib=no \
134 ac_cv_file__sw_include=no \
135 ac_cv_file__usr_pkg_lib=no \
136 ac_cv_file__usr_pkg_include=no \
137 ac_cv_file__usr_local_pgsql_lib=no \
138 ac_cv_file__usr_local_pgsql_include=no \
139 ac_cv_lib_pq_PQconnectdb=no \
140 ac_cv_lib_sqlite3_sqlite3_open=no
141 endif
142
143 EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
144 EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
145
146 define Package/bandwidthd/install
147 $(INSTALL_DIR) $(1)/usr/sbin
148 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
149 $(INSTALL_DIR) $(1)/etc/config
150 $(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd
151 $(INSTALL_DIR) $(1)/etc/init.d
152 $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
153 $(INSTALL_DIR) $(1)/www
154 $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/
155 $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif
156 endef
157
158 define Package/bandwidthd-pgsql/install
159 $(INSTALL_DIR) $(1)/usr/sbin
160 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
161 $(INSTALL_DIR) $(1)/etc/config
162 $(INSTALL_DATA) ./files/bandwidthd-pgsql.config $(1)/etc/config/bandwidthd
163 $(INSTALL_DIR) $(1)/etc/init.d
164 $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
165 $(INSTALL_DIR) $(1)/www
166 $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/
167 $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif
168 $(INSTALL_DIR) $(1)/usr/share/postgresql
169 $(INSTALL_BIN) $(PKG_BUILD_DIR)/phphtdocs/bd_pgsql_purge.sh $(1)/usr/share/postgresql
170 endef
171
172 define Package/bandwidthd-sqlite/install
173 $(INSTALL_DIR) $(1)/usr/sbin
174 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
175 $(INSTALL_DIR) $(1)/etc/config
176 $(INSTALL_DATA) ./files/bandwidthd-sqlite.config $(1)/etc/config/bandwidthd
177 $(INSTALL_DIR) $(1)/etc/init.d
178 $(INSTALL_BIN) ./files/bandwidthd-sqlite.init $(1)/etc/init.d/bandwidthd
179 $(INSTALL_DIR) $(1)/www/phphtdocs
180 $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/phphtdocs/
181 $(INSTALL_DATA) ./files/phphtdocs-sqlite/details.php $(1)/www/phphtdocs/
182 $(INSTALL_DATA) ./files/phphtdocs-sqlite/footer.php $(1)/www/phphtdocs/
183 $(INSTALL_DATA) ./files/phphtdocs-sqlite/graph.php $(1)/www/phphtdocs/
184 $(INSTALL_DATA) ./files/phphtdocs-sqlite/include.php $(1)/www/phphtdocs/
185 $(INSTALL_DATA) ./files/phphtdocs-sqlite/index.php $(1)/www/phphtdocs/
186 $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/phphtdocs/logo.gif
187 ln -s /var/etc/bandwidthd-php.conf $(1)/www/phphtdocs/config.conf.php
188 $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/
189 $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif
190 endef
191
192 define Package/bandwidthd-php/install
193 $(INSTALL_DIR) $(1)/www/phphtdocs
194 $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/phphtdocs/
195 $(INSTALL_DATA) ./files/phphtdocs/details.php $(1)/www/phphtdocs/
196 $(INSTALL_DATA) ./files/phphtdocs/footer.php $(1)/www/phphtdocs/
197 $(INSTALL_DATA) ./files/phphtdocs/graph.php $(1)/www/phphtdocs/
198 $(INSTALL_DATA) ./files/phphtdocs/include.php $(1)/www/phphtdocs/
199 $(INSTALL_DATA) ./files/phphtdocs/index.php $(1)/www/phphtdocs/
200 $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/phphtdocs/logo.gif
201 ln -s /var/etc/bandwidthd-php.conf $(1)/www/phphtdocs/config.conf
202 $(INSTALL_DIR) $(1)//etc/config
203 $(INSTALL_CONF) ./files/bandwidthd-php.config $(1)/etc/config/bandwidthd-php
204 $(INSTALL_DIR) $(1)/etc/init.d
205 $(INSTALL_BIN) ./files/bandwidthd-php.init $(1)/etc/init.d/bandwidthd-php
206 endef
207
208 define Package/bandwidthd/conffiles
209 /etc/config/bandwidthd
210 endef
211
212 define Package/bandwidthd-pgsql/conffiles
213 /etc/config/bandwidthd
214 endef
215
216 define Package/bandwidthd-sqlite/conffiles
217 /etc/config/bandwidthd
218 endef
219
220 define Package/bandwidthd-php/conffiles
221 /etc/config/bandwidthd-php
222 endef
223
224 $(eval $(call BuildPackage,bandwidthd))
225 $(eval $(call BuildPackage,bandwidthd-pgsql))
226 $(eval $(call BuildPackage,bandwidthd-sqlite))
227 $(eval $(call BuildPackage,bandwidthd-php))