Code

Merged branch 'squeeze' into lenny-backports.
[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 CPPFLAGS = -I$(CURDIR)/debian/include
16 CFLAGS = -Wall -g
18 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
19 # however required by the perl plugin (which would otherwise be unable to find
20 # symbols defined in libperl when loading perl modules that require such
21 # symbols). This is a workaround for this issue.
22 CPPFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
24 # Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to
25 # /etc/collectd would be wrong though.
26 CPPFLAGS += -UCONFIGFILE
27 CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"'
29 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
30         CFLAGS += -O0
31 else
32         CFLAGS += -O2
33 endif
35 # The archdir map has been copied from openjdk-6's debian/rules.
36 JAVA_ARCHDIR_MAP = armel=arm hppa=parisc lpia=i386 powerpc=ppc powerpcspe=ppc sh4=sh
37 JAVA_ARCHDIR = $(strip $(patsubst $(DEB_BUILD_ARCH)=%, %, \
38                         $(filter $(DEB_BUILD_ARCH)=%, $(JAVA_ARCHDIR_MAP))))
39 ifeq (,$(JAVA_ARCHDIR))
40         JAVA_ARCHDIR = $(DEB_BUILD_ARCH)
41 endif
42 JAVA_HOME = /usr/lib/jvm/java-6-openjdk
43 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
45 JAVAC = $(JAVA_HOME)/bin/javac
46 JAR = $(JAVA_HOME)/bin/jar
47 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
48 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
50 include /usr/share/dpatch/dpatch.make
52 confflags = --host=$(DEB_HOST_GNU_TYPE) \
53                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
54                         --mandir=\$${prefix}/share/man \
55                         --localstatedir=/var --sysconfdir=/etc \
56                         --with-perl-bindings="INSTALLDIRS=vendor" \
57                         --without-libstatgrab \
58                         --without-included-ltdl \
59                         --disable-static \
60                         --enable-all-plugins
62 # These plugins do not provide any functionality under Linux.
63 confflags += --disable-apple_sensors --disable-tape
65 # libyajl is required for the curl_json plugin.
66 confflags += --disable-curl_json
68 # libganglia >= 3 is required for the gmond plugin.
69 confflags += --disable-gmond
71 # libmemcached is required for the memcachec plugin.
72 confflags += --disable-memcachec
74 # libmodbus is required for the modbus plugin.
75 confflags += --disable-modbus
77 # libnetapp is required for the netapp plugin.
78 confflags += --disable-netapp
80 # libowcapi is required for the onewire plugin.
81 confflags += --disable-onewire
83 # libclntsh is required for the oracle plugin.
84 confflags += --disable-oracle
86 # protobuf is required for the pinba plugin.
87 confflags += --disable-pinba
89 # librouteros is required for the routeros plugin.
90 confflags += --disable-routeros
92 # libtokyotyrant is required for the tokyotyrant plugin.
93 confflags += --disable-tokyotyrant
95 # xmms1 is required for the xmms plugin.
96 confflags += --disable-xmms
98 # libkstat is required for the xfs_arc plugin.
99 confflags += --disable-zfs-arc
101 # The static library netstat cannot be linked into shared objects on some
102 # architectures (see bugs #358637, #419684 and #524593 for more details).
103 ifneq (,$(filter alpha amd64 hppa ia64 ppc64 mips mipsel, $(DEB_BUILD_ARCH)))
104         confflags += --disable-netlink
105 endif
107 # These plugins are Linux-specific.
108 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
109         confflags += \
110                 --disable-iptables \
111                 --disable-ipvs \
112                 --disable-madwifi \
113                 --disable-netlink \
114                 --disable-sensors \
115                 --disable-vserver
116 endif
118 # These plugins have not been ported to FreeBSD yet.
119 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
120         confflags += \
121                 --disable-battery \
122                 --disable-conntrack \
123                 --disable-contextswitch \
124                 --disable-cpufreq \
125                 --disable-disk \
126                 --disable-entropy \
127                 --disable-fscache \
128                 --disable-irq \
129                 --disable-nfs \
130                 --disable-protocols \
131                 --disable-serial \
132                 --disable-thermal \
133                 --disable-vmem \
134                 --disable-wireless
135 endif
137 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
138 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
139         confflags += \
140                 --disable-gmond \
141                 --disable-libvirt \
142                 --disable-tokyotyrant \
143                 --disable-java
144 endif
146 # The hppa buildds currently do not keep up with Java related stuff, thus
147 # prevending testing transitions.
148 ifneq (,$(filter hppa, $(DEB_BUILD_ARCH)))
149         confflags += --disable-java
150 endif
152 config.status: configure $(DPATCH_STAMPFN)
153         dh_testdir
154         
155         ( cd debian/patches/; for patch in *; do \
156                 if test "$$patch" != "00list"; then \
157                         grep "$$patch" 00list > /dev/null \
158                                 || ( echo "$$patch not enabled\!"; exit 1 ); \
159                 fi; done )
160         
161         # This is a work-around for #474087 (broken openipmi .pc files).
162         mkdir debian/pkgconfig
163         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
164                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
165                 > debian/pkgconfig/OpenIPMIpthread.pc
166         
167         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
168         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
169                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
170                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
171                 || ( status=$$?; cat config.log; exit $$status )
173 build: build-stamp
175 build-stamp: config.status
176         dh_testdir
177         
178         $(MAKE)
179         perl ./debian/bin/check_plugins.pl
180         
181         touch build-stamp
183 clean: unpatch
184         dh_testdir
185         dh_testroot
186         rm -f build-stamp
187         
188         [ ! -f Makefile ] || $(MAKE) distclean
189         
190         rm -f debian/README.Debian.plugins
191         rm -f src/*.1 src/*.5
192         
193         rm -rf debian/pkgconfig
194         
195         dh_clean
196         debconf-updatepo
198 install-indep:
199         dh_testdir
200         dh_testroot
201         dh_clean -k
202         dh_installdirs -i
203         dh_install -i
205 install-arch: build
206         dh_testdir
207         dh_testroot
208         dh_clean -k
209         dh_installdirs -a
210         
211         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
212         
213         rm -f debian/tmp/usr/lib/collectd/*.la
214         rm -f debian/tmp/usr/lib/libcollectdclient.la
215         rm -f debian/tmp/etc/collectd.conf
216         
217         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
218         
219         perl ./debian/bin/gen_plugin_deps.pl
220         
221         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
222         cp debian/collectd-core.overrides \
223                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
225 binary-indep: install-indep
226         dh_testdir
227         dh_testroot
228         dh_installchangelogs -i ChangeLog
229         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
230         dh_installexamples -i contrib/examples/myplugin.c \
231                 contrib/examples/MyPlugin.pm
232         dh_compress -i -Xexamples/
233         dh_fixperms -i
234         dh_installdeb -i
235         dh_gencontrol -i
236         dh_md5sums -i
237         dh_builddeb -i
239 binary-arch: build install-arch
240         dh_testdir
241         dh_testroot
242         dh_installchangelogs -a ChangeLog
243         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
244         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
245         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
246                 contrib/collection3/ contrib/php-collection/ \
247                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
248                 contrib/exec-nagios.conf contrib/exec-nagios.px \
249                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
250                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
251                 contrib/collectd_network.py contrib/collectd_unixsock.py \
252                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
253                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
254         # some upstream tarballs have been built inside a dirty working dir
255         ( cd debian/collectd-core/ \
256                 && cd usr/share/doc/collectd-core/examples/collection3/ \
257                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
258                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
259                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
260                 && rm -f lib/Collectd/Graph/MetaData.pm )
261         dh_installdebconf -a
262         dh_installinit -pcollectd-core --name=collectd -- defaults 95
263         dh_link -a
264         dh_strip -a --dbg-package=collectd-dbg
265         dh_compress -a -Xexamples/
266         dh_fixperms -a
267         dh_makeshlibs -a
268         dh_installdeb -a
269         dh_shlibdeps -a -Ncollectd-core -Ncollectd
270         dpkg-shlibdeps -Tdebian/collectd.substvars \
271                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
272         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
273                 -dDepends debian/collectd-core/usr/sbin/* \
274                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
275         grep shlibs:Suggests debian/collectd-core.substvars \
276                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
277                 >> debian/collectd.substvars
278         dh_gencontrol -a
279         dh_md5sums -a
280         dh_builddeb -a
282 binary: binary-arch binary-indep
283 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch