Code

rules: Disable varnish for now; it does not work with varnish 4.
[pkg-collectd.git] / debian / rules
1 #! /usr/bin/make -f
2 # debian/rules for collectd
3 #
4 # Written by Sebastian Harl <tokkee@debian.org>.
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_ARCH      ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
13 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
15 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
17 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
18 CPPFLAGS += -I$(CURDIR)/debian/include
19 CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
20 CFLAGS += -Wall -Wno-error=deprecated-declarations
22 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
23 # however required by the perl plugin (which would otherwise be unable to find
24 # symbols defined in libperl when loading perl modules that require such
25 # symbols). This is a workaround for this issue.
26 CPPFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
28 # Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to
29 # /etc/collectd would be wrong though.
30 CPPFLAGS += -UCONFIGFILE
31 CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"'
33 LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
35 # The archdir map has been copied from openjdk-6's debian/rules.
36 JAVA_ARCHDIR = $(shell /usr/share/javahelper/java-arch.sh $(DEB_BUILD_ARCH))
37 ifeq (,$(JAVA_ARCHDIR))
38         JAVA_ARCHDIR = $(DEB_BUILD_ARCH)
39 endif
40 JAVA_HOME = /usr/lib/jvm/default-java
41 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
43 JAVAC = $(JAVA_HOME)/bin/javac
44 JAR = $(JAVA_HOME)/bin/jar
45 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
46 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
48 include /usr/share/dpatch/dpatch.make
50 confflags = --host=$(DEB_HOST_GNU_TYPE) \
51                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
52                         --mandir=\$${prefix}/share/man \
53                         --localstatedir=/var --sysconfdir=/etc \
54                         --with-perl-bindings="INSTALLDIRS=vendor" \
55                         --without-libstatgrab \
56                         --without-included-ltdl \
57                         --disable-static \
58                         --enable-all-plugins
60 # These plugins do not provide any functionality under Linux.
61 # MacOS only (requires IO Kit):
62 confflags += --disable-apple_sensors
63 # AIX only (requires perfstat):
64 confflags += --disable-lpar
65 # Solaris only (requires devinfo and kstat)
66 confflags += --disable-tape
68 # libaquaero5 is required for the aquaero plugin
69 confflags += --disable-aquaero
71 # libmic is required for the mic plugin
72 confflags += --disable-mic
74 # libnetapp is required for the netapp plugin.
75 confflags += --disable-netapp
77 # libowcapi is required for the onewire plugin.
78 confflags += --disable-onewire
80 # libclntsh is required for the oracle plugin.
81 confflags += --disable-oracle
83 # libcredis is required for the *redis plugins.
84 confflags += --disable-redis --disable-write_redis
86 # librouteros is required for the routeros plugin.
87 confflags += --disable-routeros
89 # libsigrok >= 0.2.0 is required for the sigrok plugin, should arrive in unstable soon
90 confflags += --disable-sigrok
92 # varnish does not currently work with varnish4
93 # (c.f. https://bugs.debian.org/745902)
94 confflags += --disable-varnish
96 # libmongoc is required for the write_mongodb plugin.
97 confflags += --disable-write_mongodb
99 # xmms1 is required for the xmms plugin.
100 confflags += --disable-xmms
102 # libkstat is required for the xfs_arc plugin.
103 confflags += --disable-zfs-arc
105 # These plugins are Linux-specific.
106 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
107         confflags += \
108                 --disable-cgroups \
109                 --disable-ethstat \
110                 --disable-iptables \
111                 --disable-ipvs \
112                 --disable-lvm \
113                 --disable-madwifi \
114                 --disable-md \
115                 --disable-netlink \
116                 --disable-numa \
117                 --disable-sensors \
118                 --disable-vserver
119 endif
121 # This plugin is FreeBSD-specific.
122 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
123         confflags += \
124                 --disable-pf
125 endif
127 # These plugins have not been ported to FreeBSD yet.
128 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
129         # Work-around an incomplete check for kvm functionality
130         CPPFLAGS  += -DHAVE_STRUCT_KINFO_PROC_FREEBSD
131         confflags += --enable-processes=force
133         confflags += \
134                 --disable-battery \
135                 --disable-conntrack \
136                 --disable-contextswitch \
137                 --disable-cpufreq \
138                 --disable-disk \
139                 --disable-entropy \
140                 --disable-fscache \
141                 --disable-irq \
142                 --disable-nfs \
143                 --disable-protocols \
144                 --disable-serial \
145                 --disable-thermal \
146                 --disable-vmem \
147                 --disable-wireless
148 endif
150 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
151 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
152         confflags += \
153                 --disable-gmond \
154                 --disable-libvirt \
155                 --disable-tokyotyrant \
156                 --disable-java
157 endif
159 # The hppa buildds currently do not keep up with Java related stuff, thus
160 # prevending testing transitions.
161 ifneq (,$(filter hppa, $(DEB_BUILD_ARCH)))
162         confflags += --disable-java
163 endif
165 config.status: configure $(DPATCH_STAMPFN)
166         dh_testdir
167         
168         ( cd debian/patches/; for patch in *; do \
169                 if test "$$patch" != "00list"; then \
170                         grep "$$patch" 00list > /dev/null \
171                                 || ( echo "$$patch not enabled\!"; exit 1 ); \
172                 fi; done )
173         
174         # This is a work-around for #474087 (broken openipmi .pc files).
175         mkdir debian/pkgconfig
176         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
177                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
178                 > debian/pkgconfig/OpenIPMIpthread.pc
179         
180         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
181         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
182                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
183                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
184                 || ( status=$$?; cat config.log; exit $$status )
186 build: build-arch build-indep
187 build-arch: build-stamp
188 build-indep: build-stamp
190 build-stamp: config.status
191         dh_testdir
192         
193         $(MAKE)
194         perl ./debian/bin/check_plugins.pl
195         
196         touch build-stamp
198 clean: unpatch
199         dh_testdir
200         dh_testroot
201         rm -f build-stamp
202         
203         [ ! -f Makefile ] || $(MAKE) distclean
204         
205         rm -f debian/README.Debian.plugins
206         rm -f src/*.1 src/*.5
207         
208         rm -rf debian/pkgconfig
209         
210         dh_clean
211         debconf-updatepo
213 install-indep:
214         dh_testdir
215         dh_testroot
216         dh_clean -k
217         dh_installdirs -i
218         dh_install -i
220 install-arch: build
221         dh_testdir
222         dh_testroot
223         dh_clean -k
224         dh_installdirs -a
225         
226         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
227         
228         rm -f debian/tmp/usr/lib/collectd/*.la
229         rm -f debian/tmp/usr/lib/libcollectdclient.la
230         rm -f debian/tmp/etc/collectd.conf
231         
232         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
233         
234         perl ./debian/bin/gen_plugin_deps.pl
235         
236         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
237         cp debian/collectd-core.overrides \
238                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
240 binary-indep: install-indep
241         dh_testdir
242         dh_testroot
243         dh_installchangelogs -i ChangeLog
244         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
245         dh_installexamples -i contrib/examples/myplugin.c \
246                 contrib/examples/MyPlugin.pm
247         dh_compress -i -Xexamples/
248         dh_fixperms -i
249         dh_installdeb -i
250         dh_gencontrol -i
251         dh_md5sums -i
252         dh_builddeb -i
254 binary-arch: build install-arch
255         dh_testdir
256         dh_testroot
257         dh_installchangelogs -a ChangeLog
258         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
259         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
260         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
261                 contrib/collection3/ contrib/php-collection/ \
262                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
263                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
264                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
265                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
266                 contrib/collectd_network.py contrib/collectd_unixsock.py \
267                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
268                 contrib/postgresql \
269                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
270         # some upstream tarballs have been built inside a dirty working dir
271         ( cd debian/collectd-core/ \
272                 && cd usr/share/doc/collectd-core/examples/collection3/ \
273                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
274                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
275                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
276                 && rm -f lib/Collectd/Graph/MetaData.pm )
277         dh_installdebconf -a
278         dh_installinit -pcollectd-core --name=collectd -- defaults 95
279         dh_link -a
280         dh_strip -a --dbg-package=collectd-dbg
281         dh_compress -a -Xexamples/
282         dh_fixperms -a
283         dh_makeshlibs -a
284         dh_installdeb -a
285         dh_shlibdeps -a -Ncollectd-core -Ncollectd
286         dpkg-shlibdeps -Tdebian/collectd.substvars \
287                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
288         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
289                 -dDepends debian/collectd-core/usr/sbin/* \
290                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
291         grep shlibs:Suggests debian/collectd-core.substvars \
292                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
293                 >> debian/collectd.substvars
294         dh_gencontrol -a
295         dh_md5sums -a
296         dh_builddeb -a
298 binary: binary-arch binary-indep
299 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch