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