Code

Disable the lvm plugin
[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 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 # Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to
23 # /etc/collectd would be wrong though.
24 CPPFLAGS += -UCONFIGFILE
25 CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"'
27 # A PostgreSQL header redefines CACHE_LINE_SIZE on FreeBSD.
28 # Cf. https://bugs.debian.org/760719 and https://bugs.debian.org/763098
29 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
30         CPPFLAGS += -Wp,-w
31 endif
33 LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
35 # The archdir map has been copied from openjdk-6's debian/rules.
36 JAVA_ARCHDIR = $(shell /usr/share/javahelper/java-arch.sh $(DEB_BUILD_ARCH))
37 ifeq (,$(JAVA_ARCHDIR))
38         JAVA_ARCHDIR = $(DEB_BUILD_ARCH)
39 endif
40 JAVA_HOME = /usr/lib/jvm/default-java
41 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
43 JAVAC = $(JAVA_HOME)/bin/javac
44 JAR = $(JAVA_HOME)/bin/jar
45 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
46 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
48 confflags = --host=$(DEB_HOST_GNU_TYPE) \
49                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
50                         --mandir=\$${prefix}/share/man \
51                         --localstatedir=/var --sysconfdir=/etc \
52                         --with-perl-bindings="INSTALLDIRS=vendor INSTALL_BASE=" \
53                         --without-libstatgrab \
54                         --without-included-ltdl \
55                         --disable-static \
56                         --disable-silent-rules \
57                         --enable-all-plugins
59 # These plugins do not provide any functionality under Linux.
60 # MacOS only (requires IO Kit):
61 confflags += --disable-apple_sensors
62 # AIX only (requires perfstat):
63 confflags += --disable-lpar
64 # Solaris only (requires devinfo and kstat)
65 confflags += --disable-tape
67 # libaquaero5 is required for the aquaero plugin
68 confflags += --disable-aquaero
70 # libmic is required for the mic plugin
71 confflags += --disable-mic
73 # libnetapp is required for the netapp plugin.
74 confflags += --disable-netapp
76 # libclntsh is required for the oracle plugin.
77 confflags += --disable-oracle
79 # librouteros is required for the routeros plugin.
80 confflags += --disable-routeros
82 # xmms1 is required for the xmms plugin.
83 confflags += --disable-xmms
85 # libsigrok4 incompatible with the plugin.
86 # Cf. https://github.com/collectd/collectd/issues/1574
87 confflags += --disable-sigrok
89 # liblvm2app is deprecated.
90 # https://github.com/collectd/collectd/issues/2647
91 confflags += --disable-lvm
93 # These plugins are Linux-specific.
94 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
95         confflags += \
96                 --disable-barometer \
97                 --disable-cgroups \
98                 --disable-cpusleep \
99                 --disable-drbd \
100                 --disable-ethstat \
101                 --disable-fhcount \
102                 --disable-hugepages \
103                 --disable-ipc \
104                 --disable-iptables \
105                 --disable-ipvs \
106                 --disable-madwifi \
107                 --disable-md \
108                 --disable-netlink \
109                 --disable-numa \
110                 --disable-sensors \
111                 --disable-vserver
112 endif
114 # This plugin is FreeBSD-specific.
115 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
116         confflags += \
117                 --disable-pf
118 endif
120 # This plugin is Solaris-specific.
121 confflags += \
122                 --disable-zone
124 # These plugins have not been ported to FreeBSD yet.
125 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
126         # Work-around an incomplete check for kvm functionality
127         CPPFLAGS  += -DHAVE_STRUCT_KINFO_PROC_FREEBSD
128         confflags += --enable-processes=force
130         confflags += \
131                 --disable-battery \
132                 --disable-conntrack \
133                 --disable-contextswitch \
134                 --disable-cpufreq \
135                 --disable-entropy \
136                 --disable-fscache \
137                 --disable-irq \
138                 --disable-nfs \
139                 --disable-protocols \
140                 --disable-serial \
141                 --disable-thermal \
142                 --disable-vmem \
143                 --disable-wireless
144 endif
146 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
147 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
148         confflags += \
149                 --disable-gmond \
150                 --disable-virt \
151                 --disable-tokyotyrant \
152                 --disable-java
153 endif
155 # These plugins are Intel-hardware specific.
156 ifeq (,$(filter amd64 i386, $(DEB_BUILD_ARCH)))
157         confflags += \
158                 --disable-dpdkstat \
159                 --disable-turbostat
160 endif
162 # This plugin is x86 and arm specific.
163 ifeq (,$(filter amd64 arm64 armhf i386, $(DEB_BUILD_ARCH)))
164         confflags += \
165                 --disable-xencpu
166 endif
168 # libatasmart isn't available on these platforms.
169 ifneq (,$(filter hurd-i386 kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
170         confflags += --disable-smart
171 endif
173 # The hppa buildds currently do not keep up with Java related stuff, thus
174 # prevending testing transitions. sparc is also having trouble building the
175 # java plugin.
176 ifneq (,$(filter hppa sparc, $(DEB_BUILD_ARCH)))
177         confflags += --disable-java
178 endif
180 build: build-arch build-indep
181 build-arch: build-stamp
182 build-indep: build-stamp
184 build-stamp:
185         dh_testdir
186         
187         dh_autoreconf
188         
189         # This is a work-around for #474087 (broken openipmi .pc files).
190         mkdir debian/pkgconfig
191         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
192                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
193                 > debian/pkgconfig/OpenIPMIpthread.pc
194         
195         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
196         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
197                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
198                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
199                 || ( status=$$?; cat config.log; exit $$status )
201         $(MAKE)
202         dh_auto_test
203         perl ./debian/bin/check_plugins.pl
204         
205         touch build-stamp
207 clean:
208         dh_testdir
209         dh_testroot
210         rm -f build-stamp
211         
212         [ ! -f Makefile ] || $(MAKE) distclean
213         
214         rm -f debian/README.Debian.plugins
215         rm -f src/*.1 src/*.5
216         
217         rm -rf debian/pkgconfig
218         
219         dh_autoreconf_clean
220         dh_clean
221         debconf-updatepo
223 install-indep:
224         dh_testdir
225         dh_testroot
226         dh_prep
227         dh_installdirs -i
228         dh_install -i
229         
230         # update include path for collectd header files
231         (       set -e; \
232                 cd $(CURDIR)/debian/collectd-dev/usr/include/collectd/; \
233                 for lib in $$(find . -type f -name '*.h'); do \
234                         libname=$$(basename $$lib); \
235                         fullpath=$$(echo $$lib | sed -r -e 's,^\./,collectd/,'); \
236                         for dir in $$(find . -mindepth 1 -type d); do \
237                                 sed -r -i -e "s,(include\s+)\".*\<$$libname\",\1\"$$fullpath\"," $$dir/*.h; \
238                         done; \
239                 done )
241 install-arch: build
242         dh_testdir
243         dh_testroot
244         dh_prep
245         dh_installdirs -a
246         
247         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
248         
249         rm -f debian/tmp/usr/lib/collectd/*.la
250         rm -f debian/tmp/usr/lib/libcollectdclient.la
251         rm -f debian/tmp/etc/collectd.conf
252         
253         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
254         
255         perl ./debian/bin/gen_plugin_deps.pl
256         
257         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
258         cp debian/collectd-core.overrides \
259                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
261 binary-indep: install-indep
262         dh_testdir
263         dh_testroot
264         dh_installchangelogs -i ChangeLog
265         dh_installdocs -A -i debian/README.Debian AUTHORS README
266         dh_installexamples -i contrib/examples/myplugin.c \
267                 contrib/examples/MyPlugin.pm
268         dh_compress -i -Xexamples/
269         dh_fixperms -i
270         dh_installdeb -i
271         dh_gencontrol -i
272         dh_md5sums -i
273         dh_builddeb -i
275 binary-arch: build install-arch
276         dh_testdir
277         dh_testroot
278         dh_installchangelogs -a ChangeLog
279         dh_installdocs -A -a debian/README.Debian AUTHORS README
280         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
281         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
282                 contrib/collection3/ contrib/php-collection/ \
283                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
284                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
285                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
286                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
287                 contrib/collectd_network.py contrib/collectd_unixsock.py \
288                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
289                 contrib/postgresql \
290                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
291         # some upstream tarballs have been built inside a dirty working dir
292         ( cd debian/collectd-core/ \
293                 && cd usr/share/doc/collectd-core/examples/collection3/ \
294                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
295                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
296                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
297                 && rm -f lib/Collectd/Graph/MetaData.pm )
298         dh_installdebconf -a
299         dh_systemd_enable -pcollectd-core --name=collectd
300         dh_installinit -pcollectd-core --name=collectd -- defaults 95
301         dh_systemd_start -pcollectd-core
302         dh_link -a
303         dh_strip -a --dbg-package=collectd-dbg
304         dh_strip_nondeterminism -pcollectd-core
305         dh_compress -a -Xexamples/
306         dh_fixperms -a
307         dh_makeshlibs -a
308         dh_installdeb -a
309         dh_shlibdeps -a -Ncollectd-core -Ncollectd
310         dpkg-shlibdeps -Tdebian/collectd.substvars \
311                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
312         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
313                 -dDepends debian/collectd-core/usr/sbin/* \
314                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
315         grep shlibs:Suggests debian/collectd-core.substvars \
316                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
317                 >> debian/collectd.substvars
318         dh_gencontrol -a
319         dh_md5sums -a
320         dh_builddeb -a
322 binary: binary-arch binary-indep
323 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch