Code

rules: Pass --enable-all-plugins to configure.
[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 = 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
43 JAVAC = $(JAVA_HOME)/bin/javac
44 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
45 JAVA_LDFLAGS = -L$(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
47 include /usr/share/dpatch/dpatch.make
49 confflags = --host=$(DEB_HOST_GNU_TYPE) \
50                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
51                         --mandir=\$${prefix}/share/man \
52                         --localstatedir=/var --sysconfdir=/etc \
53                         --with-perl-bindings="INSTALLDIRS=vendor" \
54                         --without-libstatgrab \
55                         --enable-all-plugins
57 # These plugins do not provide any functionality under Linux.
58 confflags += --disable-apple_sensors --disable-tape
60 # libganglia >= 3 is required for the gmond plugin.
61 confflags += --disable-gmond
63 # libowcapi is required for the onewire plugin.
64 confflags += --disable-onewire
66 # libclntsh is required for the oracle plugin.
67 confflags += --disable-oracle
69 # rrdclient support in librrd is required for the rrdcached plugin.
70 confflags += --disable-rrdcached
72 # xmms1 is required for the xmms plugin.
73 confflags += --disable-xmms
75 # The static library netstat cannot be linked into shared objects on some
76 # architectures (see bugs #358637, #419684 and #524593 for more details).
77 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64 mips mipsel))
78         confflags += --disable-netlink
79 endif
81 # libvirt is only available on amd64, i386 and powerpc.
82 ifeq (,$(findstring $(DEB_BUILD_ARCH),amd64 i386 powerpc))
83         confflags += --disable-libvirt
84 endif
86 config.status: configure $(DPATCH_STAMPFN)
87         dh_testdir
88         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" \
89                 JAVAC="$(JAVAC)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
90                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)"
92 build: build-stamp
94 build-stamp: config.status
95         dh_testdir
96         
97         $(MAKE)
98         perl ./debian/bin/check_plugins.pl
99         
100         touch build-stamp
102 clean: unpatch
103         dh_testdir
104         dh_testroot
105         rm -f build-stamp
106         
107         [ ! -f Makefile ] || $(MAKE) distclean
108         
109         rm -f debian/README.Debian.plugins
110         rm -f src/*.1 src/*.5
111         
112         dh_clean
113         debconf-updatepo
115 install-indep:
116         dh_testdir
117         dh_testroot
118         dh_clean -k
119         dh_installdirs -i
120         dh_install -i
122 install-arch: build
123         dh_testdir
124         dh_testroot
125         dh_clean -k
126         dh_installdirs -a
127         
128         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
129         
130         rm -f debian/tmp/usr/lib/collectd/*.la
131         rm -f debian/tmp/etc/collectd.conf
132         
133         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
134         
135         perl ./debian/bin/gen_plugin_deps.pl
136         
137         mkdir -p debian/collectd/usr/share/lintian/overrides/
138         cp debian/collectd.overrides \
139                 debian/collectd/usr/share/lintian/overrides/collectd
141 binary-indep: install-indep
142         dh_testdir
143         dh_testroot
144         dh_installchangelogs -i ChangeLog
145         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
146         dh_installexamples -i contrib/examples/myplugin.c \
147                 contrib/examples/MyPlugin.pm
148         dh_compress -i -Xexamples/
149         dh_fixperms -i
150         dh_installdeb -i
151         dh_gencontrol -i
152         dh_md5sums -i
153         dh_builddeb -i
155 binary-arch: build install-arch
156         dh_testdir
157         dh_testroot
158         dh_installchangelogs -a ChangeLog
159         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
160         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
161         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
162                 contrib/collection3/ contrib/php-collection/ \
163                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
164                 contrib/exec-nagios.conf contrib/exec-nagios.px \
165                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
166                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
167                 contrib/collectd-network.py contrib/collectd-unixsock.py \
168                 contrib/snmp-probe-host.px
169         dh_installdebconf -a
170         dh_installinit -a -- defaults 95
171         dh_link -a
172         dh_strip -a --dbg-package=collectd-dbg
173         dh_compress -a -Xexamples/
174         dh_fixperms -a
175         dh_makeshlibs -a
176         dh_installdeb -a
177         dpkg-shlibdeps -Tdebian/collectd.substvars \
178                 -dDepends debian/collectd/usr/sbin/* \
179                         debian/collectd/usr/lib/collectd/rrdtool.so \
180                 -dRecommends debian/collectd/usr/lib/collectd/*.so
181         dh_shlibdeps -a -Ncollectd
182         dh_gencontrol -a
183         dh_md5sums -a
184         dh_builddeb -a
186 binary: binary-arch binary-indep
187 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch