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 # The static libraries iptc and upsclient cannot be used on 64bit systems
32 # (see bugs #358637 and #419684 for more details).
33 ifneq (,$(findstring $(DEB_BUILD_ARCH),amd64 ia64 ppc64))
34 confflags += --disable-iptables --disable-nut
35 endif
37 config.status: configure $(DPATCH_STAMPFN)
38 dh_testdir
39 CFLAGS="$(CFLAGS)" ./configure $(confflags)
41 build: build-stamp
43 build-stamp: config.status
44 dh_testdir
46 $(MAKE)
48 touch build-stamp
50 clean: unpatch
51 dh_testdir
52 dh_testroot
53 rm -f build-stamp
55 -$(MAKE) distclean
57 dh_clean
59 install-indep:
60 dh_testdir
61 dh_testroot
62 dh_clean -k
63 dh_installdirs -i
65 include_dir=$(CURDIR)/debian/collectd-dev/usr/include/collectd/ \
66 && mkdir -p $$include_dir \
67 && cp src/*.h $$include_dir
69 install-arch: build
70 dh_testdir
71 dh_testroot
72 dh_clean -k
73 dh_installdirs -a
75 $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
77 rm -f $(CURDIR)/debian/collectd/usr/lib/collectd/*.la
79 rm -f $(CURDIR)/debian/collectd/etc/collectd.conf
80 install -D -m 0644 $(CURDIR)/debian/collectd.conf \
81 $(CURDIR)/debian/collectd/etc/collectd/collectd.conf
83 for PLUGIN in apache dns mysql perl ping sensors; do \
84 plugin_dir=$(CURDIR)/debian/collectd-$$PLUGIN/usr/lib/collectd/; \
85 mkdir -p $$plugin_dir; \
86 mv $(CURDIR)/debian/collectd/usr/lib/collectd/$$PLUGIN.so \
87 $$plugin_dir; \
88 done
90 mkdir -p debian/collectd/usr/lib/collectd/utils/
91 for UTIL in extractDS.px migrate-3-4.px; do \
92 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
93 done
95 binary-indep: install-indep
96 dh_testdir
97 dh_testroot
98 dh_installchangelogs -i ChangeLog
99 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
100 dh_installexamples -i debian/examples/myplugin.c
101 dh_compress -i
102 dh_fixperms -i
103 dh_installdeb -i
104 dh_gencontrol -i
105 dh_md5sums -i
106 dh_builddeb -i
108 binary-arch: build install-arch
109 dh_testdir
110 dh_testroot
111 dh_installchangelogs -a ChangeLog
112 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
113 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
114 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/
115 dh_installdebconf -a
116 dh_installinit -a -- defaults 95
117 dh_installman -a src/collectd.1 src/collectd.conf.5
118 dh_link -a
119 dh_strip -a --dbg-package=collectd-dbg
120 dh_compress -a
121 dh_fixperms -a
122 dh_installdeb -a
123 dh_shlibdeps -a
124 dh_gencontrol -a
125 dh_md5sums -a
126 dh_builddeb -a
128 binary: binary-arch binary-indep
129 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch