Code

rules: Use /usr/share/javahelper/java-arch.sh to determine the Java arch.
[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 = `dpkg-buildflags --get CPPFLAGS`
16 CPPFLAGS += -I$(CURDIR)/debian/include
17 CFLAGS = `dpkg-buildflags --get CFLAGS`
18 CFLAGS += -Wall
20 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
21 # however required by the perl plugin (which would otherwise be unable to find
22 # symbols defined in libperl when loading perl modules that require such
23 # symbols). This is a workaround for this issue.
24 CPPFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
26 # Upstream defaults to ${sysconfdir}/collectd.conf. Setting ${sysconfdir} to
27 # /etc/collectd would be wrong though.
28 CPPFLAGS += -UCONFIGFILE
29 CPPFLAGS += -DCONFIGFILE='\"/etc/collectd/collectd.conf\"'
31 LDFLAGS = `dpkg-buildflags --get LDFLAGS`
33 # The archdir map has been copied from openjdk-6's debian/rules.
34 JAVA_ARCHDIR = $(shell /usr/share/javahelper/java-arch.sh $(DEB_BUILD_ARCH))
35 ifeq (,$(JAVA_ARCHDIR))
36         JAVA_ARCHDIR = $(DEB_BUILD_ARCH)
37 endif
38 JAVA_HOME = /usr/lib/jvm/java-6-openjdk-$(DEB_BUILD_ARCH)
39 JAVA_LIBDIR = $(JAVA_HOME)/jre/lib/$(JAVA_ARCHDIR)/server
41 JAVAC = $(JAVA_HOME)/bin/javac
42 JAR = $(JAVA_HOME)/bin/jar
43 JAVA_CPPFLAGS = -I$(JAVA_HOME)/include
44 JAVA_LDFLAGS = -L$(JAVA_LIBDIR) -Wl,-rpath -Wl,$(JAVA_LIBDIR)
46 include /usr/share/dpatch/dpatch.make
48 confflags = --host=$(DEB_HOST_GNU_TYPE) \
49                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
50                         --mandir=\$${prefix}/share/man \
51                         --localstatedir=/var --sysconfdir=/etc \
52                         --with-perl-bindings="INSTALLDIRS=vendor" \
53                         --without-libstatgrab \
54                         --without-included-ltdl \
55                         --disable-static \
56                         --enable-all-plugins
58 # These plugins do not provide any functionality under Linux.
59 confflags += --disable-apple_sensors --disable-tape
61 # libmodbus is required for the modbus plugin.
62 confflags += --disable-modbus
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 (,$(filter alpha amd64 hppa ia64 ppc64 mips mipsel, $(DEB_BUILD_ARCH)))
85         confflags += --disable-netlink
86 endif
88 # These plugins are Linux-specific.
89 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
90         confflags += \
91                 --disable-iptables \
92                 --disable-ipvs \
93                 --disable-madwifi \
94                 --disable-netlink \
95                 --disable-sensors \
96                 --disable-vserver
97 endif
99 # These plugins have not been ported to FreeBSD yet.
100 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
101         confflags += \
102                 --disable-battery \
103                 --disable-conntrack \
104                 --disable-contextswitch \
105                 --disable-cpufreq \
106                 --disable-disk \
107                 --disable-entropy \
108                 --disable-fscache \
109                 --disable-irq \
110                 --disable-nfs \
111                 --disable-protocols \
112                 --disable-serial \
113                 --disable-thermal \
114                 --disable-vmem \
115                 --disable-wireless
116 endif
118 # Build-dependencies of these plugins are (not yet) available for kfreebsd.
119 ifneq (,$(filter kfreebsd-i386 kfreebsd-amd64, $(DEB_BUILD_ARCH)))
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 (,$(filter hppa, $(DEB_BUILD_ARCH)))
130         confflags += --disable-java
131 endif
133 config.status: configure $(DPATCH_STAMPFN)
134         dh_testdir
135         
136         ( cd debian/patches/; for patch in *; do \
137                 if test "$$patch" != "00list"; then \
138                         grep "$$patch" 00list > /dev/null \
139                                 || ( echo "$$patch not enabled\!"; exit 1 ); \
140                 fi; done )
141         
142         # This is a work-around for #474087 (broken openipmi .pc files).
143         mkdir debian/pkgconfig
144         sed -re 's/^(Requires:.*) pthread(.*)$$/\1\2/' \
145                 /usr/lib/pkgconfig/OpenIPMIpthread.pc \
146                 > debian/pkgconfig/OpenIPMIpthread.pc
147         
148         PKG_CONFIG_PATH="$(CURDIR)/debian/pkgconfig:$$PKG_CONFIG_PATH" \
149         ./configure $(confflags) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
150                 JAVAC="$(JAVAC)" JAR="$(JAR)" JAVA_CPPFLAGS="$(JAVA_CPPFLAGS)" \
151                 JAVA_LDFLAGS="$(JAVA_LDFLAGS)" \
152                 || ( status=$$?; cat config.log; exit $$status )
154 build: build-arch build-indep
155 build-arch: build-stamp
156 build-indep: build-stamp
158 build-stamp: config.status
159         dh_testdir
160         
161         $(MAKE)
162         perl ./debian/bin/check_plugins.pl
163         
164         touch build-stamp
166 clean: unpatch
167         dh_testdir
168         dh_testroot
169         rm -f build-stamp
170         
171         [ ! -f Makefile ] || $(MAKE) distclean
172         
173         rm -f debian/README.Debian.plugins
174         rm -f src/*.1 src/*.5
175         
176         rm -rf debian/pkgconfig
177         
178         dh_clean
179         debconf-updatepo
181 install-indep:
182         dh_testdir
183         dh_testroot
184         dh_clean -k
185         dh_installdirs -i
186         dh_install -i
188 install-arch: build
189         dh_testdir
190         dh_testroot
191         dh_clean -k
192         dh_installdirs -a
193         
194         $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
195         
196         rm -f debian/tmp/usr/lib/collectd/*.la
197         rm -f debian/tmp/usr/lib/libcollectdclient.la
198         rm -f debian/tmp/etc/collectd.conf
199         
200         dh_install -a --sourcedir=$(CURDIR)/debian/tmp --fail-missing
201         
202         perl ./debian/bin/gen_plugin_deps.pl
203         
204         mkdir -p debian/collectd-core/usr/share/lintian/overrides/
205         cp debian/collectd-core.overrides \
206                 debian/collectd-core/usr/share/lintian/overrides/collectd-core
208 binary-indep: install-indep
209         dh_testdir
210         dh_testroot
211         dh_installchangelogs -i ChangeLog
212         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
213         dh_installexamples -i contrib/examples/myplugin.c \
214                 contrib/examples/MyPlugin.pm
215         dh_compress -i -Xexamples/
216         dh_fixperms -i
217         dh_installdeb -i
218         dh_gencontrol -i
219         dh_md5sums -i
220         dh_builddeb -i
222 binary-arch: build install-arch
223         dh_testdir
224         dh_testroot
225         dh_installchangelogs -a ChangeLog
226         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
227         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
228         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
229                 contrib/collection3/ contrib/php-collection/ \
230                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
231                 contrib/exec-nagios.conf contrib/exec-nagios.px \
232                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
233                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py \
234                 contrib/collectd_network.py contrib/collectd_unixsock.py \
235                 contrib/snmp-probe-host.px contrib/GenericJMX.conf \
236                 debian/collectd.conf debian/filters.conf debian/thresholds.conf
237         # some upstream tarballs have been built inside a dirty working dir
238         ( cd debian/collectd-core/ \
239                 && cd usr/share/doc/collectd-core/examples/collection3/ \
240                 && rm -f bin/foo bin/test_config.px etc/collection4.conf \
241                 && rm -f lib/Collectd/Graph.pm lib/Collectd/Graph/Data.pm \
242                 && rm -f lib/Collectd/Graph/File.pm lib/Collectd/Graph/Filter.pm \
243                 && rm -f lib/Collectd/Graph/MetaData.pm )
244         dh_installdebconf -a
245         dh_installinit -pcollectd-core --name=collectd -- defaults 95
246         dh_link -a
247         dh_strip -a --dbg-package=collectd-dbg
248         dh_compress -a -Xexamples/
249         dh_fixperms -a
250         dh_makeshlibs -a
251         dh_installdeb -a
252         dh_shlibdeps -a -Ncollectd-core -Ncollectd
253         dpkg-shlibdeps -Tdebian/collectd.substvars \
254                 -dDepends debian/collectd-core/usr/lib/collectd/rrdtool.so
255         dpkg-shlibdeps -Tdebian/collectd-core.substvars \
256                 -dDepends debian/collectd-core/usr/sbin/* \
257                 -dSuggests debian/collectd-core/usr/lib/collectd/*.so
258         grep shlibs:Suggests debian/collectd-core.substvars \
259                 | sed -e 's/shlibs:Suggests/shlibs:Recommends/' \
260                 >> debian/collectd.substvars
261         dh_gencontrol -a
262         dh_md5sums -a
263         dh_builddeb -a
265 binary: binary-arch binary-indep
266 .PHONY: build build-arch build-indep clean binary-indep binary-arch binary install-indep install-arch