Code

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