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