Code

rules: Disable the cgroups plugin on non-Linux.
[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
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 # libmongoc is required for the write_mongodb plugin.
93 confflags += --disable-write_mongodb
95 # xmms1 is required for the xmms plugin.
96 confflags += --disable-xmms
98 # libkstat is required for the xfs_arc plugin.
99 confflags += --disable-zfs-arc
101 # These plugins are Linux-specific.
102 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
103         confflags += \
104                 --disable-cgroups \
105                 --disable-ethstat \
106                 --disable-iptables \
107                 --disable-ipvs \
108                 --disable-madwifi \
109                 --disable-md \
110                 --disable-netlink \
111                 --disable-numa \
112                 --disable-sensors \
113                 --disable-vserver
114 endif
116 # This plugin is FreeBSD-specific.
117 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
118         confflags += \
119                 --disable-pf
120 endif
122 # These plugins have not been ported to FreeBSD yet.
123 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
124         # Work-around an incomplete check for kvm functionality
125         CPPFLAGS  += -DHAVE_STRUCT_KINFO_PROC_FREEBSD
126         confflags += --enable-processes=force
128         confflags += \
129                 --disable-battery \
130                 --disable-conntrack \
131                 --disable-contextswitch \
132                 --disable-cpufreq \
133                 --disable-disk \
134                 --disable-entropy \
135                 --disable-fscache \
136                 --disable-irq \
137                 --disable-nfs \
138                 --disable-protocols \
139                 --disable-serial \
140                 --disable-thermal \
141                 --disable-vmem \
142                 --disable-wireless
143 endif
145 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
146 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
147         confflags += \
148                 --disable-gmond \
149                 --disable-libvirt \
150                 --disable-tokyotyrant \
151                 --disable-java
152 endif
154 # The hppa buildds currently do not keep up with Java related stuff, thus
155 # prevending testing transitions.
156 ifneq (,$(filter hppa, $(DEB_BUILD_ARCH)))
157         confflags += --disable-java
158 endif
160 config.status: configure $(DPATCH_STAMPFN)
161         dh_testdir
162         
163         ( cd debian/patches/; for patch in *; do \
164                 if test "$$patch" != "00list"; then \
165                         grep "$$patch" 00list > /dev/null \
166                                 || ( echo "$$patch not enabled\!"; exit 1 ); \
167                 fi; done )
168         
169         # This is a work-around for #474087 (broken openipmi .pc files).
170         mkdir debian/pkgconfig
171         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
172                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
173                 > debian/pkgconfig/OpenIPMIpthread.pc
174         
175         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
176         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
177                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
178                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
179                 || ( status=$$?; cat config.log; exit $$status )
181 build: build-arch build-indep
182 build-arch: build-stamp
183 build-indep: build-stamp
185 build-stamp: config.status
186         dh_testdir
187         
188         $(MAKE)
189         perl ./debian/bin/check_plugins.pl
190         
191         touch build-stamp
193 clean: unpatch
194         dh_testdir
195         dh_testroot
196         rm -f build-stamp
197         
198         [ ! -f Makefile ] || $(MAKE) distclean
199         
200         rm -f debian/README.Debian.plugins
201         rm -f src/*.1 src/*.5
202         
203         rm -rf debian/pkgconfig
204         
205         dh_clean
206         debconf-updatepo
208 install-indep:
209         dh_testdir
210         dh_testroot
211         dh_clean -k
212         dh_installdirs -i
213         dh_install -i
215 install-arch: build
216         dh_testdir
217         dh_testroot
218         dh_clean -k
219         dh_installdirs -a
220         
221         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
222         
223         rm -f debian/tmp/usr/lib/collectd/*.la
224         rm -f debian/tmp/usr/lib/libcollectdclient.la
225         rm -f debian/tmp/etc/collectd.conf
226         
227         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
228         
229         perl ./debian/bin/gen_plugin_deps.pl
230         
231         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
232         cp debian/collectd-core.overrides \
233                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
235 binary-indep: install-indep
236         dh_testdir
237         dh_testroot
238         dh_installchangelogs -i ChangeLog
239         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
240         dh_installexamples -i contrib/examples/myplugin.c \
241                 contrib/examples/MyPlugin.pm
242         dh_compress -i -Xexamples/
243         dh_fixperms -i
244         dh_installdeb -i
245         dh_gencontrol -i
246         dh_md5sums -i
247         dh_builddeb -i
249 binary-arch: build install-arch
250         dh_testdir
251         dh_testroot
252         dh_installchangelogs -a ChangeLog
253         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
254         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
255         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
256                 contrib/collection3/ contrib/php-collection/ \
257                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
258                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
259                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
260                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
261                 contrib/collectd_network.py contrib/collectd_unixsock.py \
262                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
263                 contrib/postgresql \
264                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
265         # some upstream tarballs have been built inside a dirty working dir
266         ( cd debian/collectd-core/ \
267                 && cd usr/share/doc/collectd-core/examples/collection3/ \
268                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
269                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
270                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
271                 && rm -f lib/Collectd/Graph/MetaData.pm )
272         dh_installdebconf -a
273         dh_installinit -pcollectd-core --name=collectd -- defaults 95
274         dh_link -a
275         dh_strip -a --dbg-package=collectd-dbg
276         dh_compress -a -Xexamples/
277         dh_fixperms -a
278         dh_makeshlibs -a
279         dh_installdeb -a
280         dh_shlibdeps -a -Ncollectd-core -Ncollectd
281         dpkg-shlibdeps -Tdebian/collectd.substvars \
282                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
283         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
284                 -dDepends debian/collectd-core/usr/sbin/* \
285                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
286         grep shlibs:Suggests debian/collectd-core.substvars \
287                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
288                 >> debian/collectd.substvars
289         dh_gencontrol -a
290         dh_md5sums -a
291         dh_builddeb -a
293 binary: binary-arch binary-indep
294 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch