1 #! /usr/bin/make -f
2 # debian/rules for collectd
3 #
4 # Written by Sebastian Harl <sh@tokkee.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 CPPFLAGS = -I$(CURDIR)/debian/include
16 CFLAGS = -Wall -g
18 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
19 # however required by the perl plugin (which would otherwise be unable to find
20 # symbols defined in libperl when loading perl modules that require such
21 # symbols). This is a workaround for this issue.
22 CPPFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
24 # Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to
25 # /etc/collectd would be wrong though.
26 CPPFLAGS += -UCONFIGFILE
27 CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"'
29 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
30 CFLAGS += -O0
31 else
32 CFLAGS += -O2
33 endif
35 include /usr/share/dpatch/dpatch.make
37 confflags = --host=$(DEB_HOST_GNU_TYPE) \
38 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
39 --mandir=\$${prefix}/share/man \
40 --localstatedir=/var --sysconfdir=/etc \
41 --with-perl-bindings="INSTALLDIRS=vendor" \
42 --disable-onewire \
43 --disable-xmms \
44 --without-libstatgrab
46 # These plugins do not provide any functionality under Linux.
47 confflags += --disable-apple_sensors --disable-tape
49 # The static libraries netstat and upsclient cannot be linked into shared
50 # objects on some architectures (see bugs #358637 and #419684 for more
51 # details).
52 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
53 confflags += --disable-netlink --disable-nut
54 endif
56 # libvirt is only available on amd64, i386 and powerpc.
57 ifeq (,$(findstring $(DEB_BUILD_ARCH),amd64 i386 powerpc))
58 confflags += --disable-libvirt
59 endif
61 # libdbi is not available on Etch
62 confflags += --disable-dbi
64 # Force the inclusion of the ipmi plugin and manually specify its
65 # dependencies to work around #474087 (broken openipmi .pc files).
66 BUILD_WITH_OPENIPMI_LIBS = -lOpenIPMIpthread -lOpenIPMIutils -lOpenIPMI
67 confflags += --enable-ipmi
69 config.status: configure $(DPATCH_STAMPFN)
70 dh_testdir
71 BUILD_WITH_OPENIPMI_LIBS="$(BUILD_WITH_OPENIPMI_LIBS)" \
72 CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" ./configure $(confflags)
74 build: build-stamp
76 build-stamp: config.status
77 dh_testdir
79 $(MAKE)
80 perl ./debian/bin/check_plugins.pl
82 touch build-stamp
84 clean: unpatch
85 dh_testdir
86 dh_testroot
87 rm -f build-stamp
89 [ ! -f Makefile ] || $(MAKE) distclean
91 rm -f debian/README.Debian.plugins
92 rm -f src/*.1 src/*.5
94 dh_clean
95 debconf-updatepo
97 install-indep:
98 dh_testdir
99 dh_testroot
100 dh_clean -k
101 dh_installdirs -i
102 dh_install -i
104 install-arch: build
105 dh_testdir
106 dh_testroot
107 dh_clean -k
108 dh_installdirs -a
110 $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
112 rm -f debian/tmp/usr/lib/collectd/*.la
113 rm -f debian/tmp/etc/collectd.conf
115 dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
117 perl ./debian/bin/gen_plugin_deps.pl
119 mkdir -p debian/collectd/usr/share/lintian/overrides/
120 cp debian/collectd.overrides \
121 debian/collectd/usr/share/lintian/overrides/collectd
123 binary-indep: install-indep
124 dh_testdir
125 dh_testroot
126 dh_installchangelogs -i ChangeLog
127 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
128 dh_installexamples -i contrib/examples/myplugin.c \
129 contrib/examples/MyPlugin.pm
130 dh_compress -i -Xexamples/
131 dh_fixperms -i
132 dh_installdeb -i
133 dh_gencontrol -i
134 dh_md5sums -i
135 dh_builddeb -i
137 binary-arch: build install-arch
138 dh_testdir
139 dh_testroot
140 dh_installchangelogs -a ChangeLog
141 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
142 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
143 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
144 contrib/collection3/ \
145 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
146 contrib/exec-nagios.conf contrib/exec-nagios.px \
147 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
148 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
149 contrib/snmp-probe-host.px
150 dh_installdebconf -a
151 dh_installinit -a -- defaults 95
152 dh_link -a
153 dh_strip -a --dbg-package=collectd-dbg
154 dh_compress -a -Xexamples/
155 dh_fixperms -a
156 dh_makeshlibs -a
157 dh_installdeb -a
158 dpkg-shlibdeps -Tdebian/collectd.substvars \
159 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
160 debian/collectd/usr/lib/collectd/rrdtool.so \
161 -dRecommends debian/collectd/usr/lib/collectd/*.so
162 dh_shlibdeps -a -Ncollectd
163 dh_gencontrol -a
164 dh_md5sums -a
165 dh_builddeb -a
167 binary: binary-arch binary-indep
168 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch