Code

Merged branch 'v5.4.1'.
[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 # 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 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 include /usr/share/dpatch/dpatch.make
50 confflags = --host=$(DEB_HOST_GNU_TYPE) \
51                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
52                         --mandir=\$${prefix}/share/man \
53                         --localstatedir=/var --sysconfdir=/etc \
54                         --with-perl-bindings="INSTALLDIRS=vendor INSTALL_BASE=" \
55                         --without-libstatgrab \
56                         --without-included-ltdl \
57                         --disable-static \
58                         --enable-all-plugins
60 # These plugins do not provide any functionality under Linux.
61 # MacOS only (requires IO Kit):
62 confflags += --disable-apple_sensors
63 # AIX only (requires perfstat):
64 confflags += --disable-lpar
65 # Solaris only (requires devinfo and kstat)
66 confflags += --disable-tape
68 # libaquaero5 is required for the aquaero plugin
69 confflags += --disable-aquaero
71 # libmic is required for the mic plugin
72 confflags += --disable-mic
74 # libnetapp is required for the netapp plugin.
75 confflags += --disable-netapp
77 # libclntsh is required for the oracle plugin.
78 confflags += --disable-oracle
80 # libcredis is required for the *redis plugins.
81 confflags += --disable-redis --disable-write_redis
83 # librouteros is required for the routeros plugin.
84 confflags += --disable-routeros
86 # libsigrok >= 0.2.0 is required for the sigrok plugin, should arrive in unstable soon
87 confflags += --disable-sigrok
89 # varnish does not currently work with varnish4
90 # (c.f. https://bugs.debian.org/745902)
91 confflags += --disable-varnish
93 # libmongoc is required for the write_mongodb plugin.
94 confflags += --disable-write_mongodb
96 # xmms1 is required for the xmms plugin.
97 confflags += --disable-xmms
99 # libkstat is required for the xfs_arc plugin.
100 confflags += --disable-zfs-arc
102 # These plugins are Linux-specific.
103 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
104         confflags += \
105                 --disable-cgroups \
106                 --disable-ethstat \
107                 --disable-iptables \
108                 --disable-ipvs \
109                 --disable-lvm \
110                 --disable-madwifi \
111                 --disable-md \
112                 --disable-netlink \
113                 --disable-numa \
114                 --disable-sensors \
115                 --disable-vserver
116 endif
118 # This plugin is FreeBSD-specific.
119 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
120         confflags += \
121                 --disable-pf
122 endif
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-disk \
136                 --disable-entropy \
137                 --disable-fscache \
138                 --disable-irq \
139                 --disable-nfs \
140                 --disable-protocols \
141                 --disable-serial \
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-libvirt \
152                 --disable-tokyotyrant \
153                 --disable-java
154 endif
156 # The hppa buildds currently do not keep up with Java related stuff, thus
157 # prevending testing transitions.
158 ifneq (,$(filter hppa, $(DEB_BUILD_ARCH)))
159         confflags += --disable-java
160 endif
162 config.status: configure $(DPATCH_STAMPFN)
163         dh_testdir
164         
165         ( cd debian/patches/; for patch in *; do \
166                 if test "$$patch" != "00list"; then \
167                         grep "$$patch" 00list > /dev/null \
168                                 || ( echo "$$patch not enabled\!"; exit 1 ); \
169                 fi; done )
170         
171         # This is a work-around for #474087 (broken openipmi .pc files).
172         mkdir debian/pkgconfig
173         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
174                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
175                 > debian/pkgconfig/OpenIPMIpthread.pc
176         
177         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
178         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
179                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
180                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
181                 || ( status=$$?; cat config.log; exit $$status )
183 build: build-arch build-indep
184 build-arch: build-stamp
185 build-indep: build-stamp
187 build-stamp: config.status
188         dh_testdir
189         
190         $(MAKE)
191         perl ./debian/bin/check_plugins.pl
192         
193         touch build-stamp
195 clean: unpatch
196         dh_testdir
197         dh_testroot
198         rm -f build-stamp
199         
200         [ ! -f Makefile ] || $(MAKE) distclean
201         
202         rm -f debian/README.Debian.plugins
203         rm -f src/*.1 src/*.5
204         
205         rm -rf debian/pkgconfig
206         
207         dh_clean
208         debconf-updatepo
210 install-indep:
211         dh_testdir
212         dh_testroot
213         dh_clean -k
214         dh_installdirs -i
215         dh_install -i
216         
217         # update include path for collectd header files
218         sed -r -i -e 's/include "(.*)"/include "collectd\/core\/\1"/' \
219                 $(CURDIR)/debian/collectd-dev/usr/include/collectd/core/*
220         sed -r -i -e 's/"collectd\/core\/(liboconfig\/.*)"/"collectd\/\1"/' \
221                 $(CURDIR)/debian/collectd-dev/usr/include/collectd/core/*
223 install-arch: build
224         dh_testdir
225         dh_testroot
226         dh_clean -k
227         dh_installdirs -a
228         
229         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
230         
231         rm -f debian/tmp/usr/lib/collectd/*.la
232         rm -f debian/tmp/usr/lib/libcollectdclient.la
233         rm -f debian/tmp/etc/collectd.conf
234         
235         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
236         
237         perl ./debian/bin/gen_plugin_deps.pl
238         
239         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
240         cp debian/collectd-core.overrides \
241                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
243 binary-indep: install-indep
244         dh_testdir
245         dh_testroot
246         dh_installchangelogs -i ChangeLog
247         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
248         dh_installexamples -i contrib/examples/myplugin.c \
249                 contrib/examples/MyPlugin.pm
250         dh_compress -i -Xexamples/
251         dh_fixperms -i
252         dh_installdeb -i
253         dh_gencontrol -i
254         dh_md5sums -i
255         dh_builddeb -i
257 binary-arch: build install-arch
258         dh_testdir
259         dh_testroot
260         dh_installchangelogs -a ChangeLog
261         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
262         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
263         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
264                 contrib/collection3/ contrib/php-collection/ \
265                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
266                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
267                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
268                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
269                 contrib/collectd_network.py contrib/collectd_unixsock.py \
270                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
271                 contrib/postgresql \
272                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
273         # some upstream tarballs have been built inside a dirty working dir
274         ( cd debian/collectd-core/ \
275                 && cd usr/share/doc/collectd-core/examples/collection3/ \
276                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
277                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
278                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
279                 && rm -f lib/Collectd/Graph/MetaData.pm )
280         dh_installdebconf -a
281         dh_installinit -pcollectd-core --name=collectd -- defaults 95
282         dh_link -a
283         dh_strip -a --dbg-package=collectd-dbg
284         dh_compress -a -Xexamples/
285         dh_fixperms -a
286         dh_makeshlibs -a
287         dh_installdeb -a
288         dh_shlibdeps -a -Ncollectd-core -Ncollectd
289         dpkg-shlibdeps -Tdebian/collectd.substvars \
290                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
291         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
292                 -dDepends debian/collectd-core/usr/sbin/* \
293                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
294         grep shlibs:Suggests debian/collectd-core.substvars \
295                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
296                 >> debian/collectd.substvars
297         dh_gencontrol -a
298         dh_md5sums -a
299         dh_builddeb -a
301 binary: binary-arch binary-indep
302 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch