Code

rules: disable intel_pmu 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 # 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 # liblvm2app is deprecated.
93 # https://github.com/collectd/collectd/issues/2647
94 confflags += --disable-lvm
96 # These plugins are Linux-specific.
97 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
98         confflags += \
99                 --disable-barometer \
100                 --disable-cgroups \
101                 --disable-cpusleep \
102                 --disable-drbd \
103                 --disable-ethstat \
104                 --disable-fhcount \
105                 --disable-hugepages \
106                 --disable-ipc \
107                 --disable-iptables \
108                 --disable-ipvs \
109                 --disable-madwifi \
110                 --disable-md \
111                 --disable-netlink \
112                 --disable-numa \
113                 --disable-sensors \
114                 --disable-vserver
115 endif
117 # This plugin is FreeBSD-specific.
118 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
119         confflags += \
120                 --disable-pf
121 endif
123 # This plugin is Solaris-specific.
124 confflags += \
125                 --disable-zone
127 # These plugins have not been ported to FreeBSD yet.
128 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
129         # Work-around an incomplete check for kvm functionality
130         CPPFLAGS  += -DHAVE_STRUCT_KINFO_PROC_FREEBSD
131         confflags += --enable-processes=force
133         confflags += \
134                 --disable-battery \
135                 --disable-conntrack \
136                 --disable-contextswitch \
137                 --disable-cpufreq \
138                 --disable-entropy \
139                 --disable-fscache \
140                 --disable-irq \
141                 --disable-nfs \
142                 --disable-protocols \
143                 --disable-serial \
144                 --disable-thermal \
145                 --disable-vmem \
146                 --disable-wireless
147 endif
149 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
150 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
151         confflags += \
152                 --disable-gmond \
153                 --disable-virt \
154                 --disable-tokyotyrant \
155                 --disable-java
156 endif
158 # These plugins are Intel-hardware specific.
159 ifeq (,$(filter amd64 i386, $(DEB_BUILD_ARCH)))
160         confflags += \
161                 --disable-dpdkstat \
162                 --disable-turbostat
163 endif
165 # This plugin is x86 and arm specific.
166 ifeq (,$(filter amd64 arm64 armhf i386, $(DEB_BUILD_ARCH)))
167         confflags += \
168                 --disable-xencpu
169 endif
171 # libatasmart isn't available on these platforms.
172 ifneq (,$(filter hurd-i386 kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
173         confflags += --disable-smart
174 endif
176 # The hppa buildds currently do not keep up with Java related stuff, thus
177 # prevending testing transitions. sparc is also having trouble building the
178 # java plugin.
179 ifneq (,$(filter hppa sparc, $(DEB_BUILD_ARCH)))
180         confflags += --disable-java
181 endif
183 build: build-arch build-indep
184 build-arch: build-stamp
185 build-indep: build-stamp
187 build-stamp:
188         dh_testdir
189         
190         dh_autoreconf
191         
192         # This is a work-around for #474087 (broken openipmi .pc files).
193         mkdir debian/pkgconfig
194         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
195                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
196                 > debian/pkgconfig/OpenIPMIpthread.pc
197         
198         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
199         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
200                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
201                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
202                 || ( status=$$?; cat config.log; exit $$status )
204         $(MAKE)
205         dh_auto_test
206         perl ./debian/bin/check_plugins.pl
207         
208         touch build-stamp
210 clean:
211         dh_testdir
212         dh_testroot
213         rm -f build-stamp
214         
215         [ ! -f Makefile ] || $(MAKE) distclean
216         
217         rm -f debian/README.Debian.plugins
218         rm -f src/*.1 src/*.5
219         
220         rm -rf debian/pkgconfig
221         
222         dh_autoreconf_clean
223         dh_clean
224         debconf-updatepo
226 install-indep:
227         dh_testdir
228         dh_testroot
229         dh_prep
230         dh_installdirs -i
231         dh_install -i
232         
233         # update include path for collectd header files
234         (       set -e; \
235                 cd $(CURDIR)/debian/collectd-dev/usr/include/collectd/; \
236                 for lib in $$(find . -type f -name '*.h'); do \
237                         libname=$$(basename $$lib); \
238                         fullpath=$$(echo $$lib | sed -r -e 's,^\./,collectd/,'); \
239                         for dir in $$(find . -mindepth 1 -type d); do \
240                                 sed -r -i -e "s,(include\s+)\".*\<$$libname\",\1\"$$fullpath\"," $$dir/*.h; \
241                         done; \
242                 done )
244 install-arch: build
245         dh_testdir
246         dh_testroot
247         dh_prep
248         dh_installdirs -a
249         
250         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
251         
252         rm -f debian/tmp/usr/lib/collectd/*.la
253         rm -f debian/tmp/usr/lib/libcollectdclient.la
254         rm -f debian/tmp/etc/collectd.conf
255         
256         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
257         
258         perl ./debian/bin/gen_plugin_deps.pl
259         
260         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
261         cp debian/collectd-core.overrides \
262                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
264 binary-indep: install-indep
265         dh_testdir
266         dh_testroot
267         dh_installchangelogs -i ChangeLog
268         dh_installdocs -A -i debian/README.Debian AUTHORS README
269         dh_installexamples -i contrib/examples/myplugin.c \
270                 contrib/examples/MyPlugin.pm
271         dh_compress -i -Xexamples/
272         dh_fixperms -i
273         dh_installdeb -i
274         dh_gencontrol -i
275         dh_md5sums -i
276         dh_builddeb -i
278 binary-arch: build install-arch
279         dh_testdir
280         dh_testroot
281         dh_installchangelogs -a ChangeLog
282         dh_installdocs -A -a debian/README.Debian AUTHORS README
283         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
284         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
285                 contrib/collection3/ contrib/php-collection/ \
286                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
287                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
288                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
289                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
290                 contrib/collectd_network.py contrib/collectd_unixsock.py \
291                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
292                 contrib/postgresql \
293                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
294         # some upstream tarballs have been built inside a dirty working dir
295         ( cd debian/collectd-core/ \
296                 && cd usr/share/doc/collectd-core/examples/collection3/ \
297                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
298                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
299                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
300                 && rm -f lib/Collectd/Graph/MetaData.pm )
301         dh_installdebconf -a
302         dh_systemd_enable -pcollectd-core --name=collectd
303         dh_installinit -pcollectd-core --name=collectd -- defaults 95
304         dh_systemd_start -pcollectd-core
305         dh_link -a
306         dh_strip -a --dbg-package=collectd-dbg
307         dh_strip_nondeterminism -pcollectd-core
308         dh_compress -a -Xexamples/
309         dh_fixperms -a
310         dh_makeshlibs -a
311         dh_installdeb -a
312         dh_shlibdeps -a -Ncollectd-core -Ncollectd
313         dpkg-shlibdeps -Tdebian/collectd.substvars \
314                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
315         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
316                 -dDepends debian/collectd-core/usr/sbin/* \
317                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
318         grep shlibs:Suggests debian/collectd-core.substvars \
319                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
320                 >> debian/collectd.substvars
321         dh_gencontrol -a
322         dh_md5sums -a
323         dh_builddeb -a
325 binary: binary-arch binary-indep
326 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch