Code

995325230200b742c73ecf9e277e5dc71da1ccf6
[pkg-collectd.git] / debian / rules
1 #!/usr/bin/make -f
2 # debian/rules for collectd
3 #
4 # Written by Sebastian Harl <sh@tokkee.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 CFLAGS = -Wall -g -I$(CURDIR)/debian/include
17 # There is no way to tell lt_dlopen() to use the RTLD_GLOBAL flag which is
18 # however required by the perl plugin (which would otherwise be unable to find
19 # symbols defined in libperl when loading perl modules that require such
20 # symbols). This is a workaround for this issue.
21 CFLAGS += -DLT_LAZY_OR_NOW='RTLD_LAZY|RTLD_GLOBAL'
23 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
24         CFLAGS += -O0
25 else
26         CFLAGS += -O2
27 endif
29 include /usr/share/dpatch/dpatch.make
31 confflags = --host=$(DEB_HOST_GNU_TYPE) \
32                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
33                         --mandir=\$${prefix}/share/man \
34                         --localstatedir=/var --sysconfdir=/etc \
35                         --with-perl-bindings="INSTALLDIRS=vendor" \
36                         --disable-xmms \
37                         --without-libstatgrab
39 # libiptc is no longer available on Debian (see #472655).
40 confflags += --disable-iptables
42 # These plugins do not provide any functionality under Linux.
43 confflags += --disable-apple_sensors --disable-tape
45 # The static libraries iptc, netstat and upsclient cannot be used on
46 # 64bit systems (see bugs #358637 and #419684 for more details).
47 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
48         confflags += --disable-netlink --disable-nut
49 endif
51 # libvirt is only available on amd64, i386 and powerpc.
52 ifeq (,$(findstring $(DEB_BUILD_ARCH),amd64 i386 powerpc))
53         confflags += --disable-libvirt
54 endif
56 config.status: configure $(DPATCH_STAMPFN)
57         dh_testdir
58         CFLAGS="$(CFLAGS)" ./configure $(confflags)
60 build: build-stamp
62 build-stamp: config.status
63         dh_testdir
64         
65         $(MAKE)
66         perl ./debian/bin/check_plugins.pl
67         
68         touch build-stamp
70 clean: unpatch
71         dh_testdir
72         dh_testroot
73         rm -f build-stamp
74         
75         [ ! -f Makefile ] || $(MAKE) distclean
76         
77         rm -f debian/README.Debian.plugins
78         
79         dh_clean 
80         debconf-updatepo
82 install-indep:
83         dh_testdir
84         dh_testroot
85         dh_clean -k
86         dh_installdirs -i
87         
88         include_dir=debian/collectd-dev/usr/include/collectd/ \
89                 && mkdir -p $$include_dir/liboconfig \
90                 && cp src/*.h $$include_dir \
91                 && cp src/liboconfig/oconfig.h $$include_dir/liboconfig
93 install-arch: build
94         dh_testdir
95         dh_testroot
96         dh_clean -k 
97         dh_installdirs -a
98         
99         $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
100         
101         rm -rf debian/collectd/usr/include/
102         rm -f debian/collectd/usr/lib/collectd/*.la
103         
104         rm -f debian/collectd/etc/collectd.conf
105         install -D -m 0644 debian/collectd.conf \
106                 debian/collectd/etc/collectd/collectd.conf
107         install -m 0644 debian/collection.conf \
108                 debian/collectd/etc/collectd/collection.conf
109         install -m 0644 debian/thresholds.conf \
110                 debian/collectd/etc/collectd/thresholds.conf
111         
112         mkdir -p debian/collectd/usr/lib/collectd/utils/
113         for UTIL in rrd_filter.px migrate-3-4.px; do \
114                 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
115         done
116         
117         perl ./debian/bin/gen_plugin_deps.pl
118         
119         mkdir -p debian/collectd/usr/share/lintian/overrides/
120         cp debian/collectd.overrides \
121                 debian/collectd/usr/share/lintian/overrides/collectd
123 binary-indep: install-indep
124         dh_testdir
125         dh_testroot
126         dh_installchangelogs -i ChangeLog
127         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
128         dh_installexamples -i contrib/examples/myplugin.c \
129                 contrib/examples/MyPlugin.pm
130         dh_compress -i -Xexamples/myplugin.c -Xexamples/MyPlugin.c
131         dh_fixperms -i
132         dh_installdeb -i
133         dh_gencontrol -i
134         dh_md5sums -i
135         dh_builddeb -i
137 binary-arch: build install-arch
138         dh_testdir
139         dh_testroot
140         dh_installchangelogs -a ChangeLog
141         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
142         dh_installdocs -a debian/NEWS.Debian debian/README.Debian.plugins
143         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
144                 contrib/exec-munin.conf contrib/exec-munin.px contrib/exec-smartctl \
145                 contrib/exec-nagios.conf contrib/exec-nagios.px \
146                 contrib/SpamAssassin/ contrib/iptables/ contrib/cussh.pl \
147                 contrib/snmp-data.conf contrib/add_rra.sh contrib/network-proxy.py
148         dh_installdebconf -a
149         dh_installinit -a -- defaults 95
150         dh_link -a
151         dh_strip -a --dbg-package=collectd-dbg
152         dh_compress -a
153         dh_fixperms -a
154         dh_installdeb -a
155         dpkg-shlibdeps -Tdebian/collectd.substvars \
156                 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
157                         debian/collectd/usr/lib/collectd/rrdtool.so \
158                 -dRecommends debian/collectd/usr/lib/collectd/*.so
159         dh_gencontrol -a
160         dh_md5sums -a
161         dh_builddeb -a
163 binary: binary-arch binary-indep
164 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch