Code

control, rules: Enabled the "tokyotyrant" 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 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 (,$(findstring 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
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 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
47 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
49 include /usr/share/dpatch/dpatch.make
51 confflags = --host=$(DEB_HOST_GNU_TYPE) \
52                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
53                         --mandir=\$${prefix}/share/man \
54                         --localstatedir=/var --sysconfdir=/etc \
55                         --with-perl-bindings="INSTALLDIRS=vendor" \
56                         --without-libstatgrab \
57                         --without-included-ltdl \
58                         --disable-static \
59                         --enable-all-plugins
61 # These plugins do not provide any functionality under Linux.
62 confflags += --disable-apple_sensors --disable-tape
64 # libnetapp is required for the netapp plugin.
65 confflags += --disable-netapp
67 # libowcapi is required for the onewire plugin.
68 confflags += --disable-onewire
70 # libclntsh is required for the oracle plugin.
71 confflags += --disable-oracle
73 # librouteros is required for the routeros plugin.
74 confflags += --disable-routeros
76 # xmms1 is required for the xmms plugin.
77 confflags += --disable-xmms
79 # libkstat is required for the xfs_arc plugin.
80 confflags += --disable-zfs-arc
82 # The static library netstat cannot be linked into shared objects on some
83 # architectures (see bugs #358637, #419684 and #524593 for more details).
84 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64 mips mipsel))
85         confflags += --disable-netlink
86 endif
88 # These plugins are Linux-specific.
89 ifneq (,$(findstring $(DEB_BUILD_ARCH),kfreebsd-i386 kfreebsd-amd64))
90         confflags += \
91                 --disable-iptables \
92                 --disable-ipvs \
93                 --disable-netlink \
94                 --disable-sensors
95 endif
97 # These plugins have not been ported to FreeBSD yet.
98 ifneq (,$(findstring $(DEB_BUILD_ARCH),kfreebsd-i386 kfreebsd-amd64))
99         confflags += \
100                 --disable-battery \
101                 --disable-conntrack \
102                 --disable-contextswitch \
103                 --disable-cpufreq \
104                 --disable-disk \
105                 --disable-entropy \
106                 --disable-fscache \
107                 --disable-irq \
108                 --disable-madwifi \
109                 --disable-nfs \
110                 --disable-protocols \
111                 --disable-serial \
112                 --disable-thermal \
113                 --disable-vmem \
114                 --disable-vserver \
115                 --disable-wireless
116 endif
118 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
119 ifneq (,$(findstring $(DEB_BUILD_ARCH),kfreebsd-i386 kfreebsd-amd64))
120         confflags += \
121                 --disable-gmond \
122                 --disable-libvirt \
123                 --disable-tokyotyrant \
124                 --disable-java
125 endif
127 # The hppa buildds currently do not keep up with Java related stuff, thus
128 # prevending testing transitions.
129 ifneq (,$(findstring $(DEB_BUILD_ARCH),hppa))
130         confflags += --disable-java
131 endif
133 config.status: configure $(DPATCH_STAMPFN)
134         dh_testdir
135         
136         # This is a work-around for #474087 (broken openipmi .pc files).
137         mkdir debian/pkgconfig
138         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
139                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
140                 > debian/pkgconfig/OpenIPMIpthread.pc
141         
142         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
143         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
144                 JAVAC="$(JAVAC)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
145                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
146                 || ( status=$$?; cat config.log; exit $$status )
148 build: build-stamp
150 build-stamp: config.status
151         dh_testdir
152         
153         $(MAKE)
154         perl ./debian/bin/check_plugins.pl
155         
156         touch build-stamp
158 clean: unpatch
159         dh_testdir
160         dh_testroot
161         rm -f build-stamp
162         
163         [ ! -f Makefile ] || $(MAKE) distclean
164         
165         rm -f debian/README.Debian.plugins
166         rm -f src/*.1 src/*.5
167         
168         rm -rf debian/pkgconfig
169         
170         dh_clean
171         debconf-updatepo
173 install-indep:
174         dh_testdir
175         dh_testroot
176         dh_clean -k
177         dh_installdirs -i
178         dh_install -i
180 install-arch: build
181         dh_testdir
182         dh_testroot
183         dh_clean -k
184         dh_installdirs -a
185         
186         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
187         
188         rm -f debian/tmp/usr/lib/collectd/*.la
189         rm -f debian/tmp/usr/lib/libcollectdclient.la
190         rm -f debian/tmp/etc/collectd.conf
191         
192         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
193         
194         perl ./debian/bin/gen_plugin_deps.pl
195         
196         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
197         cp debian/collectd-core.overrides \
198                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
200 binary-indep: install-indep
201         dh_testdir
202         dh_testroot
203         dh_installchangelogs -i ChangeLog
204         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
205         dh_installexamples -i contrib/examples/myplugin.c \
206                 contrib/examples/MyPlugin.pm
207         dh_compress -i -Xexamples/
208         dh_fixperms -i
209         dh_installdeb -i
210         dh_gencontrol -i
211         dh_md5sums -i
212         dh_builddeb -i
214 binary-arch: build install-arch
215         dh_testdir
216         dh_testroot
217         dh_installchangelogs -a ChangeLog
218         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
219         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
220         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
221                 contrib/collection3/ contrib/php-collection/ \
222                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
223                 contrib/exec-nagios.conf contrib/exec-nagios.px \
224                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
225                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
226                 contrib/collectd_network.py contrib/collectd_unixsock.py \
227                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
228                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
229         # some upstream tarballs have been built inside a dirty working dir
230         ( cd debian/collectd-core/ \
231                 && cd usr/share/doc/collectd-core/examples/collection3/ \
232                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
233                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
234                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
235                 && rm -f lib/Collectd/Graph/MetaData.pm )
236         dh_installdebconf -a
237         dh_installinit -pcollectd-core --name=collectd -- defaults 95
238         dh_link -a
239         dh_strip -a --dbg-package=collectd-dbg
240         dh_compress -a -Xexamples/
241         dh_fixperms -a
242         dh_makeshlibs -a
243         dh_installdeb -a
244         dh_shlibdeps -a -Ncollectd-core -Ncollectd
245         dpkg-shlibdeps -Tdebian/collectd.substvars \
246                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
247         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
248                 -dDepends debian/collectd-core/usr/sbin/* \
249                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
250         grep shlibs:Suggests debian/collectd-core.substvars \
251                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
252                 >> debian/collectd.substvars
253         dh_gencontrol -a
254         dh_md5sums -a
255         dh_builddeb -a
257 binary: binary-arch binary-indep
258 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch