Code

Merged branch 'master' of git://git.tokkee.org/pkg-collectd.
[pkg-collectd.git] / debian / rules
1 #! /usr/bin/make -f
2 # debian/rules for collectd
3 #
4 # Written by Sebastian Harl <tokkee@debian.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 # Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to
25 # /etc/collectd would be wrong though.
26 CPPFLAGS += -UCONFIGFILE
27 CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"'
29 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
30         CFLAGS += -O0
31 else
32         CFLAGS += -O2
33 endif
35 include /usr/share/dpatch/dpatch.make
37 confflags = --host=$(DEB_HOST_GNU_TYPE) \
38                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
39                         --mandir=\$${prefix}/share/man \
40                         --localstatedir=/var --sysconfdir=/etc \
41                         --with-perl-bindings="INSTALLDIRS=vendor" \
42                         --without-libstatgrab
44 # These plugins do not provide any functionality under Linux.
45 confflags += --disable-apple_sensors --disable-tape
47 # libganglia >= 3 is required for the gmond plugin.
48 confflags += --disable-gmond
50 # libmemcached is required for the memcachec plugin.
51 confflags += --disable-memcachec
53 # libowcapi is required for the onewire plugin.
54 confflags += --disable-onewire
56 # libclntsh is required for the oracle plugin.
57 confflags += --disable-oracle
59 # rrdclient support in librrd is required for the rrdcached plugin.
60 confflags += --disable-rrdcached
62 # xmms1 is required for the xmms plugin.
63 confflags += --disable-xmms
65 # The static library netstat cannot be linked into shared objects on some
66 # architectures (see bugs #358637, #419684 and #524593 for more details).
67 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64 mips mipsel))
68         confflags += --disable-netlink
69 endif
71 # libvirt is only available on amd64, i386 and powerpc.
72 ifeq (,$(findstring $(DEB_BUILD_ARCH),amd64 i386 powerpc))
73         confflags += --disable-libvirt
74 endif
76 config.status: configure $(DPATCH_STAMPFN)
77         dh_testdir
78         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)"
80 build: build-stamp
82 build-stamp: config.status
83         dh_testdir
84         
85         $(MAKE)
86         perl ./debian/bin/check_plugins.pl
87         
88         touch build-stamp
90 clean: unpatch
91         dh_testdir
92         dh_testroot
93         rm -f build-stamp
94         
95         [ ! -f Makefile ] || $(MAKE) distclean
96         
97         rm -f debian/README.Debian.plugins
98         rm -f src/*.1 src/*.5
99         
100         dh_clean
101         debconf-updatepo
103 install-indep:
104         dh_testdir
105         dh_testroot
106         dh_clean -k
107         dh_installdirs -i
108         dh_install -i
110 install-arch: build
111         dh_testdir
112         dh_testroot
113         dh_clean -k
114         dh_installdirs -a
115         
116         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
117         
118         rm -f debian/tmp/usr/lib/collectd/*.la
119         rm -f debian/tmp/etc/collectd.conf
120         
121         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
122         
123         perl ./debian/bin/gen_plugin_deps.pl
124         
125         mkdir -p debian/collectd/usr/share/lintian/overrides/
126         cp debian/collectd.overrides \
127                 debian/collectd/usr/share/lintian/overrides/collectd
129 binary-indep: install-indep
130         dh_testdir
131         dh_testroot
132         dh_installchangelogs -i ChangeLog
133         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
134         dh_installexamples -i contrib/examples/myplugin.c \
135                 contrib/examples/MyPlugin.pm
136         dh_compress -i -Xexamples/
137         dh_fixperms -i
138         dh_installdeb -i
139         dh_gencontrol -i
140         dh_md5sums -i
141         dh_builddeb -i
143 binary-arch: build install-arch
144         dh_testdir
145         dh_testroot
146         dh_installchangelogs -a ChangeLog
147         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
148         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
149         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
150                 contrib/collection3/ contrib/php-collection/ \
151                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
152                 contrib/exec-nagios.conf contrib/exec-nagios.px \
153                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
154                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
155                 contrib/collectd-network.py contrib/collectd-unixsock.py \
156                 contrib/snmp-probe-host.px
157         dh_installdebconf -a
158         dh_installinit -a -- defaults 95
159         dh_link -a
160         dh_strip -a --dbg-package=collectd-dbg
161         dh_compress -a -Xexamples/
162         dh_fixperms -a
163         dh_makeshlibs -a
164         dh_installdeb -a
165         dpkg-shlibdeps -Tdebian/collectd.substvars \
166                 -dDepends debian/collectd/usr/sbin/* \
167                         debian/collectd/usr/lib/collectd/rrdtool.so \
168                 -dRecommends debian/collectd/usr/lib/collectd/*.so
169         dh_shlibdeps -a -Ncollectd
170         dh_gencontrol -a
171         dh_md5sums -a
172         dh_builddeb -a
174 binary: binary-arch binary-indep
175 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch