Code

Diff for NMU version 1.4.7-1.2.
[pkg-rrdtool.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
7 #we use quilt
8 include /usr/share/quilt/quilt.make
10 #needed to build with Python 2.6
11 -include /usr/share/python/python.mk
12 ifeq (,$(py_sitename))
13   py_sitename = site-packages
14   py_libdir = /usr/lib/python$(subst python,,$(1))/site-packages
15   py_sitename_sh = $(py_sitename)
16   py_libdir_sh = $(py_libdir)
17   py_setup_install_args = 
18 endif
22 #Ruby versions to build for
23 RUBY_VERS := 1.8 1.9.1
24 RUBY_DEFAULT_VERS := 1.8
26 PY_VERS := $(shell pyversions -vr)
28 #tcl version we're building for
29 TCL_VERS := $(shell dpkg -s tcl-dev | grep '^Depends' \
30         | sed 's,.*\<tcl\([0-9.]*\)-dev\>.*,\1,')
32 #let's help configure to figure out our host/build system
33 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
34 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
35 DEB_HOST_ARCH_CPU   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
37 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
38   CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
39 else
40   CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
41 endif
43 #we build the bindings manually from debian/rules
44 CONFFLAGS += --disable-python --disable-ruby
46 #set the right paths
47 CONFFLAGS += --prefix=/usr --docdir=/usr/share/doc/rrdtool
49 #install perl libs in vendor mode
50 CONFFLAGS += --with-perl-options=INSTALLDIRS=vendor 
52 #path to tcl
53 CONFFLAGS += --with-tcllib=/usr/lib/tcl$(TCL_VERS)
55 #let's take care of optimization + debug builds
56 CFLAGS += -Wall -g
57 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
58         CFLAGS += -O0
59 else
60 #don't optimize on arm for now - #447041
61 ifneq ($(DEB_HOST_ARCH_CPU), arm)
62         CFLAGS += -O2
63 endif
64 endif
66 # work-around for a broken dpkg - do not rename this to LDFLAGS :-/
67 LINKER_FLAGS=-Wl,-z,defs
69 configure: config.status
70 config.status: $(QUILT_STAMPFN)
72 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
73         cp -f /usr/share/misc/config.sub config.sub
74 endif
75 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
76         cp -f /usr/share/misc/config.guess config.guess
77 endif
79         LDFLAGS="$(LINKER_FLAGS)" \
80         CFLAGS="$(CFLAGS)" \
81         RRDDOCDIR=/usr/share/doc/rrdtool \
82           ./configure $(CONFFLAGS)
84 build: build-arch build-indep 
86 build-arch: build-arch-stamp $(PY_VERS:%=build-python%) $(PY_VERS:%=build-python%-dbg)
87 build-arch-stamp: config.status 
88         make
89         #Fix library path to tcl bindings
90         sed -i -e 's|lib/|lib/tcltk/rrdtool-tcl/|' bindings/tcl/pkgIndex.tcl
91         #sanity check if debian/control lists the right package name
92         LIB_major=`grep '^dlname=' src/librrd.la \
93                         | sed -e "s/^dlname='librrd\.so\.\\([0-9]\+\\)'\$$/\\1/"` \
94                 && test -n "$$LIB_major" \
95                 && grep -q "^Package: librrd$$LIB_major\\>" debian/control
96         touch $@
98 build-python%: build-arch-stamp
99         set -e ;\
100          cd bindings/python ;\
101          BUILDLIBDIR=../../src/.libs LIBDIR=../../src/.libs python$* setup.py build ;\
102          touch $@
104 build-indep: build-arch-stamp
105         #indep stuff is built in build-arch-stamp, too.
107 clean: clean-patched
108 clean-patched: unpatch $(PY_VERS:%=clean-python%) $(PY_VERS:%=clean-python%-dbg)
109         dh_testdir
110         dh_testroot
112         [ ! -f Makefile ] || make distclean
114 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
115         rm -f config.sub
116 endif
117 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
118         rm -f config.guess
119 endif
120         rm -f build-arch-stamp build-indep-stamp config.status install-common-stamp
121         find . -name \*.pyc | xargs rm -f
122         rm -rf bindings/python/build
124         # clean what the Makefiles do not clean ...
125         rm -rf bindings/perl-piped/blib bindings/perl-shared/blib \
126                bindings/perl-piped/Makefile.old bindings/perl-shared/Makefile.old bindings/perl-shared/MYMETA.yml
127         rm -f bindings/tcl/pkgIndex.tcl bindings/tcl/tclrrd*.so
128         rm -f examples/cgi-demo.cgi
129         rm -rf src/.libs src/.deps doc/*.html doc/*.1 doc/*.txt
130         rm -f intltool-extract intltool-merge intltool-update
131         rm -f src/librrd.sym
132         rm -f config.h
134         dh_clean
136 clean-python%: unpatch
137         set -e ;\
138          cd bindings/python ;\
139          python$* setup.py clean ;\
140          rm -f build-python$*
143 install: install-arch install-indep
145 install-indep: build-indep install-common-stamp
146         #nothing to do
148 install-common-stamp: build-arch-stamp
149         dh_testdir
150         dh_testroot
151         dh_clean -k
153         make install DESTDIR=$(CURDIR)/debian/tmp
154         # we don't want .txt and .pod documentation in the package
155         rm -rf debian/tmp/usr/share/doc/rrdtool/txt
156         dh_install --sourcedir=$(CURDIR)/debian/tmp -X.la --fail-missing
157         # remove duplicates
158         rm debian/rrdtool/usr/bin/rrdcached
159         rm debian/rrdtool/usr/share/man/man1/rrdcached.1
160         rm debian/rrdtool/usr/share/doc/rrdtool/html/rrdcached.html
162         touch $@
164 install-arch: install-common-stamp $(PY_VERS:%=install-python%)
165         #build and install ruby
166         set -e; \
167         cd bindings/ruby ;\
168         for rbv in $(RUBY_VERS); do \
169           ruby$$rbv extconf.rb ;\
170           make ;\
171           make install sitelibdir=$(CURDIR)/debian/librrd-ruby$$rbv`ruby$$rbv -r rbconfig -e 'print Config::CONFIG["rubylibdir"]'` \
172                        sitearchdir=$(CURDIR)/debian/librrd-ruby$$rbv`ruby$$rbv -r rbconfig -e 'print Config::CONFIG["archdir"]'` ;\
173           make distclean ;\
174         done
176         dh_installexamples -s
177         chmod 644 debian/rrdcached/usr/share/doc/rrdcached/examples/RRDCached.pm
179 install-python%: install-common-stamp
180         dh_testdir
181         dh_testroot
182         set -e ;\
183          cd bindings/python ;\
184          python$* setup.py install --root=$(CURDIR)/debian/python-rrdtool \
185                 $(py_setup_install_args) ;\
186          python$*-dbg setup.py install --root=$(CURDIR)/debian/rrdtool-dbg \
187                 $(py_setup_install_args)
189         find $(CURDIR)/debian/rrdtool-dbg -type f -name '*.egg-info' -print0 |\
190                  xargs -0r rm -f
193 binary-indep: build-indep install-indep
194         dh_testdir
195         dh_testroot
196         dh_link -plibrrd-ruby /usr/share/doc/librrd-ruby$(RUBY_DEFAULT_VERS) /usr/share/doc/librrd-ruby
197         dh_installchangelogs -i -Nlibrrd-ruby CHANGES
198         dh_installdocs -i -Nlibrrd-ruby -A CONTRIBUTORS NEWS
199         dh_link -i -Nlibrrd-ruby
200         echo 'rubydefault:Depends=librrd-ruby$(RUBY_DEFAULT_VERS)' >> debian/librrd-ruby.substvars
201         dh_perl -i
202         dh_compress -i
203         dh_fixperms -i
204         dh_installdeb -i
205         dh_gencontrol -i
206         dh_md5sums -i
207         dh_builddeb -i
208         
210 binary-arch: build-arch install-arch
211         dh_testdir
212         dh_testroot
213         dh_installchangelogs -a CHANGES
214         dh_installdocs -a -A CONTRIBUTORS NEWS
215         dh_installdocs -a
216         echo 'tcl:Depends=tcl$(TCL_VERS) | tclsh' >> debian/rrdtool-tcl.substvars
217         dh_python2 -ppython-rrdtool
218         dh_python2 -prrdtool-dbg
219         dh_perl -a
220         dh_installman -a
221         dh_installinit -prrdcached
222         dh_link -a
223         dh_strip -a --dbg-package=rrdtool-dbg
224         dh_compress -a
225         dh_fixperms -a
226         dh_makeshlibs -a -Nliblua5.1-rrd0 -Nliblua5.1-rrd-dev
227         dh_makeshlibs -pliblua5.1-rrd0 -pliblua5.1-rrd-dev -n
228         dh_installdeb -a
229         dh_shlibdeps -a
230         dh_gencontrol -a
231         dh_md5sums -a
232         dh_builddeb -a
235 binary: binary-arch binary-indep
236 .PHONY: build clean configure \
237         binary-indep binary-arch binary \
238         install install-arch \
239         install-python% clean-python% unpatch