c5ca9dd83e9b2a1aa7dcf01d814db9dca9371d6c
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 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
17 CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
18 CPPFLAGS += -I$(CURDIR)/debian/include
19 CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
20 CFLAGS += -Wall -Wno-error=deprecated-declarations
22 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
23 # however required by the perl plugin (which would otherwise be unable to find
24 # symbols defined in libperl when loading perl modules that require such
25 # symbols). This is a workaround for this issue.
26 CPPFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
28 # Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to
29 # /etc/collectd would be wrong though.
30 CPPFLAGS += -UCONFIGFILE
31 CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"'
33 # A PostgreSQL header redefines CACHE_LINE_SIZE on FreeBSD.
34 # Cf. https://bugs.debian.org/760719 and https://bugs.debian.org/763098
35 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
36 CPPFLAGS += -Wp,-w
37 endif
39 LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
41 # The archdir map has been copied from openjdk-6's debian/rules.
42 JAVA_ARCHDIR = $(shell /usr/share/javahelper/java-arch.sh $(DEB_BUILD_ARCH))
43 ifeq (,$(JAVA_ARCHDIR))
44 JAVA_ARCHDIR = $(DEB_BUILD_ARCH)
45 endif
46 JAVA_HOME = /usr/lib/jvm/default-java
47 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
49 JAVAC = $(JAVA_HOME)/bin/javac
50 JAR = $(JAVA_HOME)/bin/jar
51 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
52 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
54 include /usr/share/dpatch/dpatch.make
56 confflags = --host=$(DEB_HOST_GNU_TYPE) \
57 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
58 --mandir=\$${prefix}/share/man \
59 --localstatedir=/var --sysconfdir=/etc \
60 --with-perl-bindings="INSTALLDIRS=vendor INSTALL_BASE=" \
61 --without-libstatgrab \
62 --without-included-ltdl \
63 --disable-static \
64 --enable-all-plugins
66 # These plugins do not provide any functionality under Linux.
67 # MacOS only (requires IO Kit):
68 confflags += --disable-apple_sensors
69 # AIX only (requires perfstat):
70 confflags += --disable-lpar
71 # Solaris only (requires devinfo and kstat)
72 confflags += --disable-tape
74 # libaquaero5 is required for the aquaero plugin
75 confflags += --disable-aquaero
77 # libmic is required for the mic plugin
78 confflags += --disable-mic
80 # libnetapp is required for the netapp plugin.
81 confflags += --disable-netapp
83 # libclntsh is required for the oracle plugin.
84 confflags += --disable-oracle
86 # librouteros is required for the routeros plugin.
87 confflags += --disable-routeros
89 # libmongoc is required for the write_mongodb plugin.
90 confflags += --disable-write_mongodb
92 # xmms1 is required for the xmms plugin.
93 confflags += --disable-xmms
95 # These plugins are Linux-specific.
96 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
97 confflags += \
98 --disable-cgroups \
99 --disable-ethstat \
100 --disable-iptables \
101 --disable-ipvs \
102 --disable-lvm \
103 --disable-madwifi \
104 --disable-md \
105 --disable-netlink \
106 --disable-numa \
107 --disable-sensors \
108 --disable-vserver
109 endif
111 # This plugin is FreeBSD-specific.
112 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
113 confflags += \
114 --disable-pf
115 endif
117 # These plugins have not been ported to FreeBSD yet.
118 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
119 # Work-around an incomplete check for kvm functionality
120 CPPFLAGS += -DHAVE_STRUCT_KINFO_PROC_FREEBSD
121 confflags += --enable-processes=force
123 confflags += \
124 --disable-battery \
125 --disable-conntrack \
126 --disable-contextswitch \
127 --disable-cpufreq \
128 --disable-disk \
129 --disable-entropy \
130 --disable-fscache \
131 --disable-irq \
132 --disable-nfs \
133 --disable-protocols \
134 --disable-serial \
135 --disable-thermal \
136 --disable-vmem \
137 --disable-wireless
138 endif
140 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
141 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
142 confflags += \
143 --disable-gmond \
144 --disable-libvirt \
145 --disable-tokyotyrant \
146 --disable-java
147 endif
149 # The hppa buildds currently do not keep up with Java related stuff, thus
150 # prevending testing transitions. sparc is also having trouble building the
151 # java plugin.
152 ifneq (,$(filter hppa sparc, $(DEB_BUILD_ARCH)))
153 confflags += --disable-java
154 endif
156 config.status: configure $(DPATCH_STAMPFN)
157 dh_testdir
159 ( cd debian/patches/; for patch in *; do \
160 if test "$$patch" != "00list"; then \
161 grep "$$patch" 00list > /dev/null \
162 || ( echo "$$patch not enabled\!"; exit 1 ); \
163 fi; done )
165 # This is a work-around for #474087 (broken openipmi .pc files).
166 mkdir debian/pkgconfig
167 sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
168 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
169 > debian/pkgconfig/OpenIPMIpthread.pc
171 PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
172 ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
173 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
174 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
175 || ( status=$$?; cat config.log; exit $$status )
177 build: build-arch build-indep
178 build-arch: build-stamp
179 build-indep: build-stamp
181 build-stamp: config.status
182 dh_testdir
184 $(MAKE)
185 perl ./debian/bin/check_plugins.pl
187 touch build-stamp
189 clean: unpatch
190 dh_testdir
191 dh_testroot
192 rm -f build-stamp
194 [ ! -f Makefile ] || $(MAKE) distclean
196 rm -f debian/README.Debian.plugins
197 rm -f src/*.1 src/*.5
199 rm -rf debian/pkgconfig
201 dh_clean
202 debconf-updatepo
204 install-indep:
205 dh_testdir
206 dh_testroot
207 dh_clean -k
208 dh_installdirs -i
209 dh_install -i
211 # update include path for collectd header files
212 sed -r -i -e 's/include "(.*)"/include "collectd\/core\/\1"/' \
213 $(CURDIR)/debian/collectd-dev/usr/include/collectd/core/*
214 sed -r -i -e 's/"collectd\/core\/(liboconfig\/.*)"/"collectd\/\1"/' \
215 $(CURDIR)/debian/collectd-dev/usr/include/collectd/core/*
217 install-arch: build
218 dh_testdir
219 dh_testroot
220 dh_clean -k
221 dh_installdirs -a
223 $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
225 rm -f debian/tmp/usr/lib/collectd/*.la
226 rm -f debian/tmp/usr/lib/libcollectdclient.la
227 rm -f debian/tmp/etc/collectd.conf
229 dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
231 perl ./debian/bin/gen_plugin_deps.pl
233 mkdir -p debian/collectd-core/usr/share/lintian/overrides/
234 cp debian/collectd-core.overrides \
235 debian/collectd-core/usr/share/lintian/overrides/collectd-core
237 binary-indep: install-indep
238 dh_testdir
239 dh_testroot
240 dh_installchangelogs -i ChangeLog
241 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
242 dh_installexamples -i contrib/examples/myplugin.c \
243 contrib/examples/MyPlugin.pm
244 dh_compress -i -Xexamples/
245 dh_fixperms -i
246 dh_installdeb -i
247 dh_gencontrol -i
248 dh_md5sums -i
249 dh_builddeb -i
251 binary-arch: build install-arch
252 dh_testdir
253 dh_testroot
254 dh_installchangelogs -a ChangeLog
255 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
256 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
257 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
258 contrib/collection3/ contrib/php-collection/ \
259 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
260 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
261 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
262 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
263 contrib/collectd_network.py contrib/collectd_unixsock.py \
264 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
265 contrib/postgresql \
266 debian/collectd.conf debian/filters.conf debian/thresholds.conf
267 # some upstream tarballs have been built inside a dirty working dir
268 ( cd debian/collectd-core/ \
269 && cd usr/share/doc/collectd-core/examples/collection3/ \
270 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
271 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
272 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
273 && rm -f lib/Collectd/Graph/MetaData.pm )
274 dh_installdebconf -a
275 dh_installinit -pcollectd-core --name=collectd -- defaults 95
276 dh_link -a
277 dh_strip -a --dbg-package=collectd-dbg
278 dh_compress -a -Xexamples/
279 dh_fixperms -a
280 dh_makeshlibs -a
281 dh_installdeb -a
282 dh_shlibdeps -a -Ncollectd-core -Ncollectd
283 dpkg-shlibdeps -Tdebian/collectd.substvars \
284 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
285 dpkg-shlibdeps -Tdebian/collectd-core.substvars \
286 -dDepends debian/collectd-core/usr/sbin/* \
287 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
288 grep shlibs:Suggests debian/collectd-core.substvars \
289 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
290 >> debian/collectd.substvars
291 dh_gencontrol -a
292 dh_md5sums -a
293 dh_builddeb -a
295 binary: binary-arch binary-indep
296 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch