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
17 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
18 CFLAGS += -O0
19 else
20 CFLAGS += -O2
21 endif
23 include /usr/share/dpatch/dpatch.make
25 confflags = --host=$(DEB_HOST_GNU_TYPE) \
26 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
27 --mandir=\$${prefix}/share/man \
28 --localstatedir=/var --sysconfdir=/etc \
29 --enable-debug
31 # These plugins do not provide any functionality under Linux.
32 confflags += --disable-apple_sensors --disable-tape
34 # The static libraries iptc and upsclient cannot be used on 64bit systems
35 # (see bugs #358637 and #419684 for more details).
36 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
37 confflags += --disable-iptables --disable-nut
38 endif
40 config.status: configure $(DPATCH_STAMPFN)
41 dh_testdir
42 CFLAGS="$(CFLAGS)" ./configure $(confflags)
44 build: build-stamp
46 build-stamp: config.status
47 dh_testdir
49 $(MAKE)
50 perl ./debian/bin/check_plugins.pl
52 touch build-stamp
54 clean: unpatch
55 dh_testdir
56 dh_testroot
57 rm -f build-stamp
59 [ ! -f Makefile ] || $(MAKE) distclean
61 rm -f debian/README.Debian.plugins
63 dh_clean
64 debconf-updatepo
66 install-indep:
67 dh_testdir
68 dh_testroot
69 dh_clean -k
70 dh_installdirs -i
72 include_dir=debian/collectd-dev/usr/include/collectd/ \
73 && mkdir -p $$include_dir \
74 && cp src/*.h $$include_dir
76 install-arch: build
77 dh_testdir
78 dh_testroot
79 dh_clean -k
80 dh_installdirs -a
82 $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
84 rm -f debian/collectd/usr/lib/collectd/*.la
86 rm -f debian/collectd/etc/collectd.conf
87 install -D -m 0644 debian/collectd.conf \
88 debian/collectd/etc/collectd/collectd.conf
89 install -m 0644 debian/collection.conf \
90 debian/collectd/etc/collectd/collection.conf
92 mkdir -p debian/collectd/usr/lib/collectd/utils/
93 for UTIL in extractDS.px migrate-3-4.px; do \
94 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
95 done
97 perl ./debian/bin/gen_plugin_deps.pl
99 binary-indep: install-indep
100 dh_testdir
101 dh_testroot
102 dh_installchangelogs -i ChangeLog
103 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
104 dh_installexamples -i debian/examples/myplugin.c \
105 debian/examples/MyPlugin.pm
106 dh_compress -i -Xexamples/myplugin.c -Xexamples/MyPlugin.c
107 dh_fixperms -i
108 dh_installdeb -i
109 dh_gencontrol -i
110 dh_md5sums -i
111 dh_builddeb -i
113 binary-arch: build install-arch
114 dh_testdir
115 dh_testroot
116 dh_installchangelogs -a ChangeLog
117 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
118 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
119 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
120 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/ \
121 contrib/cussh.pl
122 dh_installdebconf -a
123 dh_installinit -a -- defaults 95
124 dh_installman -a src/collectd.1 src/collectd.conf.5
125 dh_link -a
126 dh_strip -a --dbg-package=collectd-dbg
127 dh_compress -a
128 dh_fixperms -a
129 dh_installdeb -a
130 dpkg-shlibdeps -Tdebian/collectd.substvars \
131 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
132 -dRecommends debian/collectd/usr/lib/collectd/*.so
133 dh_gencontrol -a
134 dh_md5sums -a
135 dh_builddeb -a
137 binary: binary-arch binary-indep
138 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch