You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
7.1 KiB

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