329609682d32796d2a83f04c7113f3efd764c18a
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 = alpha=alpha arm=arm armel=arm amd64=amd64 hppa=parisc \
37 i386=i386 lpia=i386 m68k=m68k mips=mips mipsel=mipsel \
38 powerpc=ppc sparc=sparc s390=s390 ia64=ia64
39 JAVA_ARCHDIR = $(strip $(patsubst $(DEB_BUILD_ARCH)=%, %, \
40 $(filter $(DEB_BUILD_ARCH)=%, $(JAVA_ARCHDIR_MAP))))
41 JAVA_HOME = /usr/lib/jvm/java-6-openjdk
42 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
44 JAVAC = $(JAVA_HOME)/bin/javac
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 --enable-all-plugins
58 # These plugins do not provide any functionality under Linux.
59 confflags += --disable-apple_sensors --disable-tape
61 # libowcapi is required for the onewire plugin.
62 confflags += --disable-onewire
64 # libclntsh is required for the oracle plugin.
65 confflags += --disable-oracle
67 # rrdclient support in librrd is required for the rrdcached plugin.
68 confflags += --disable-rrdcached
70 # libtokyotyrant is required for the tokyotyrant plugin.
71 confflags += --disable-tokyotyrant
73 # xmms1 is required for the xmms plugin.
74 confflags += --disable-xmms
76 # libkstat is required for the xfs_arc plugin.
77 confflags += --disable-zfs-arc
79 # The static library netstat cannot be linked into shared objects on some
80 # architectures (see bugs #358637, #419684 and #524593 for more details).
81 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64 mips mipsel))
82 confflags += --disable-netlink
83 endif
85 # The hppa buildds currently do not keep up with Java related stuff, thus
86 # prevending testing transitions.
87 ifneq (,$(findstring $(DEB_BUILD_ARCH),hppa))
88 confflags += --disable-java
89 endif
91 config.status: configure $(DPATCH_STAMPFN)
92 dh_testdir
94 # This is a work-around for #474087 (broken openipmi .pc files).
95 mkdir debian/pkgconfig
96 sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
97 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
98 > debian/pkgconfig/OpenIPMIpthread.pc
100 PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
101 ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
102 JAVAC="$(JAVAC)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
103 JAVA_LDFLAGS="$(JAVA_LDFLAGS)"
105 build: build-stamp
107 build-stamp: config.status
108 dh_testdir
110 $(MAKE)
111 perl ./debian/bin/check_plugins.pl
113 touch build-stamp
115 clean: unpatch
116 dh_testdir
117 dh_testroot
118 rm -f build-stamp
120 [ ! -f Makefile ] || $(MAKE) distclean
122 rm -f debian/README.Debian.plugins
123 rm -f src/*.1 src/*.5
125 rm -rf debian/pkgconfig
127 dh_clean
128 debconf-updatepo
130 install-indep:
131 dh_testdir
132 dh_testroot
133 dh_clean -k
134 dh_installdirs -i
135 dh_install -i
137 install-arch: build
138 dh_testdir
139 dh_testroot
140 dh_clean -k
141 dh_installdirs -a
143 $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
145 rm -f debian/tmp/usr/lib/collectd/*.la
146 rm -f debian/tmp/usr/lib/libcollectdclient.la
147 rm -f debian/tmp/etc/collectd.conf
149 dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
151 perl ./debian/bin/gen_plugin_deps.pl
153 mkdir -p debian/collectd/usr/share/lintian/overrides/
154 cp debian/collectd.overrides \
155 debian/collectd/usr/share/lintian/overrides/collectd
157 binary-indep: install-indep
158 dh_testdir
159 dh_testroot
160 dh_installchangelogs -i ChangeLog
161 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
162 dh_installexamples -i contrib/examples/myplugin.c \
163 contrib/examples/MyPlugin.pm
164 dh_compress -i -Xexamples/
165 dh_fixperms -i
166 dh_installdeb -i
167 dh_gencontrol -i
168 dh_md5sums -i
169 dh_builddeb -i
171 binary-arch: build install-arch
172 dh_testdir
173 dh_testroot
174 dh_installchangelogs -a ChangeLog
175 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
176 dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
177 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
178 contrib/collection3/ contrib/php-collection/ \
179 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
180 contrib/exec-nagios.conf contrib/exec-nagios.px \
181 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
182 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
183 contrib/collectd-network.py contrib/collectd-unixsock.py \
184 contrib/snmp-probe-host.px contrib/GenericJMX.conf
185 # some upstream tarballs have been built inside a dirty working dir
186 ( cd debian/collectd/usr/share/doc/collectd/examples/collection3/ \
187 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
188 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
189 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
190 && rm -f lib/Collectd/Graph/MetaData.pm )
191 dh_installdebconf -a
192 dh_installinit -a -- defaults 95
193 dh_link -a
194 dh_strip -a --dbg-package=collectd-dbg
195 dh_compress -a -Xexamples/
196 dh_fixperms -a
197 dh_makeshlibs -a
198 dh_installdeb -a
199 dpkg-shlibdeps -Tdebian/collectd.substvars \
200 -dDepends debian/collectd/usr/sbin/* \
201 debian/collectd/usr/lib/collectd/rrdtool.so \
202 -dRecommends debian/collectd/usr/lib/collectd/*.so
203 dh_shlibdeps -a -Ncollectd
204 dh_gencontrol -a
205 dh_md5sums -a
206 dh_builddeb -a
208 binary: binary-arch binary-indep
209 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch