Code

Recommend all plugin's library dependencies.
[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
17 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
18         CFLAGS += -O0
19 else
20         CFLAGS += -O2
21 endif
23 include /usr/share/dpatch/dpatch.make
25 confflags = --host=$(DEB_HOST_GNU_TYPE) \
26                         --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
27                         --mandir=\$${prefix}/share/man \
28                         --localstatedir=/var --sysconfdir=/etc \
29                         --enable-debug
31 # These plugins do not provide any functionality under Linux.
32 confflags += --disable-apple_sensors --disable-tape
34 # The static libraries iptc and upsclient cannot be used on 64bit systems
35 # (see bugs #358637 and #419684 for more details).
36 ifneq (,$(findstring $(DEB_BUILD_ARCH),alpha amd64 hppa ia64 ppc64))
37         confflags += --disable-iptables --disable-nut
38 endif
40 config.status: configure $(DPATCH_STAMPFN)
41         dh_testdir
42         CFLAGS="$(CFLAGS)" ./configure $(confflags)
44 build: build-stamp
46 build-stamp: config.status
47         dh_testdir
48         
49         $(MAKE)
50         perl ./debian/check_plugins.pl
51         
52         touch build-stamp
54 clean: unpatch
55         dh_testdir
56         dh_testroot
57         rm -f build-stamp
58         
59         -$(MAKE) distclean
60         
61         dh_clean 
62         debconf-updatepo
64 install-indep:
65         dh_testdir
66         dh_testroot
67         dh_clean -k
68         dh_installdirs -i
69         
70         include_dir=debian/collectd-dev/usr/include/collectd/ \
71                 && mkdir -p $$include_dir \
72                 && cp src/*.h $$include_dir
74 install-arch: build
75         dh_testdir
76         dh_testroot
77         dh_clean -k 
78         dh_installdirs -a
79         
80         $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
81         
82         rm -f debian/collectd/usr/lib/collectd/*.la
83         
84         rm -f debian/collectd/etc/collectd.conf
85         install -D -m 0644 debian/collectd.conf \
86                 debian/collectd/etc/collectd/collectd.conf
87         install -m 0644 debian/collection.conf \
88                 debian/collectd/etc/collectd/collection.conf
89         
90         for PLUGIN in apache dns mysql perl ping sensors; do \
91                 plugin_dir=debian/collectd-$$PLUGIN/usr/lib/collectd/; \
92                 manpage=debian/collectd/usr/share/man/man5/collectd-$$PLUGIN.5; \
93                 man_dir=debian/collectd-$$PLUGIN/usr/share/man/man5/; \
94                 \
95                 mkdir -p $$plugin_dir; \
96                 mv debian/collectd/usr/lib/collectd/$$PLUGIN.so $$plugin_dir; \
97                 \
98                 if [ -e $$manpage ]; then \
99                         mkdir -p $$man_dir; \
100                         mv $$manpage $$man_dir; \
101                 fi \
102         done
103         
104         mkdir -p debian/collectd/usr/lib/collectd/utils/
105         for UTIL in extractDS.px migrate-3-4.px; do \
106                 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
107         done
109 binary-indep: install-indep
110         dh_testdir
111         dh_testroot
112         dh_installchangelogs -i ChangeLog
113         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
114         dh_installexamples -i debian/examples/myplugin.c \
115                 debian/examples/MyPlugin.pm
116         dh_compress -i
117         dh_fixperms -i
118         dh_installdeb -i
119         dh_gencontrol -i
120         dh_md5sums -i
121         dh_builddeb -i
123 binary-arch: build install-arch
124         dh_testdir
125         dh_testroot
126         dh_installchangelogs -a ChangeLog
127         dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
128         dh_installdocs -a debian/NEWS.Debian
129         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
130                 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/
131         dh_installdebconf -a
132         dh_installinit -a -- defaults 95
133         dh_installman -a src/collectd.1 src/collectd.conf.5
134         dh_link -a
135         dh_strip -a --dbg-package=collectd-dbg
136         dh_compress -a
137         dh_fixperms -a
138         dh_installdeb -a
139         dh_shlibdeps -a
140         dpkg-shlibdeps -Tdebian/collectd.substvars \
141                 -dDepends debian/collectd/usr/bin/* debian/collectd/usr/sbin/* \
142                 -dRecommends debian/collectd/usr/lib/collectd/*.so
143         dh_gencontrol -a
144         dh_md5sums -a
145         dh_builddeb -a
147 binary: binary-arch binary-indep
148 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch