Code

disable smart plugin on non-linux platforms
[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 -Wno-error=deprecated-declarations
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 # A PostgreSQL header redefines CACHE_LINE_SIZE on FreeBSD.
34 # Cf. https://bugs.debian.org/760719 and https://bugs.debian.org/763098
35 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
36         CPPFLAGS += -Wp,-w
37 endif
39 LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
41 # The archdir map has been copied from openjdk-6's debian/rules.
42 JAVA_ARCHDIR = $(shell /usr/share/javahelper/java-arch.sh $(DEB_BUILD_ARCH))
43 ifeq (,$(JAVA_ARCHDIR))
44         JAVA_ARCHDIR = $(DEB_BUILD_ARCH)
45 endif
46 JAVA_HOME = /usr/lib/jvm/default-java
47 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
49 JAVAC = $(JAVA_HOME)/bin/javac
50 JAR = $(JAVA_HOME)/bin/jar
51 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
52 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
54 confflags = --host=$(DEB_HOST_GNU_TYPE) \
55                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
56                         --mandir=\$${prefix}/share/man \
57                         --localstatedir=/var --sysconfdir=/etc \
58                         --with-perl-bindings="INSTALLDIRS=vendor INSTALL_BASE=" \
59                         --without-libstatgrab \
60                         --without-included-ltdl \
61                         --disable-static \
62                         --disable-silent-rules \
63                         --enable-all-plugins
65 # These plugins do not provide any functionality under Linux.
66 # MacOS only (requires IO Kit):
67 confflags += --disable-apple_sensors
68 # AIX only (requires perfstat):
69 confflags += --disable-lpar
70 # Solaris only (requires devinfo and kstat)
71 confflags += --disable-tape
73 # libaquaero5 is required for the aquaero plugin
74 confflags += --disable-aquaero
76 # libmic is required for the mic plugin
77 confflags += --disable-mic
79 # libnetapp is required for the netapp plugin.
80 confflags += --disable-netapp
82 # libclntsh is required for the oracle plugin.
83 confflags += --disable-oracle
85 # librouteros is required for the routeros plugin.
86 confflags += --disable-routeros
88 # libmongoc is required for the write_mongodb plugin.
89 confflags += --disable-write_mongodb
91 # xmms1 is required for the xmms plugin.
92 confflags += --disable-xmms
94 # These plugins are Linux-specific.
95 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
96         confflags += \
97                 --disable-cgroups \
98                 --disable-ethstat \
99                 --disable-iptables \
100                 --disable-ipvs \
101                 --disable-lvm \
102                 --disable-madwifi \
103                 --disable-md \
104                 --disable-netlink \
105                 --disable-numa \
106                 --disable-sensors \
107                 --disable-vserver
108 endif
110 # This plugin is FreeBSD-specific.
111 ifeq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
112         confflags += \
113                 --disable-pf
114 endif
116 # These plugins have not been ported to FreeBSD yet.
117 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
118         # Work-around an incomplete check for kvm functionality
119         CPPFLAGS  += -DHAVE_STRUCT_KINFO_PROC_FREEBSD
120         confflags += --enable-processes=force
122         confflags += \
123                 --disable-battery \
124                 --disable-conntrack \
125                 --disable-contextswitch \
126                 --disable-cpufreq \
127                 --disable-disk \
128                 --disable-entropy \
129                 --disable-fscache \
130                 --disable-irq \
131                 --disable-nfs \
132                 --disable-protocols \
133                 --disable-serial \
134                 --disable-thermal \
135                 --disable-vmem \
136                 --disable-wireless
137 endif
139 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
140 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
141         confflags += \
142                 --disable-gmond \
143                 --disable-virt \
144                 --disable-tokyotyrant \
145                 --disable-java
146 endif
148 # This plugin is Intel-hardware specific.
149 ifeq (,$(filter amd64 i386, $(DEB_BUILD_ARCH)))
150         confflags += \
151                 --disable-turbostat
152 endif
154 # libatasmart isn't available on these platforms.
155 ifneq (,$(filter hurd-i386 kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
156         confflags += --disable-smart
157 endif
159 # The hppa buildds currently do not keep up with Java related stuff, thus
160 # prevending testing transitions. sparc is also having trouble building the
161 # java plugin.
162 ifneq (,$(filter hppa sparc, $(DEB_BUILD_ARCH)))
163         confflags += --disable-java
164 endif
166 config.status: configure
167         dh_testdir
168         
169         # This is a work-around for #474087 (broken openipmi .pc files).
170         mkdir debian/pkgconfig
171         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
172                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
173                 > debian/pkgconfig/OpenIPMIpthread.pc
174         
175         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
176         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
177                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
178                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
179                 || ( status=$$?; cat config.log; exit $$status )
181 build: build-arch build-indep
182 build-arch: build-stamp
183 build-indep: build-stamp
185 build-stamp: config.status
186         dh_testdir
187         
188         $(MAKE)
189         perl ./debian/bin/check_plugins.pl
190         
191         touch build-stamp
193 clean:
194         dh_testdir
195         dh_testroot
196         rm -f build-stamp
197         
198         [ ! -f Makefile ] || $(MAKE) distclean
199         
200         rm -f debian/README.Debian.plugins
201         rm -f src/*.1 src/*.5
202         
203         rm -rf debian/pkgconfig
204         
205         dh_clean
206         debconf-updatepo
208 install-indep:
209         dh_testdir
210         dh_testroot
211         dh_clean -k
212         dh_installdirs -i
213         dh_install -i
214         
215         # update include path for collectd header files
216         (       set -e; \
217                 cd $(CURDIR)/debian/collectd-dev/usr/include/collectd/; \
218                 for lib in $$(find . -type f -name '*.h'); do \
219                         libname=$$(basename $$lib); \
220                         fullpath=$$(echo $$lib | sed -r -e 's,^\./,collectd/,'); \
221                         for dir in $$(find . -mindepth 1 -type d); do \
222                                 sed -r -i -e "s,(include\s+)\".*$$libname\",\1\"$$fullpath\"," $$dir/*.h; \
223                         done; \
224                 done )
226 install-arch: build
227         dh_testdir
228         dh_testroot
229         dh_clean -k
230         dh_installdirs -a
231         
232         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
233         
234         rm -f debian/tmp/usr/lib/collectd/*.la
235         rm -f debian/tmp/usr/lib/libcollectdclient.la
236         rm -f debian/tmp/etc/collectd.conf
237         
238         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
239         
240         perl ./debian/bin/gen_plugin_deps.pl
241         
242         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
243         cp debian/collectd-core.overrides \
244                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
246 binary-indep: install-indep
247         dh_testdir
248         dh_testroot
249         dh_installchangelogs -i ChangeLog
250         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
251         dh_installexamples -i contrib/examples/myplugin.c \
252                 contrib/examples/MyPlugin.pm
253         dh_compress -i -Xexamples/
254         dh_fixperms -i
255         dh_installdeb -i
256         dh_gencontrol -i
257         dh_md5sums -i
258         dh_builddeb -i
260 binary-arch: build install-arch
261         dh_testdir
262         dh_testroot
263         dh_installchangelogs -a ChangeLog
264         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
265         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
266         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
267                 contrib/collection3/ contrib/php-collection/ \
268                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
269                 contrib/exec-nagios.conf contrib/exec-nagios.px contrib/exec-ksm.sh \
270                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
271                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
272                 contrib/collectd_network.py contrib/collectd_unixsock.py \
273                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
274                 contrib/postgresql \
275                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
276         # some upstream tarballs have been built inside a dirty working dir
277         ( cd debian/collectd-core/ \
278                 && cd usr/share/doc/collectd-core/examples/collection3/ \
279                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
280                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
281                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
282                 && rm -f lib/Collectd/Graph/MetaData.pm )
283         dh_installdebconf -a
284         dh_systemd_enable -pcollectd-core --name=collectd collectd.service
285         dh_installinit -pcollectd-core --name=collectd -- defaults 95
286         dh_systemd_start
287         dh_link -a
288         dh_strip -a --dbg-package=collectd-dbg
289         dh_compress -a -Xexamples/
290         dh_fixperms -a
291         dh_makeshlibs -a
292         dh_installdeb -a
293         dh_shlibdeps -a -Ncollectd-core -Ncollectd
294         dpkg-shlibdeps -Tdebian/collectd.substvars \
295                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
296         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
297                 -dDepends debian/collectd-core/usr/sbin/* \
298                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
299         grep shlibs:Suggests debian/collectd-core.substvars \
300                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
301                 >> debian/collectd.substvars
302         dh_gencontrol -a
303         dh_md5sums -a
304         dh_builddeb -a
306 binary: binary-arch binary-indep
307 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch