Code

Added debian/patches/memcached_timeout.dpatch.
[pkg-collectd.git] / debian / rules
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 CPPFLAGS = -I$(CURDIR)/debian/include
16 CFLAGS = -Wall -g
18 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
19 # however required by the perl plugin (which would otherwise be unable to find
20 # symbols defined in libperl when loading perl modules that require such
21 # symbols). This is a workaround for this issue.
22 CPPFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
24 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
25         CFLAGS += -O0
26 else
27         CFLAGS += -O2
28 endif
30 include /usr/share/dpatch/dpatch.make
32 confflags = --host=$(DEB_HOST_GNU_TYPE) \
33                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
34                         --mandir=\$${prefix}/share/man \
35                         --localstatedir=/var --sysconfdir=/etc \
36                         --with-perl-bindings="INSTALLDIRS=vendor" \
37                         --disable-xmms \
38                         --without-libstatgrab
40 # These plugins do not provide any functionality under Linux.
41 confflags += --disable-apple_sensors --disable-tape
43 # The static library netstat cannot be linked into shared objects on some
44 # architectures (see bugs #358637 and #419684 for more details).
45 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
46         confflags += --disable-netlink
47 endif
49 # libvirt is only available on amd64, i386 and powerpc.
50 ifeq (,$(findstring $(DEB_BUILD_ARCH),amd64 i386 powerpc))
51         confflags += --disable-libvirt
52 endif
54 config.status: configure $(DPATCH_STAMPFN)
55         dh_testdir
56         CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" ./configure $(confflags)
58 build: build-stamp
60 build-stamp: config.status
61         dh_testdir
62         
63         $(MAKE)
64         perl ./debian/bin/check_plugins.pl
65         
66         touch build-stamp
68 clean: unpatch
69         dh_testdir
70         dh_testroot
71         rm -f build-stamp
72         
73         [ ! -f Makefile ] || $(MAKE) distclean
74         
75         rm -f debian/README.Debian.plugins
76         
77         dh_clean 
78         debconf-updatepo
80 install-indep:
81         dh_testdir
82         dh_testroot
83         dh_clean -k
84         dh_installdirs -i
85         
86         include_dir=debian/collectd-dev/usr/include/collectd/ \
87                 && mkdir -p $$include_dir/liboconfig \
88                 && cp src/*.h $$include_dir \
89                 && cp src/liboconfig/oconfig.h $$include_dir/liboconfig
91 install-arch: build
92         dh_testdir
93         dh_testroot
94         dh_clean -k 
95         dh_installdirs -a
96         
97         $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
98         
99         rm -rf debian/collectd/usr/include/
100         rm -f debian/collectd/usr/lib/collectd/*.la
101         
102         rm -f debian/collectd/etc/collectd.conf
103         install -D -m 0644 debian/collectd.conf \
104                 debian/collectd/etc/collectd/collectd.conf
105         install -m 0644 debian/collection.conf \
106                 debian/collectd/etc/collectd/collection.conf
107         install -m 0644 debian/thresholds.conf \
108                 debian/collectd/etc/collectd/thresholds.conf
109         
110         mkdir -p debian/collectd/usr/lib/collectd/utils/
111         for UTIL in rrd_filter.px migrate-3-4.px; do \
112                 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
113         done
114         
115         perl ./debian/bin/gen_plugin_deps.pl
116         
117         mkdir -p debian/collectd/usr/share/lintian/overrides/
118         cp debian/collectd.overrides \
119                 debian/collectd/usr/share/lintian/overrides/collectd
121 binary-indep: install-indep
122         dh_testdir
123         dh_testroot
124         dh_installchangelogs -i ChangeLog
125         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
126         dh_installexamples -i contrib/examples/myplugin.c \
127                 contrib/examples/MyPlugin.pm
128         dh_compress -i -Xexamples/
129         dh_fixperms -i
130         dh_installdeb -i
131         dh_gencontrol -i
132         dh_md5sums -i
133         dh_builddeb -i
135 binary-arch: build install-arch
136         dh_testdir
137         dh_testroot
138         dh_installchangelogs -a ChangeLog
139         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
140         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
141         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
142                 contrib/collection3/ \
143                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
144                 contrib/exec-nagios.conf contrib/exec-nagios.px \
145                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
146                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py
147         dh_installdebconf -a
148         dh_installinit -a -- defaults 95
149         dh_link -a
150         dh_strip -a --dbg-package=collectd-dbg
151         dh_compress -a -Xexamples/
152         dh_fixperms -a
153         dh_installdeb -a
154         dpkg-shlibdeps -Tdebian/collectd.substvars \
155                 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
156                         debian/collectd/usr/lib/collectd/rrdtool.so \
157                 -dRecommends debian/collectd/usr/lib/collectd/*.so
158         dh_gencontrol -a
159         dh_md5sums -a
160         dh_builddeb -a
162 binary: binary-arch binary-indep
163 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch