Code

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