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, netstat and upsclient cannot be used on
35 # 64bit systems (see bugs #358637 and #419684 for more details).
36 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
37 confflags += --disable-iptables --disable-netlink --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 mkdir -p debian/collectd/usr/share/lintian/overrides/
100 cp debian/collectd.overrides \
101 debian/collectd/usr/share/lintian/overrides/collectd
103 binary-indep: install-indep
104 dh_testdir
105 dh_testroot
106 dh_installchangelogs -i ChangeLog
107 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
108 dh_installexamples -i contrib/examples/myplugin.c \
109 contrib/examples/MyPlugin.pm
110 dh_compress -i -Xexamples/myplugin.c -Xexamples/MyPlugin.c
111 dh_fixperms -i
112 dh_installdeb -i
113 dh_gencontrol -i
114 dh_md5sums -i
115 dh_builddeb -i
117 binary-arch: build install-arch
118 dh_testdir
119 dh_testroot
120 dh_installchangelogs -a ChangeLog
121 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
122 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
123 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
124 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/ \
125 contrib/cussh.pl
126 dh_installdebconf -a
127 dh_installinit -a -- defaults 95
128 dh_installman -a src/collectd.1 src/collectd.conf.5
129 dh_link -a
130 dh_strip -a --dbg-package=collectd-dbg
131 dh_compress -a
132 dh_fixperms -a
133 dh_installdeb -a
134 dpkg-shlibdeps -Tdebian/collectd.substvars \
135 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
136 -dRecommends debian/collectd/usr/lib/collectd/*.so
137 dh_gencontrol -a
138 dh_md5sums -a
139 dh_builddeb -a
141 binary: binary-arch binary-indep
142 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch