Code

Fix shebang line in examples/iptables/accounting.sh.
[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 # The static libraries iptc and upsclient cannot be used on 64bit systems
32 # (see bugs #358637 and #419684 for more details).
33 ifneq (,$(findstring $(DEB_BUILD_ARCH),amd64 ia64 ppc64))
34         confflags += --disable-iptables --disable-nut
35 endif
37 config.status: configure $(DPATCH_STAMPFN)
38         dh_testdir
39         CFLAGS="$(CFLAGS)" ./configure $(confflags)
41 build: build-stamp
43 build-stamp: config.status
44         dh_testdir
45         
46         $(MAKE)
47         
48         touch build-stamp
50 clean: unpatch
51         dh_testdir
52         dh_testroot
53         rm -f build-stamp
54         
55         -$(MAKE) distclean
56         
57         dh_clean 
59 install-indep:
60         dh_testdir
61         dh_testroot
62         dh_clean -k
63         dh_installdirs -i
64         
65         include_dir=$(CURDIR)/debian/collectd-dev/usr/include/collectd/ \
66                 && mkdir -p $$include_dir \
67                 && cp src/*.h $$include_dir
69 install-arch: build
70         dh_testdir
71         dh_testroot
72         dh_clean -k 
73         dh_installdirs -a
74         
75         $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
76         
77         rm -f $(CURDIR)/debian/collectd/usr/lib/collectd/*.la
78         
79         rm -f $(CURDIR)/debian/collectd/etc/collectd.conf
80         install -D -m 0644 $(CURDIR)/debian/collectd.conf \
81                 $(CURDIR)/debian/collectd/etc/collectd/collectd.conf
82         
83         for PLUGIN in apache dns mysql perl ping sensors; do \
84                 plugin_dir=$(CURDIR)/debian/collectd-$$PLUGIN/usr/lib/collectd/; \
85                 mkdir -p $$plugin_dir; \
86                 mv $(CURDIR)/debian/collectd/usr/lib/collectd/$$PLUGIN.so \
87                         $$plugin_dir; \
88         done
89         
90         mkdir -p debian/collectd/usr/lib/collectd/utils/
91         for UTIL in extractDS.px migrate-3-4.px; do \
92                 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
93         done
95 binary-indep: install-indep
96         dh_testdir
97         dh_testroot
98         dh_installchangelogs -i ChangeLog
99         dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
100         dh_installexamples -i debian/examples/myplugin.c
101         dh_compress -i
102         dh_fixperms -i
103         dh_installdeb -i
104         dh_gencontrol -i
105         dh_md5sums -i
106         dh_builddeb -i
108 binary-arch: build install-arch
109         dh_testdir
110         dh_testroot
111         dh_installchangelogs -a ChangeLog
112         dh_installdocs -A -a debian/README.Debian debian/NEWS.Debian \
113                 AUTHORS README TODO
114         dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
115                 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/
116         sed -i -e 's/#\/bin\/bash/#!\/bin\/bash/' \
117                 debian/collectd/usr/share/doc/collectd/examples/iptables/accounting.sh
118         dh_installdebconf -a
119         dh_installinit -a -- defaults 95
120         dh_installman -a src/collectd.1 src/collectd.conf.5
121         dh_link -a
122         dh_strip -a --dbg-package=collectd-dbg
123         dh_compress -a
124         dh_fixperms -a
125         dh_installdeb -a
126         dh_shlibdeps -a
127         dh_gencontrol -a
128         dh_md5sums -a
129         dh_builddeb -a
131 binary: binary-arch binary-indep
132 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch