Code

disable grpc plugin on platforms lacking build dependencies
[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 # libjevents is required for the intel_pmu plugin
71 confflags += --disable-intel_pmu
73 # libmic is required for the mic plugin
74 confflags += --disable-mic
76 # libnetapp is required for the netapp plugin.
77 confflags += --disable-netapp
79 # libclntsh is required for the oracle plugin.
80 confflags += --disable-oracle
82 # librouteros is required for the routeros plugin.
83 confflags += --disable-routeros
85 # xmms1 is required for the xmms plugin.
86 confflags += --disable-xmms
88 # libsigrok4 incompatible with the plugin.
89 # Cf. https://github.com/collectd/collectd/issues/1574
90 confflags += --disable-sigrok
92 # These plugins are Linux-specific.
93 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
94         confflags += \
95                 --disable-barometer \
96                 --disable-cgroups \
97                 --disable-cpusleep \
98                 --disable-drbd \
99                 --disable-ethstat \
100                 --disable-fhcount \
101                 --disable-hugepages \
102                 --disable-ipc \
103                 --disable-iptables \
104                 --disable-ipvs \
105                 --disable-lvm \
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-synproxy \
142                 --disable-thermal \
143                 --disable-vmem \
144                 --disable-wireless
145 endif
147 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
148 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
149         confflags += \
150                 --disable-gmond \
151                 --disable-virt \
152                 --disable-tokyotyrant \
153                 --disable-java
154 endif
156 # These plugins are Intel-hardware specific.
157 ifeq (,$(filter amd64 i386, $(DEB_BUILD_ARCH)))
158         confflags += \
159                 --disable-dpdkevents \
160                 --disable-dpdkstat \
161                 --disable-intel_pmu \
162                 --disable-intel_rdt \
163                 --disable-mcelog \
164                 --disable-mic \
165                 --disable-turbostat
166 endif
168 # This plugin is x86 and arm specific.
169 ifeq (,$(filter amd64 arm64 armhf i386, $(DEB_BUILD_ARCH)))
170         confflags += \
171                 --disable-xencpu
172 endif
174 # libatasmart isn't available on these platforms.
175 ifneq (,$(filter hurd-i386 kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
176         confflags += --disable-smart
177 endif
179 # The hppa buildds currently do not keep up with Java related stuff, thus
180 # prevending testing transitions. sparc is also having trouble building the
181 # java plugin.
182 ifneq (,$(filter hppa sparc, $(DEB_BUILD_ARCH)))
183         confflags += --disable-java
184 endif
186 ifneq (,$(filter amd64 arm64 armel armhf i386 ppc64el powerpc, $(DEB_BUILD_ARCH)))
187         confflags += --disable-grpc
188 endif
190 build: build-arch build-indep
191 build-arch: build-stamp
192 build-indep: build-stamp
194 build-stamp:
195         dh_testdir
196         
197         dh_autoreconf
198         
199         # This is a work-around for #474087 (broken openipmi .pc files).
200         mkdir debian/pkgconfig
201         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
202                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
203                 > debian/pkgconfig/OpenIPMIpthread.pc
204         
205         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
206         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
207                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
208                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
209                 || ( status=$$?; cat config.log; exit $$status )
211         $(MAKE)
212         dh_auto_test
213         perl ./debian/bin/check_plugins.pl
214         
215         touch build-stamp
217 clean:
218         dh_testdir
219         dh_testroot
220         rm -f build-stamp
221         
222         [ ! -f Makefile ] || $(MAKE) distclean
223         
224         rm -f debian/README.Debian.plugins
225         rm -f src/*.1 src/*.5
226         
227         rm -rf debian/pkgconfig
228         
229         dh_autoreconf_clean
230         dh_clean
231         debconf-updatepo
233 install-indep:
234         dh_testdir
235         dh_testroot
236         dh_prep
237         dh_installdirs -i
238         dh_install -i
239         
240         # update include path for collectd header files
241         (       set -e; \
242                 cd $(CURDIR)/debian/collectd-dev/usr/include/collectd/; \
243                 for lib in $$(find . -type f -name '*.h'); do \
244                         libname=$$(basename $$lib); \
245                         fullpath=$$(echo $$lib | sed -r -e 's,^\./,collectd/,'); \
246                         for dir in $$(find . -mindepth 1 -type d); do \
247                                 sed -r -i -e "s,(include\s+)\".*\<$$libname\",\1\"$$fullpath\"," $$dir/*.h; \
248                         done; \
249                 done )
251 install-arch: build
252         dh_testdir
253         dh_testroot
254         dh_prep
255         dh_installdirs -a
256         
257         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
258         
259         rm -f debian/tmp/usr/lib/collectd/*.la
260         rm -f debian/tmp/usr/lib/libcollectdclient.la
261         rm -f debian/tmp/etc/collectd.conf
262         
263         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
264         
265         perl ./debian/bin/gen_plugin_deps.pl
266         
267         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
268         cp debian/collectd-core.overrides \
269                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
271 binary-indep: install-indep
272         dh_testdir
273         dh_testroot
274         dh_installchangelogs -i ChangeLog
275         dh_installdocs -A -i debian/README.Debian AUTHORS README
276         dh_installexamples -i contrib/examples/myplugin.c \
277                 contrib/examples/MyPlugin.pm
278         dh_compress -i -Xexamples/
279         dh_fixperms -i
280         dh_installdeb -i
281         dh_gencontrol -i
282         dh_md5sums -i
283         dh_builddeb -i
285 binary-arch: build install-arch
286         dh_testdir
287         dh_testroot
288         dh_installchangelogs -a ChangeLog
289         dh_installdocs -A -a debian/README.Debian AUTHORS README
290         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
291         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
292                 contrib/collection3/ contrib/php-collection/ \
293                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
294                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
295                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
296                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
297                 contrib/collectd_network.py contrib/collectd_unixsock.py \
298                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
299                 contrib/postgresql \
300                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
301         # some upstream tarballs have been built inside a dirty working dir
302         ( cd debian/collectd-core/ \
303                 && cd usr/share/doc/collectd-core/examples/collection3/ \
304                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
305                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
306                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
307                 && rm -f lib/Collectd/Graph/MetaData.pm )
308         dh_installdebconf -a
309         dh_systemd_enable -pcollectd-core --name=collectd
310         dh_installinit -pcollectd-core --name=collectd -- defaults 95
311         dh_systemd_start -pcollectd-core
312         dh_link -a
313         dh_strip -a --dbg-package=collectd-dbg
314         dh_strip_nondeterminism -pcollectd-core
315         dh_compress -a -Xexamples/
316         dh_fixperms -a
317         dh_makeshlibs -a
318         dh_installdeb -a
319         dh_shlibdeps -a -Ncollectd-core -Ncollectd
320         dpkg-shlibdeps -Tdebian/collectd.substvars \
321                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
322         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
323                 -dDepends debian/collectd-core/usr/sbin/* \
324                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
325         grep shlibs:Suggests debian/collectd-core.substvars \
326                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
327                 >> debian/collectd.substvars
328         dh_gencontrol -a
329         dh_md5sums -a
330         dh_builddeb -a
332 binary: binary-arch binary-indep
333 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch