summaryrefslogtreecommitdiffstats
path: root/utils/bandwidthd/Makefile
blob: ad5fde4daa0de144730893ad13dc57d6aa80cce9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#
# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=bandwidthd
PKG_VERSION:=2.0.1
PKG_RELEASE:=5

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/bandwidthd
PKG_MD5SUM:=aa79aad7bd489fd2cae1f7dc086ca8b6

PKG_MAINTAINER:=Jean-Michel Lacroix <lacroix@lepine-lacroix.info>

PKG_LICENSE:=GPL-2.0

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/bandwidthd/Default
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=Bandwidthd
  URL:=http://bandwidthd.sourceforge.net/
endef

define Package/bandwidthd
$(call Package/bandwidthd/Default)
  TITLE += (without postgresql)
  VARIANT:=no-pgsql
  DEPENDS:=+libgd +libpcap
endef

define Package/bandwidthd-pgsql
$(call Package/bandwidthd/Default)
  TITLE += (with postgresql enabled)
  VARIANT:=pgsql
  DEPENDS:=+libgd +libpcap +libpq
endef

define Package/bandwidthd/description
  A bandwidthd tracking utility.
endef

define Package/bandwidthd-pgsql/description
$(call Package/bandwidthd/description)
With the ability to store in a postgresql database.
endef

define Package/bandwidthd/daemon
 This package contains bandwidthd a bandwith tracking utility.
endef

define Package/bandwidthd-pgsql/daemon
 This package contains bandwidthd a bandwith tracking utility.
endef

ifeq ($(BUILD_VARIANT),no-pgsql)
CONFIGURE_ARGS += \
	ac_cv_file__sw_lib=no \
	ac_cv_file__sw_include=no \
	ac_cv_file__usr_pkg_lib=no \
	ac_cv_file__usr_pkg_include=no \
	ac_cv_file__usr_local_pgsql_lib=no \
	ac_cv_file__usr_local_pgsql_include=no \
	ac_cv_lib_pq_PQconnectdb=no 
endif

ifeq ($(BUILD_VARIANT),pgsql)
CONFIGURE_ARGS += \
        ac_cv_file__sw_lib=no \
        ac_cv_file__sw_include=no \
        ac_cv_file__usr_pkg_lib=no \
        ac_cv_file__usr_pkg_include=no \
        ac_cv_file__usr_local_pgsql_lib=no \
        ac_cv_file__usr_local_pgsql_include=no
endif

EXTRA_CFLAGS+= $(TARGET_CPPFLAGS) -std=gnu89
EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib

define Package/bandwidthd/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
	$(INSTALL_DIR) $(1)/www
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/logo.gif $(1)/www/
endef

define Package/bandwidthd-pgsql/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_DATA) ./files/bandwidthd-pgsql.config $(1)/etc/config/bandwidthd
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/bandwidthd-pgsql.init $(1)/etc/init.d/bandwidthd
	$(INSTALL_DIR) $(1)/www/phphtdocs
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
	$(INSTALL_DATA) ./files/logo.gif $(1)/www/
	$(INSTALL_DIR) $(1)/usr/share/postgresql
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/schema.postgresql $(1)/usr/share/postgresql
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/phphtdocs/bd_pgsql_purge.sh $(1)/usr/share/postgresql
endef

define Package/bandwidthd/conffiles
/etc/config/bandwidthd
endef

define Package/bandwidthd-pgsql/conffiles
/etc/config/bandwidthd
endef

$(eval $(call BuildPackage,bandwidthd))
$(eval $(call BuildPackage,bandwidthd-pgsql))