ebc5ff18559caa226d3bab854c0a527ce97d7c9e
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 (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
30 CFLAGS += -O0
31 else
32 CFLAGS += -O2
33 endif
35 # The archdir map has been copied from openjdk-6's debian/rules.
36 JAVA_ARCHDIR_MAP = armel=arm hppa=parisc lpia=i386 powerpc=ppc
37 JAVA_ARCHDIR = $(strip $(patsubst $(DEB_BUILD_ARCH)=%, %, \
38 $(filter $(DEB_BUILD_ARCH)=%, $(JAVA_ARCHDIR_MAP))))
39 ifeq (,$(JAVA_ARCHDIR))
40 JAVA_ARCHDIR = $(DEB_BUILD_ARCH)
41 endif
42 JAVA_HOME = /usr/lib/jvm/java-6-openjdk
43 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
45 JAVAC = $(JAVA_HOME)/bin/javac
46 JAR = $(JAVA_HOME)/bin/jar
47 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
48 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
50 include /usr/share/dpatch/dpatch.make
52 confflags = --host=$(DEB_HOST_GNU_TYPE) \
53 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
54 --mandir=\$${prefix}/share/man \
55 --localstatedir=/var --sysconfdir=/etc \
56 --with-perl-bindings="INSTALLDIRS=vendor" \
57 --without-libstatgrab \
58 --without-included-ltdl \
59 --disable-static \
60 --enable-all-plugins
62 # These plugins do not provide any functionality under Linux.
63 confflags += --disable-apple_sensors --disable-tape
65 # libmodbus is required for the modbus plugin.
66 confflags += --disable-modbus
68 # libnetapp is required for the netapp plugin.
69 confflags += --disable-netapp
71 # libowcapi is required for the onewire plugin.
72 confflags += --disable-onewire
74 # libclntsh is required for the oracle plugin.
75 confflags += --disable-oracle
77 # librouteros is required for the routeros plugin.
78 confflags += --disable-routeros
80 # xmms1 is required for the xmms plugin.
81 confflags += --disable-xmms
83 # libkstat is required for the xfs_arc plugin.
84 confflags += --disable-zfs-arc
86 # The static library netstat cannot be linked into shared objects on some
87 # architectures (see bugs #358637, #419684 and #524593 for more details).
88 ifneq (,$(filter alpha amd64 hppa ia64 ppc64 mips mipsel, $(DEB_BUILD_ARCH)))
89 confflags += --disable-netlink
90 endif
92 # These plugins are Linux-specific.
93 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
94 confflags += \
95 --disable-iptables \
96 --disable-ipvs \
97 --disable-madwifi \
98 --disable-netlink \
99 --disable-sensors \
100 --disable-vserver
101 endif
103 # These plugins have not been ported to FreeBSD yet.
104 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
105 confflags += \
106 --disable-battery \
107 --disable-conntrack \
108 --disable-contextswitch \
109 --disable-cpufreq \
110 --disable-disk \
111 --disable-entropy \
112 --disable-fscache \
113 --disable-irq \
114 --disable-nfs \
115 --disable-protocols \
116 --disable-serial \
117 --disable-thermal \
118 --disable-vmem \
119 --disable-wireless
120 endif
122 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
123 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
124 confflags += \
125 --disable-gmond \
126 --disable-libvirt \
127 --disable-tokyotyrant \
128 --disable-java
129 endif
131 # The hppa buildds currently do not keep up with Java related stuff, thus
132 # prevending testing transitions.
133 ifneq (,$(filter hppa, $(DEB_BUILD_ARCH)))
134 confflags += --disable-java
135 endif
137 config.status: configure $(DPATCH_STAMPFN)
138 dh_testdir
140 ( cd debian/patches/; for patch in *; do \
141 if test "$$patch" != "00list"; then \
142 grep "$$patch" 00list > /dev/null \
143 || ( echo "$$patch not enabled\!"; exit 1 ); \
144 fi; done )
146 # This is a work-around for #474087 (broken openipmi .pc files).
147 mkdir debian/pkgconfig
148 sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
149 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
150 > debian/pkgconfig/OpenIPMIpthread.pc
152 PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
153 ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
154 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
155 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
156 || ( status=$$?; cat config.log; exit $$status )
158 build: build-stamp
160 build-stamp: config.status
161 dh_testdir
163 $(MAKE)
164 perl ./debian/bin/check_plugins.pl
166 touch build-stamp
168 clean: unpatch
169 dh_testdir
170 dh_testroot
171 rm -f build-stamp
173 [ ! -f Makefile ] || $(MAKE) distclean
175 rm -f debian/README.Debian.plugins
176 rm -f src/*.1 src/*.5
178 rm -rf debian/pkgconfig
180 dh_clean
181 debconf-updatepo
183 install-indep:
184 dh_testdir
185 dh_testroot
186 dh_clean -k
187 dh_installdirs -i
188 dh_install -i
190 install-arch: build
191 dh_testdir
192 dh_testroot
193 dh_clean -k
194 dh_installdirs -a
196 $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
198 rm -f debian/tmp/usr/lib/collectd/*.la
199 rm -f debian/tmp/usr/lib/libcollectdclient.la
200 rm -f debian/tmp/etc/collectd.conf
202 dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
204 perl ./debian/bin/gen_plugin_deps.pl
206 mkdir -p debian/collectd-core/usr/share/lintian/overrides/
207 cp debian/collectd-core.overrides \
208 debian/collectd-core/usr/share/lintian/overrides/collectd-core
210 binary-indep: install-indep
211 dh_testdir
212 dh_testroot
213 dh_installchangelogs -i ChangeLog
214 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
215 dh_installexamples -i contrib/examples/myplugin.c \
216 contrib/examples/MyPlugin.pm
217 dh_compress -i -Xexamples/
218 dh_fixperms -i
219 dh_installdeb -i
220 dh_gencontrol -i
221 dh_md5sums -i
222 dh_builddeb -i
224 binary-arch: build install-arch
225 dh_testdir
226 dh_testroot
227 dh_installchangelogs -a ChangeLog
228 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
229 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
230 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
231 contrib/collection3/ contrib/php-collection/ \
232 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
233 contrib/exec-nagios.conf contrib/exec-nagios.px \
234 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
235 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
236 contrib/collectd_network.py contrib/collectd_unixsock.py \
237 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
238 debian/collectd.conf debian/filters.conf debian/thresholds.conf
239 # some upstream tarballs have been built inside a dirty working dir
240 ( cd debian/collectd-core/ \
241 && cd usr/share/doc/collectd-core/examples/collection3/ \
242 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
243 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
244 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
245 && rm -f lib/Collectd/Graph/MetaData.pm )
246 dh_installdebconf -a
247 dh_installinit -pcollectd-core --name=collectd -- defaults 95
248 dh_link -a
249 dh_strip -a --dbg-package=collectd-dbg
250 dh_compress -a -Xexamples/
251 dh_fixperms -a
252 dh_makeshlibs -a
253 dh_installdeb -a
254 dh_shlibdeps -a -Ncollectd-core -Ncollectd
255 dpkg-shlibdeps -Tdebian/collectd.substvars \
256 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
257 dpkg-shlibdeps -Tdebian/collectd-core.substvars \
258 -dDepends debian/collectd-core/usr/sbin/* \
259 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
260 grep shlibs:Suggests debian/collectd-core.substvars \
261 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
262 >> debian/collectd.substvars
263 dh_gencontrol -a
264 dh_md5sums -a
265 dh_builddeb -a
267 binary: binary-arch binary-indep
268 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch