Add pmacct package
[openwrt.git] / package / pmacct / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=pmacct
6 PKG_VERSION:=0.8.5
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=996d6402946553f81d94e0a60e6fc509
9
10 PKG_SOURCE_URL:=http://www.ba.cnr.it/~paolo/pmacct/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 include $(TOPDIR)/package/rules.mk
18
19 PMACCT_BASIC_CONFIGURE_OPTS := \
20
21 PMACCT_MYSQL_CONFIGURE_OPTS := \
22 --enable-mysql \
23 --with-mysql-includes="$(STAGING_DIR)/usr/include" \
24 --with-mysql-libs="$(STAGING_DIR)/usr/lib/mysql"
25
26 PMACCT_PGSQL_CONFIGURE_OPTS := \
27 --enable-pgsql \
28 --with-pgsql-includes="$(STAGING_DIR)/usr/include" \
29 --with-pgsql-libs="$(STAGING_DIR)/usr/lib"
30
31 NFACCTD_CUSTOM_CONFIGURE_OPTS := \
32
33 ifeq ($(BR2_PACKAGE_NFACCTD_ENABLE_DEBUG),y)
34 NFACCTD_CUSTOM_CONFIGURE_OPTS += --enable-debug
35 endif
36
37 ifeq ($(BR2_PACKAGE_NFACCTD_ENABLE_IPV6),y)
38 NFACCTD_CUSTOM_CONFIGURE_OPTS += --enable-ipv6
39 endif
40
41 ifeq ($(BR2_PACKAGE_NFACCTD_WITH_MYSQL),y)
42 NFACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_MYSQL_CONFIGURE_OPTS)
43 endif
44
45 ifeq ($(BR2_PACKAGE_NFACCTD_WITH_PGSQL),y)
46 NFACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_PGSQL_CONFIGURE_OPTS)
47 endif
48
49 PMACCTD_CUSTOM_CONFIGURE_OPTS := \
50
51 ifeq ($(BR2_PACKAGE_PMACCTD_ENABLE_DEBUG),y)
52 PMACCTD_CUSTOM_CONFIGURE_OPTS += --enable-debug
53 endif
54
55 ifeq ($(BR2_PACKAGE_PMACCTD_ENABLE_IPV6),y)
56 PMACCTD_CUSTOM_CONFIGURE_OPTS += --enable-ipv6
57 endif
58
59 ifeq ($(BR2_PACKAGE_PMACCTD_WITH_MYSQL),y)
60 PMACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_MYSQL_CONFIGURE_OPTS)
61 endif
62
63 ifeq ($(BR2_PACKAGE_PMACCTD_WITH_PGSQL),y)
64 PMACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_PGSQL_CONFIGURE_OPTS)
65 endif
66
67 define PKG_build
68
69 ifneq ($(BR2_PACKAGE_$(1)),)
70 BUILD_TARGETS += $(PKG_BUILD_DIR)/$(2)
71 BUILD_TARGETS += $(PKG_BUILD_DIR)/$(3)
72 endif
73
74 $(PKG_BUILD_DIR)/$(2) $(PKG_BUILD_DIR)/$(3): $(PKG_BUILD_DIR)/.prepared
75 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
76 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
77 $(TARGET_CONFIGURE_OPTS) \
78 CFLAGS="$(TARGET_CFLAGS)" \
79 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
80 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
81 ./configure \
82 --target=$(GNU_TARGET_NAME) \
83 --host=$(GNU_TARGET_NAME) \
84 --build=$(GNU_HOST_NAME) \
85 --program-prefix="" \
86 --program-suffix="" \
87 --prefix=/usr \
88 --exec-prefix=/usr \
89 --bindir=/usr/sbin \
90 --datadir=/usr/share \
91 --includedir=/usr/include \
92 --infodir=/usr/share/info \
93 --libdir=/usr/lib \
94 --libexecdir=/usr/lib/locate \
95 --localstatedir=/var/lib \
96 --mandir=/usr/share/man \
97 --sbindir=/usr/sbin \
98 --sysconfdir=/etc \
99 $(DISABLE_LARGEFILE) \
100 $(DISABLE_NLS) \
101 --enable-shared \
102 --disable-static \
103 --with-pcap-includes="$(STAGING_DIR)/usr/include" \
104 --with-libpcap-libs="$(STAGING_DIR)/usr/lib" \
105 $$($(1)_CONFIGURE_OPTS) \
106 );
107 $(MAKE) -C $(PKG_BUILD_DIR) \
108 $(TARGET_CONFIGURE_OPTS) \
109 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include"
110 mv -f $(PKG_BUILD_DIR)/nfacctd $(PKG_BUILD_DIR)/$(2)
111 mv -f $(PKG_BUILD_DIR)/pmacctd $(PKG_BUILD_DIR)/$(3)
112
113 endef
114
115 define PKG_package
116
117 $$(IPKG_$(1)): $(PKG_BUILD_DIR)/$(2)
118 install -d -m0755 $$(IDIR_$(1))/etc
119 install -m0644 ./files/$(3).conf $$(IDIR_$(1))/etc/
120 install -d -m0755 $$(IDIR_$(1))/etc/default
121 install -m0644 ./files/$(3).default $$(IDIR_$(1))/etc/default/$(3)
122 install -d -m0755 $$(IDIR_$(1))/etc/init.d
123 install -m0755 ./files/$(3).init $$(IDIR_$(1))/etc/init.d/$(3)
124 install -d -m0755 $$(IDIR_$(1))/usr/sbin
125 install -m0755 $(PKG_BUILD_DIR)/$(2) $$(IDIR_$(1))/usr/sbin/$(3)
126 $(RSTRIP) $$(IDIR_$(1))
127 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
128
129 endef
130
131 $(eval $(call PKG_template,NFACCTD_BASIC,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
132 $(eval $(call PKG_template,NFACCTD_MYSQL,nfacctd-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
133 $(eval $(call PKG_template,NFACCTD_PGSQL,nfacctd-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
134 $(eval $(call PKG_template,NFACCTD_CUSTOM,nfacctd-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
135 $(eval $(call PKG_template,PMACCTD_BASIC,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
136 $(eval $(call PKG_template,PMACCTD_MYSQL,pmacctd-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
137 $(eval $(call PKG_template,PMACCTD_PGSQL,pmacctd-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
138 $(eval $(call PKG_template,PMACCTD_CUSTOM,pmacctd-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
139 $(eval $(call PKG_template,PMACCT_CLIENT,pmacct-client,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
140
141 $(eval $(call PKG_build,PMACCT_BASIC,nfacctd-basic,pmacctd-basic,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
142 $(eval $(call PKG_build,PMACCT_MYSQL,nfacctd-mysql,pmacctd-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
143 $(eval $(call PKG_build,PMACCT_PGSQL,nfacctd-pgsql,pmacctd-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
144 $(eval $(call PKG_build,NFACCTD_CUSTOM,nfacctd-custom,pmacctd-dummy,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
145 $(eval $(call PKG_build,PMACCTD_CUSTOM,nfacctd-dummy,pmacctd-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
146
147 $(eval $(call PKG_package,NFACCTD_BASIC,nfacctd-basic,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
148 $(eval $(call PKG_package,NFACCTD_MYSQL,nfacctd-mysql,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
149 $(eval $(call PKG_package,NFACCTD_PGSQL,nfacctd-pgsql,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
150 $(eval $(call PKG_package,NFACCTD_CUSTOM,nfacctd-custom,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
151 $(eval $(call PKG_package,PMACCTD_BASIC,pmacctd-basic,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
152 $(eval $(call PKG_package,PMACCTD_MYSQL,pmacctd-mysql,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
153 $(eval $(call PKG_package,PMACCTD_PGSQL,pmacctd-pgsql,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
154 $(eval $(call PKG_package,PMACCTD_CUSTOM,pmacctd-custom,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
155
156 $(PKG_BUILD_DIR)/.configured:
157 touch $(PKG_BUILD_DIR)/.configured
158
159 $(PKG_BUILD_DIR)/.built: $(BUILD_TARGETS)
160 touch $(PKG_BUILD_DIR)/.built
161
162 $(IPKG_PMACCT_CLIENT):
163 install -d -m0755 $(IDIR_PMACCT_CLIENT)/usr/sbin
164 cp -fpR $(PKG_BUILD_DIR)/pmacct $(IDIR_PMACCT_CLIENT)/usr/sbin/
165 $(RSTRIP) $(IDIR_PMACCT_CLIENT)
166 $(IPKG_BUILD) $(IDIR_PMACCT_CLIENT) $(PACKAGE_DIR)
This page took 0.063624 seconds and 5 git commands to generate.