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 CFLAGS = -Wall -g -I$(CURDIR)/debian/include
17 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
18 # however required by the perl plugin (which would otherwise be unable to find
19 # symbols defined in libperl when loading perl modules that require such
20 # symbols). This is a workaround for this issue.
21 CFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
23 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
24 CFLAGS += -O0
25 else
26 CFLAGS += -O2
27 endif
29 include /usr/share/dpatch/dpatch.make
31 confflags = --host=$(DEB_HOST_GNU_TYPE) \
32 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
33 --mandir=\$${prefix}/share/man \
34 --localstatedir=/var --sysconfdir=/etc \
35 --with-perl-bindings="INSTALLDIRS=vendor" \
36 --disable-xmms \
37 --without-libstatgrab
39 # These plugins do not provide any functionality under Linux.
40 confflags += --disable-apple_sensors --disable-tape
42 # The static libraries iptc, netstat and upsclient cannot be used on
43 # 64bit systems (see bugs #358637 and #419684 for more details).
44 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
45 confflags += --disable-iptables --disable-netlink --disable-nut
46 endif
48 # libvirt is only available on amd64, i386 and powerpc.
49 ifeq (,$(findstring $(DEB_BUILD_ARCH),amd64 i386 powerpc))
50 confflags += --disable-libvirt
51 endif
53 config.status: configure $(DPATCH_STAMPFN)
54 dh_testdir
55 CFLAGS="$(CFLAGS)" ./configure $(confflags)
57 build: build-stamp
59 build-stamp: config.status
60 dh_testdir
62 $(MAKE)
63 perl ./debian/bin/check_plugins.pl
65 touch build-stamp
67 clean: unpatch
68 dh_testdir
69 dh_testroot
70 rm -f build-stamp
72 [ ! -f Makefile ] || $(MAKE) distclean
74 rm -f debian/README.Debian.plugins
76 dh_clean
77 debconf-updatepo
79 install-indep:
80 dh_testdir
81 dh_testroot
82 dh_clean -k
83 dh_installdirs -i
85 include_dir=debian/collectd-dev/usr/include/collectd/ \
86 && mkdir -p $$include_dir/liboconfig \
87 && cp src/*.h $$include_dir \
88 && cp src/liboconfig/oconfig.h $$include_dir/liboconfig
90 install-arch: build
91 dh_testdir
92 dh_testroot
93 dh_clean -k
94 dh_installdirs -a
96 $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
98 rm -rf debian/collectd/usr/include/
99 rm -f debian/collectd/usr/lib/collectd/*.la
101 rm -f debian/collectd/etc/collectd.conf
102 install -D -m 0644 debian/collectd.conf \
103 debian/collectd/etc/collectd/collectd.conf
104 install -m 0644 debian/collection.conf \
105 debian/collectd/etc/collectd/collection.conf
106 install -m 0644 debian/thresholds.conf \
107 debian/collectd/etc/collectd/thresholds.conf
109 mkdir -p debian/collectd/usr/lib/collectd/utils/
110 for UTIL in rrd_filter.px migrate-3-4.px; do \
111 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
112 done
114 perl ./debian/bin/gen_plugin_deps.pl
116 mkdir -p debian/collectd/usr/share/lintian/overrides/
117 cp debian/collectd.overrides \
118 debian/collectd/usr/share/lintian/overrides/collectd
120 binary-indep: install-indep
121 dh_testdir
122 dh_testroot
123 dh_installchangelogs -i ChangeLog
124 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
125 dh_installexamples -i contrib/examples/myplugin.c \
126 contrib/examples/MyPlugin.pm
127 dh_compress -i -Xexamples/myplugin.c -Xexamples/MyPlugin.c
128 dh_fixperms -i
129 dh_installdeb -i
130 dh_gencontrol -i
131 dh_md5sums -i
132 dh_builddeb -i
134 binary-arch: build install-arch
135 dh_testdir
136 dh_testroot
137 dh_installchangelogs -a ChangeLog
138 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
139 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
140 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
141 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
142 contrib/exec-nagios.conf contrib/exec-nagios.px \
143 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
144 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py
145 dh_installdebconf -a
146 dh_installinit -a -- defaults 95
147 dh_link -a
148 dh_strip -a --dbg-package=collectd-dbg
149 dh_compress -a
150 dh_fixperms -a
151 dh_installdeb -a
152 dpkg-shlibdeps -Tdebian/collectd.substvars \
153 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
154 debian/collectd/usr/lib/collectd/rrdtool.so \
155 -dRecommends debian/collectd/usr/lib/collectd/*.so
156 dh_gencontrol -a
157 dh_md5sums -a
158 dh_builddeb -a
160 binary: binary-arch binary-indep
161 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch