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),alpha 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)
47 perl ./debian/check_plugins.pl
49 touch build-stamp
51 clean: unpatch
52 dh_testdir
53 dh_testroot
54 rm -f build-stamp
56 -$(MAKE) distclean
58 dh_clean
59 debconf-updatepo
61 install-indep:
62 dh_testdir
63 dh_testroot
64 dh_clean -k
65 dh_installdirs -i
67 include_dir=debian/collectd-dev/usr/include/collectd/ \
68 && mkdir -p $$include_dir \
69 && cp src/*.h $$include_dir
71 install-arch: build
72 dh_testdir
73 dh_testroot
74 dh_clean -k
75 dh_installdirs -a
77 $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
79 rm -f debian/collectd/usr/lib/collectd/*.la
81 rm -f debian/collectd/etc/collectd.conf
82 install -D -m 0644 debian/collectd.conf \
83 debian/collectd/etc/collectd/collectd.conf
84 install -m 0644 debian/collection.conf \
85 debian/collectd/etc/collectd/collection.conf
87 for PLUGIN in apache dns mysql perl ping sensors; do \
88 plugin_dir=debian/collectd-$$PLUGIN/usr/lib/collectd/; \
89 manpage=debian/collectd/usr/share/man/man5/collectd-$$PLUGIN.5; \
90 man_dir=debian/collectd-$$PLUGIN/usr/share/man/man5/; \
91 \
92 mkdir -p $$plugin_dir; \
93 mv debian/collectd/usr/lib/collectd/$$PLUGIN.so $$plugin_dir; \
94 \
95 if [ -e $$manpage ]; then \
96 mkdir -p $$man_dir; \
97 mv $$manpage $$man_dir; \
98 fi \
99 done
101 mkdir -p debian/collectd/usr/lib/collectd/utils/
102 for UTIL in extractDS.px migrate-3-4.px; do \
103 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
104 done
106 binary-indep: install-indep
107 dh_testdir
108 dh_testroot
109 dh_installchangelogs -i ChangeLog
110 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
111 dh_installexamples -i debian/examples/myplugin.c \
112 debian/examples/MyPlugin.pm
113 dh_compress -i
114 dh_fixperms -i
115 dh_installdeb -i
116 dh_gencontrol -i
117 dh_md5sums -i
118 dh_builddeb -i
120 binary-arch: build install-arch
121 dh_testdir
122 dh_testroot
123 dh_installchangelogs -a ChangeLog
124 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
125 dh_installdocs -a debian/NEWS.Debian
126 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
127 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/
128 dh_installdebconf -a
129 dh_installinit -a -- defaults 95
130 dh_installman -a src/collectd.1 src/collectd.conf.5
131 dh_link -a
132 dh_strip -a --dbg-package=collectd-dbg
133 dh_compress -a
134 dh_fixperms -a
135 dh_installdeb -a
136 dh_shlibdeps -a
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