Code

11f5c05efeb0e3a7ebed41eb1891a0c000c12c76
[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 libraries netstat and upsclient cannot be linked into shared
44 # objects on some architectures (see bugs #358637 and #419684 for more
45 # details).
46 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
47         confflags += --disable-netlink --disable-nut
48 endif
50 # libvirt is only available on amd64, i386 and powerpc.
51 ifeq (,$(findstring $(DEB_BUILD_ARCH),amd64 i386 powerpc))
52         confflags += --disable-libvirt
53 endif
55 # Force the inclusion of the ipmi plugin and manually specify its
56 # dependencies to work around #474087 (broken openipmi .pc files).
57 BUILD_WITH_OPENIPMI_LIBS = -lOpenIPMIpthread
58 confflags += --enable-ipmi
60 config.status: configure $(DPATCH_STAMPFN)
61         dh_testdir
62         BUILD_WITH_OPENIPMI_LIBS="$(BUILD_WITH_OPENIPMI_LIBS)" \
63         CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" ./configure $(confflags)
65 build: build-stamp
67 build-stamp: config.status
68         dh_testdir
69         
70         $(MAKE)
71         perl ./debian/bin/check_plugins.pl
72         
73         touch build-stamp
75 clean: unpatch
76         dh_testdir
77         dh_testroot
78         rm -f build-stamp
79         
80         [ ! -f Makefile ] || $(MAKE) distclean
81         
82         rm -f debian/README.Debian.plugins
83         
84         dh_clean 
85         debconf-updatepo
87 install-indep:
88         dh_testdir
89         dh_testroot
90         dh_clean -k
91         dh_installdirs -i
92         
93         include_dir=debian/collectd-dev/usr/include/collectd/ \
94                 && mkdir -p $$include_dir/liboconfig \
95                 && cp src/*.h $$include_dir \
96                 && cp src/liboconfig/oconfig.h $$include_dir/liboconfig
98 install-arch: build
99         dh_testdir
100         dh_testroot
101         dh_clean -k 
102         dh_installdirs -a
103         
104         $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
105         
106         rm -rf debian/collectd/usr/include/
107         rm -f debian/collectd/usr/lib/collectd/*.la
108         
109         rm -f debian/collectd/etc/collectd.conf
110         install -D -m 0644 debian/collectd.conf \
111                 debian/collectd/etc/collectd/collectd.conf
112         install -m 0644 debian/collection.conf \
113                 debian/collectd/etc/collectd/collection.conf
114         install -m 0644 debian/thresholds.conf \
115                 debian/collectd/etc/collectd/thresholds.conf
116         
117         mkdir -p debian/collectd/usr/lib/collectd/utils/
118         for UTIL in rrd_filter.px migrate-3-4.px; do \
119                 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
120         done
121         
122         perl ./debian/bin/gen_plugin_deps.pl
123         
124         mkdir -p debian/collectd/usr/share/lintian/overrides/
125         cp debian/collectd.overrides \
126                 debian/collectd/usr/share/lintian/overrides/collectd
128 binary-indep: install-indep
129         dh_testdir
130         dh_testroot
131         dh_installchangelogs -i ChangeLog
132         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
133         dh_installexamples -i contrib/examples/myplugin.c \
134                 contrib/examples/MyPlugin.pm
135         dh_compress -i -Xexamples/myplugin.c -Xexamples/MyPlugin.pm
136         dh_fixperms -i
137         dh_installdeb -i
138         dh_gencontrol -i
139         dh_md5sums -i
140         dh_builddeb -i
142 binary-arch: build install-arch
143         dh_testdir
144         dh_testroot
145         dh_installchangelogs -a ChangeLog
146         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
147         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
148         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
149                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
150                 contrib/exec-nagios.conf contrib/exec-nagios.px \
151                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
152                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py
153         dh_installdebconf -a
154         dh_installinit -a -- defaults 95
155         dh_link -a
156         dh_strip -a --dbg-package=collectd-dbg
157         dh_compress -a
158         dh_fixperms -a
159         dh_installdeb -a
160         dpkg-shlibdeps -Tdebian/collectd.substvars \
161                 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
162                         debian/collectd/usr/lib/collectd/rrdtool.so \
163                 -dRecommends debian/collectd/usr/lib/collectd/*.so
164         dh_gencontrol -a
165         dh_md5sums -a
166         dh_builddeb -a
168 binary: binary-arch binary-indep
169 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch