clean up the openswan patch to work with older patch versions as well
[openwrt.git] / package / pmacct / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=pmacct
6 PKG_VERSION:=0.10.0
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=ed510e7ee2130d1f37f27901b89e985a
9
10 PKG_SOURCE_URL:=http://www.ba.cnr.it/~paolo/pmacct/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)rc2.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 PMACCT_SQLITE_CONFIGURE_OPTS := \
32 --enable-sqlite3 \
33 --with-sqlite3-includes="$(STAGING_DIR)/usr/include" \
34 --with-sqlite3-libs="$(STAGING_DIR)/usr/lib"
35
36 NFACCTD_CUSTOM_CONFIGURE_OPTS := \
37
38 ifeq ($(BR2_PACKAGE_NFACCTD_ENABLE_DEBUG),y)
39 NFACCTD_CUSTOM_CONFIGURE_OPTS += --enable-debug
40 endif
41
42 ifeq ($(BR2_PACKAGE_NFACCTD_ENABLE_IPV6),y)
43 NFACCTD_CUSTOM_CONFIGURE_OPTS += --enable-ipv6
44 endif
45
46 ifeq ($(BR2_PACKAGE_NFACCTD_WITH_MYSQL),y)
47 NFACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_MYSQL_CONFIGURE_OPTS)
48 endif
49
50 ifeq ($(BR2_PACKAGE_NFACCTD_WITH_PGSQL),y)
51 NFACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_PGSQL_CONFIGURE_OPTS)
52 endif
53
54 ifeq ($(BR2_PACKAGE_NFACCTD_WITH_SQLITE),y)
55 NFACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_SQLITE_CONFIGURE_OPTS)
56 endif
57
58 PMACCTD_CUSTOM_CONFIGURE_OPTS := \
59
60 ifeq ($(BR2_PACKAGE_PMACCTD_ENABLE_DEBUG),y)
61 PMACCTD_CUSTOM_CONFIGURE_OPTS += --enable-debug
62 endif
63
64 ifeq ($(BR2_PACKAGE_PMACCTD_ENABLE_IPV6),y)
65 PMACCTD_CUSTOM_CONFIGURE_OPTS += --enable-ipv6
66 endif
67
68 ifeq ($(BR2_PACKAGE_PMACCTD_WITH_MYSQL),y)
69 PMACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_MYSQL_CONFIGURE_OPTS)
70 endif
71
72 ifeq ($(BR2_PACKAGE_PMACCTD_WITH_PGSQL),y)
73 PMACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_PGSQL_CONFIGURE_OPTS)
74 endif
75
76 ifeq ($(BR2_PACKAGE_PMACCTD_WITH_SQLITE),y)
77 PMACCTD_CUSTOM_CONFIGURE_OPTS += $(PMACCT_SQLITE_CONFIGURE_OPTS)
78 endif
79
80 define PKG_build
81
82 ifneq ($(BR2_PACKAGE_$(1)),)
83 BUILD_TARGETS += $(PKG_BUILD_DIR)/$(2)
84 BUILD_TARGETS += $(PKG_BUILD_DIR)/$(3)
85 endif
86
87 $(PKG_BUILD_DIR)/$(2) $(PKG_BUILD_DIR)/$(3): $(PKG_BUILD_DIR)/.prepared
88 -$(MAKE) -C $(PKG_BUILD_DIR) distclean
89 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status} ; \
90 $(TARGET_CONFIGURE_OPTS) \
91 CFLAGS="$(TARGET_CFLAGS)" \
92 CPPFLAGS="-I$(STAGING_DIR)/usr/include" \
93 LDFLAGS="-L$(STAGING_DIR)/usr/lib" \
94 ./configure \
95 --target=$(GNU_TARGET_NAME) \
96 --host=$(GNU_TARGET_NAME) \
97 --build=$(GNU_HOST_NAME) \
98 --program-prefix="" \
99 --program-suffix="" \
100 --prefix=/usr \
101 --exec-prefix=/usr \
102 --bindir=/usr/sbin \
103 --datadir=/usr/share \
104 --includedir=/usr/include \
105 --infodir=/usr/share/info \
106 --libdir=/usr/lib \
107 --libexecdir=/usr/lib/locate \
108 --localstatedir=/var/lib \
109 --mandir=/usr/share/man \
110 --sbindir=/usr/sbin \
111 --sysconfdir=/etc \
112 $(DISABLE_LARGEFILE) \
113 $(DISABLE_NLS) \
114 --enable-shared \
115 --disable-static \
116 --with-pcap-includes="$(STAGING_DIR)/usr/include" \
117 --with-pcap-libs="$(STAGING_DIR)/usr/lib" \
118 $$($(1)_CONFIGURE_OPTS) \
119 );
120 $(MAKE) -C $(PKG_BUILD_DIR) \
121 $(TARGET_CONFIGURE_OPTS) \
122 CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include"
123 mv -f $(PKG_BUILD_DIR)/nfacctd $(PKG_BUILD_DIR)/$(2)
124 mv -f $(PKG_BUILD_DIR)/pmacctd $(PKG_BUILD_DIR)/$(3)
125
126 endef
127
128 define PKG_package
129
130 $$(IPKG_$(1)): $(PKG_BUILD_DIR)/$(2)
131 install -d -m0755 $$(IDIR_$(1))/etc
132 install -m0644 ./files/$(3).conf $$(IDIR_$(1))/etc/
133 install -d -m0755 $$(IDIR_$(1))/etc/default
134 install -m0644 ./files/$(3).default $$(IDIR_$(1))/etc/default/$(3)
135 install -d -m0755 $$(IDIR_$(1))/etc/init.d
136 install -m0755 ./files/$(3).init $$(IDIR_$(1))/etc/init.d/$(3)
137 install -d -m0755 $$(IDIR_$(1))/usr/sbin
138 install -m0755 $(PKG_BUILD_DIR)/$(2) $$(IDIR_$(1))/usr/sbin/$(3)
139 $(RSTRIP) $$(IDIR_$(1))
140 $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
141
142 endef
143
144 $(eval $(call PKG_template,NFACCTD_BASIC,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
145 $(eval $(call PKG_template,NFACCTD_MYSQL,nfacctd-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
146 $(eval $(call PKG_template,NFACCTD_PGSQL,nfacctd-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
147 $(eval $(call PKG_template,NFACCTD_SQLITE,nfacctd-sqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
148 $(eval $(call PKG_template,NFACCTD_CUSTOM,nfacctd-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
149 $(eval $(call PKG_template,PMACCTD_BASIC,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
150 $(eval $(call PKG_template,PMACCTD_MYSQL,pmacctd-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
151 $(eval $(call PKG_template,PMACCTD_PGSQL,pmacctd-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
152 $(eval $(call PKG_template,PMACCTD_SQLITE,pmacctd-sqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
153 $(eval $(call PKG_template,PMACCTD_CUSTOM,pmacctd-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
154 $(eval $(call PKG_template,PMACCT_CLIENT,pmacct-client,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
155
156 $(eval $(call PKG_build,PMACCT_BASIC,nfacctd-basic,pmacctd-basic,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
157 $(eval $(call PKG_build,PMACCT_MYSQL,nfacctd-mysql,pmacctd-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
158 $(eval $(call PKG_build,PMACCT_PGSQL,nfacctd-pgsql,pmacctd-pgsql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
159 $(eval $(call PKG_build,PMACCT_SQLITE,nfacctd-sqlite,pmacctd-sqlite,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
160 $(eval $(call PKG_build,NFACCTD_CUSTOM,nfacctd-custom,pmacctd-dummy,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
161 $(eval $(call PKG_build,PMACCTD_CUSTOM,nfacctd-dummy,pmacctd-custom,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
162
163 $(eval $(call PKG_package,NFACCTD_BASIC,nfacctd-basic,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
164 $(eval $(call PKG_package,NFACCTD_MYSQL,nfacctd-mysql,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
165 $(eval $(call PKG_package,NFACCTD_PGSQL,nfacctd-pgsql,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
166 $(eval $(call PKG_package,NFACCTD_SQLITE,nfacctd-sqlite,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
167 $(eval $(call PKG_package,NFACCTD_CUSTOM,nfacctd-custom,nfacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
168 $(eval $(call PKG_package,PMACCTD_BASIC,pmacctd-basic,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
169 $(eval $(call PKG_package,PMACCTD_MYSQL,pmacctd-mysql,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
170 $(eval $(call PKG_package,PMACCTD_PGSQL,pmacctd-pgsql,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
171 $(eval $(call PKG_package,PMACCTD_SQLITE,pmacctd-sqlite,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
172 $(eval $(call PKG_package,PMACCTD_CUSTOM,pmacctd-custom,pmacctd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
173
174 $(PKG_BUILD_DIR)/.configured:
175 touch $@
176
177 $(PKG_BUILD_DIR)/.built: $(BUILD_TARGETS)
178 touch $@
179
180 $(IPKG_PMACCT_CLIENT):
181 install -d -m0755 $(IDIR_PMACCT_CLIENT)/usr/sbin
182 $(CP) $(PKG_BUILD_DIR)/pmacct $(IDIR_PMACCT_CLIENT)/usr/sbin/
183 $(RSTRIP) $(IDIR_PMACCT_CLIENT)
184 $(IPKG_BUILD) $(IDIR_PMACCT_CLIENT) $(PACKAGE_DIR)
This page took 0.050131 seconds and 5 git commands to generate.