First Commit
[librecmc/package-feed.git] / utils / bandwidthd / Makefile
1 #
2 # Copyright (C) 2006-2015 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
12 PKG_RELEASE:=5
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
15 PKG_SOURCE_URL:=@SF/bandwidthd
16 PKG_MD5SUM:=aa79aad7bd489fd2cae1f7dc086ca8b6
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 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 postgresql)
36   VARIANT:=no-pgsql
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/description
48   A bandwidthd tracking utility.
49 endef
50
51 define Package/bandwidthd-pgsql/description
52 $(call Package/bandwidthd/description)
53 With the ability to store in a postgresql database.
54 endef
55
56 define Package/bandwidthd/daemon
57  This package contains bandwidthd a bandwidth tracking utility.
58 endef
59
60 define Package/bandwidthd-pgsql/daemon
61  This package contains bandwidthd a bandwidth tracking utility.
62 endef
63
64 ifeq ($(BUILD_VARIANT),no-pgsql)
65 CONFIGURE_ARGS += \
66         ac_cv_file__sw_lib=no \
67         ac_cv_file__sw_include=no \
68         ac_cv_file__usr_pkg_lib=no \
69         ac_cv_file__usr_pkg_include=no \
70         ac_cv_file__usr_local_pgsql_lib=no \
71         ac_cv_file__usr_local_pgsql_include=no \
72         ac_cv_lib_pq_PQconnectdb=no 
73 endif
74
75 ifeq ($(BUILD_VARIANT),pgsql)
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 endif
84
85 EXTRA_CFLAGS+= $(TARGET_CPPFLAGS) -std=gnu89
86 EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib
87
88 define Package/bandwidthd/install
89         $(INSTALL_DIR) $(1)/usr/sbin
90         $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
91         $(INSTALL_DIR) $(1)/etc/config
92         $(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd
93         $(INSTALL_DIR) $(1)/etc/init.d
94         $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd
95         $(INSTALL_DIR) $(1)/www
96         $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
97         $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/logo.gif $(1)/www/
98 endef
99
100 define Package/bandwidthd-pgsql/install
101         $(INSTALL_DIR) $(1)/usr/sbin
102         $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/
103         $(INSTALL_DIR) $(1)/etc/config
104         $(INSTALL_DATA) ./files/bandwidthd-pgsql.config $(1)/etc/config/bandwidthd
105         $(INSTALL_DIR) $(1)/etc/init.d
106         $(INSTALL_BIN) ./files/bandwidthd-pgsql.init $(1)/etc/init.d/bandwidthd
107         $(INSTALL_DIR) $(1)/www/phphtdocs
108         $(INSTALL_DATA) $(PKG_BUILD_DIR)/htdocs/legend.gif $(1)/www/
109         $(INSTALL_DATA) ./files/logo.gif $(1)/www/
110         $(INSTALL_DIR) $(1)/usr/share/postgresql
111         $(INSTALL_DATA) $(PKG_BUILD_DIR)/schema.postgresql $(1)/usr/share/postgresql
112         $(INSTALL_BIN) $(PKG_BUILD_DIR)/phphtdocs/bd_pgsql_purge.sh $(1)/usr/share/postgresql
113 endef
114
115 define Package/bandwidthd/conffiles
116 /etc/config/bandwidthd
117 endef
118
119 define Package/bandwidthd-pgsql/conffiles
120 /etc/config/bandwidthd
121 endef
122
123 $(eval $(call BuildPackage,bandwidthd))
124 $(eval $(call BuildPackage,bandwidthd-pgsql))