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 config.status: configure $(DPATCH_STAMPFN)
49 dh_testdir
50 CFLAGS="$(CFLAGS)" ./configure $(confflags)
52 build: build-stamp
54 build-stamp: config.status
55 dh_testdir
57 $(MAKE)
58 perl ./debian/bin/check_plugins.pl
60 touch build-stamp
62 clean: unpatch
63 dh_testdir
64 dh_testroot
65 rm -f build-stamp
67 [ ! -f Makefile ] || $(MAKE) distclean
69 rm -f debian/README.Debian.plugins
71 dh_clean
72 debconf-updatepo
74 install-indep:
75 dh_testdir
76 dh_testroot
77 dh_clean -k
78 dh_installdirs -i
80 include_dir=debian/collectd-dev/usr/include/collectd/ \
81 && mkdir -p $$include_dir/liboconfig \
82 && cp src/*.h $$include_dir \
83 && cp src/liboconfig/oconfig.h $$include_dir/liboconfig
85 install-arch: build
86 dh_testdir
87 dh_testroot
88 dh_clean -k
89 dh_installdirs -a
91 $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
93 rm -rf debian/collectd/usr/include/
94 rm -f debian/collectd/usr/lib/collectd/*.la
96 rm -f debian/collectd/etc/collectd.conf
97 install -D -m 0644 debian/collectd.conf \
98 debian/collectd/etc/collectd/collectd.conf
99 install -m 0644 debian/collection.conf \
100 debian/collectd/etc/collectd/collection.conf
102 mkdir -p debian/collectd/usr/lib/collectd/utils/
103 for UTIL in extractDS.px migrate-3-4.px; do \
104 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
105 done
107 perl ./debian/bin/gen_plugin_deps.pl
109 mkdir -p debian/collectd/usr/share/lintian/overrides/
110 cp debian/collectd.overrides \
111 debian/collectd/usr/share/lintian/overrides/collectd
113 binary-indep: install-indep
114 dh_testdir
115 dh_testroot
116 dh_installchangelogs -i ChangeLog
117 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
118 dh_installexamples -i contrib/examples/myplugin.c \
119 contrib/examples/MyPlugin.pm
120 dh_compress -i -Xexamples/myplugin.c -Xexamples/MyPlugin.c
121 dh_fixperms -i
122 dh_installdeb -i
123 dh_gencontrol -i
124 dh_md5sums -i
125 dh_builddeb -i
127 binary-arch: build install-arch
128 dh_testdir
129 dh_testroot
130 dh_installchangelogs -a ChangeLog
131 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
132 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
133 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
134 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
135 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
136 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py
137 dh_installdebconf -a
138 dh_installinit -a -- defaults 95
139 dh_link -a
140 dh_strip -a --dbg-package=collectd-dbg
141 dh_compress -a
142 dh_fixperms -a
143 dh_installdeb -a
144 dpkg-shlibdeps -Tdebian/collectd.substvars \
145 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
146 -dRecommends debian/collectd/usr/lib/collectd/*.so
147 dh_gencontrol -a
148 dh_md5sums -a
149 dh_builddeb -a
151 binary: binary-arch binary-indep
152 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch