Code

Merged branch 'experimental' into debmon-squeeze.
[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
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/java-6-openjdk
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" \
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 # libnetapp is required for the netapp plugin.
69 confflags += --disable-netapp
71 # libowcapi is required for the onewire plugin.
72 confflags += --disable-onewire
74 # libclntsh is required for the oracle plugin.
75 confflags += --disable-oracle
77 # libcredis is required for the *redis plugins.
78 confflags += --disable-redis --disable-write_redis
80 # librouteros is required for the routeros plugin.
81 confflags += --disable-routeros
83 # libmongoc is required for the write_mongodb plugin.
84 confflags += --disable-write_mongodb
86 # xmms1 is required for the xmms plugin.
87 confflags += --disable-xmms
89 # libkstat is required for the xfs_arc plugin.
90 confflags += --disable-zfs-arc
92 # build-deps for these plugins are not available on Squeeze
93 confflags += \
94                 --disable-amqp \
95                 --disable-modbus
97 # The static library netstat cannot be linked into shared objects on some
98 # architectures (see bugs #358637, #419684 and #524593 for more details).
99 ifneq (,$(filter alpha amd64 hppa ia64 ppc64 mips mipsel, $(DEB_BUILD_ARCH)))
100         confflags += --disable-netlink
101 else
102 # disable netlink on all archs, as the API in debian/stable is different
103         confflags += --disable-netlink
104 endif
106 # These plugins are Linux-specific.
107 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
108         confflags += \
109                 --disable-ethstat \
110                 --disable-iptables \
111                 --disable-ipvs \
112                 --disable-madwifi \
113                 --disable-md \
114                 --disable-netlink \
115                 --disable-numa \
116                 --disable-sensors \
117                 --disable-vserver
118 endif
120 # This plugin is FreeBSD-specific.
121 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
122         confflags += \
123                 --disable-pf
124 endif
126 # These plugins have not been ported to FreeBSD yet.
127 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
128         # Work-around an incomplete check for kvm functionality
129         CPPFLAGS  += -DHAVE_STRUCT_KINFO_PROC_FREEBSD
130         confflags += --enable-processes=force
132         confflags += \
133                 --disable-battery \
134                 --disable-conntrack \
135                 --disable-contextswitch \
136                 --disable-cpufreq \
137                 --disable-disk \
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-libvirt \
154                 --disable-tokyotyrant \
155                 --disable-java
156 endif
158 # The hppa buildds currently do not keep up with Java related stuff, thus
159 # prevending testing transitions.
160 ifneq (,$(filter hppa, $(DEB_BUILD_ARCH)))
161         confflags += --disable-java
162 endif
164 config.status: configure $(DPATCH_STAMPFN)
165         dh_testdir
166         
167         ( cd debian/patches/; for patch in *; do \
168                 if test "$$patch" != "00list"; then \
169                         grep "$$patch" 00list > /dev/null \
170                                 || ( echo "$$patch not enabled\!"; exit 1 ); \
171                 fi; done )
172         
173         # This is a work-around for #474087 (broken openipmi .pc files).
174         mkdir debian/pkgconfig
175         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
176                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
177                 > debian/pkgconfig/OpenIPMIpthread.pc
178         
179         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
180         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
181                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
182                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
183                 || ( status=$$?; cat config.log; exit $$status )
185 build: build-arch build-indep
186 build-arch: build-stamp
187 build-indep: build-stamp
189 build-stamp: config.status
190         dh_testdir
191         
192         $(MAKE)
193         perl ./debian/bin/check_plugins.pl
194         
195         touch build-stamp
197 clean: unpatch
198         dh_testdir
199         dh_testroot
200         rm -f build-stamp
201         
202         [ ! -f Makefile ] || $(MAKE) distclean
203         
204         rm -f debian/README.Debian.plugins
205         rm -f src/*.1 src/*.5
206         
207         rm -rf debian/pkgconfig
208         
209         dh_clean
210         debconf-updatepo
212 install-indep:
213         dh_testdir
214         dh_testroot
215         dh_clean -k
216         dh_installdirs -i
217         dh_install -i
219 install-arch: build
220         dh_testdir
221         dh_testroot
222         dh_clean -k
223         dh_installdirs -a
224         
225         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
226         
227         rm -f debian/tmp/usr/lib/collectd/*.la
228         rm -f debian/tmp/usr/lib/libcollectdclient.la
229         rm -f debian/tmp/etc/collectd.conf
230         
231         # this was broken by passing INSTALL_BASE rather than PREFIX to
232         # Makefile.PL
233         install -d -m 755 debian/tmp/usr/share/man/man3
234         mv debian/tmp/usr/man/man3/Collectd::Unixsock.3pm \
235                 debian/tmp/usr/share/man/man3/
236         install -d -m 755 debian/tmp/usr/share/
237         mv debian/tmp/usr/lib/perl5 debian/tmp/usr/share/
238         
239         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
240         
241         perl ./debian/bin/gen_plugin_deps.pl
242         
243         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
244         cp debian/collectd-core.overrides \
245                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
247 binary-indep: install-indep
248         dh_testdir
249         dh_testroot
250         dh_installchangelogs -i ChangeLog
251         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
252         dh_installexamples -i contrib/examples/myplugin.c \
253                 contrib/examples/MyPlugin.pm
254         dh_compress -i -Xexamples/
255         dh_fixperms -i
256         dh_installdeb -i
257         dh_gencontrol -i
258         dh_md5sums -i
259         dh_builddeb -i
261 binary-arch: build install-arch
262         dh_testdir
263         dh_testroot
264         dh_installchangelogs -a ChangeLog
265         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
266         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
267         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
268                 contrib/collection3/ contrib/php-collection/ \
269                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
270                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
271                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
272                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
273                 contrib/collectd_network.py contrib/collectd_unixsock.py \
274                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
275                 contrib/postgresql \
276                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
277         # some upstream tarballs have been built inside a dirty working dir
278         ( cd debian/collectd-core/ \
279                 && cd usr/share/doc/collectd-core/examples/collection3/ \
280                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
281                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
282                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
283                 && rm -f lib/Collectd/Graph/MetaData.pm )
284         dh_installdebconf -a
285         dh_installinit -pcollectd-core --name=collectd -- defaults 95
286         dh_link -a
287         dh_strip -a --dbg-package=collectd-dbg
288         dh_compress -a -Xexamples/
289         dh_fixperms -a
290         dh_makeshlibs -a
291         dh_installdeb -a
292         dh_shlibdeps -a -Ncollectd-core -Ncollectd
293         dpkg-shlibdeps -Tdebian/collectd.substvars \
294                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
295         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
296                 -dDepends debian/collectd-core/usr/sbin/* \
297                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
298         grep shlibs:Suggests debian/collectd-core.substvars \
299                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
300                 >> debian/collectd.substvars
301         dh_gencontrol -a
302         dh_md5sums -a
303         dh_builddeb -a
305 binary: binary-arch binary-indep
306 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch