Code

Running ldconfig is not needed for lua.
[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
11 #Ruby versions to build for
12 RUBY_VERS := 1.8 1.9
13 RUBY_DEFAULT_VERS := 1.8
15 PY_VERS := $(shell pyversions -vr)
17 #tcl version we're building for
18 TCL_VERS := $(shell dpkg -s tcl-dev | grep '^Depends' \
19         | sed 's,.*\<tcl\([0-9.]*\)-dev\>.*,\1,')
21 #let's help configure to figure out our host/build system
22 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
23 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
24 DEB_HOST_ARCH_CPU   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
26 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
27   CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
28 else
29   CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
30 endif
32 #we build the bindings manually from debian/rules
33 CONFFLAGS += --disable-python --disable-ruby
35 #set the right paths
36 CONFFLAGS += --prefix=/usr --docdir=/usr/share/doc/rrdtool
38 #install perl libs in vendor mode
39 CONFFLAGS += --with-perl-options=INSTALLDIRS=vendor 
41 #path to tcl
42 CONFFLAGS += --with-tcllib=/usr/lib/tcl$(TCL_VERS)
44 #let's take care of optimization + debug builds
45 CFLAGS += -Wall -g
46 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
47         CFLAGS += -O0
48 else
49 #don't optimize on arm for now - #447041
50 ifneq ($(DEB_HOST_ARCH_CPU), arm)
51         CFLAGS += -O2
52 endif
53 endif
55 # work-around for a broken dpkg - do not rename this to LDFLAGS :-/
56 LINKER_FLAGS=-Wl,-z,defs
58 configure: config.status
59 config.status: $(QUILT_STAMPFN)
61 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
62         cp -f /usr/share/misc/config.sub config.sub
63 endif
64 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
65         cp -f /usr/share/misc/config.guess config.guess
66 endif
68         LDFLAGS="$(LINKER_FLAGS)" \
69         CFLAGS="$(CFLAGS)" \
70         RRDDOCDIR=/usr/share/doc/rrdtool \
71           ./configure $(CONFFLAGS)
73 build: build-arch build-indep 
75 build-arch: build-arch-stamp $(PY_VERS:%=build-python%) $(PY_VERS:%=build-python%-dbg)
76 build-arch-stamp: config.status 
77         make
78         #Fix library path to tcl bindings
79         sed -i -e 's|lib/|lib/tcltk/rrdtool-tcl/|' bindings/tcl/pkgIndex.tcl
80         #sanity check if debian/control lists the right package name
81         LIB_major=`grep '^dlname=' src/librrd.la \
82                         | sed -e "s/^dlname='librrd\.so\.\\([0-9]\+\\)'\$$/\\1/"` \
83                 && test -n "$$LIB_major" \
84                 && grep -q "^Package: librrd$$LIB_major\\>" debian/control
85         touch $@
87 build-python%: build-arch-stamp
88         set -e ;\
89          cd bindings/python ;\
90          BUILDLIBDIR=../../src/.libs LIBDIR=../../src/.libs python$* setup.py build ;\
91          touch $@
93 build-indep: build-arch-stamp
94         #indep stuff is built in build-arch-stamp, too.
96 clean: clean-patched
97 clean-patched: unpatch $(PY_VERS:%=clean-python%) $(PY_VERS:%=clean-python%-dbg)
98         dh_testdir
99         dh_testroot
101         [ ! -f Makefile ] || make distclean
103 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
104         rm -f config.sub
105 endif
106 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
107         rm -f config.guess
108 endif
109         rm -f build-arch-stamp build-indep-stamp config.status install-common-stamp
110         find . -name \*.pyc | xargs rm -f
111         rm -rf bindings/python/build
113         # clean what the Makefiles do not clean ...
114         rm -rf bindings/perl-piped/blib bindings/perl-shared/blib \
115                bindings/perl-piped/Makefile.old bindings/perl-shared/Makefile.old
116         rm -f bindings/tcl/pkgIndex.tcl bindings/tcl/tclrrd*.so
117         rm -f examples/cgi-demo.cgi
118         rm -rf src/.libs src/.deps doc/*.html doc/*.1 doc/*.txt
119         rm -f intltool-extract intltool-merge intltool-update
120         rm -f src/librrd.sym
121         rm -f config.h
123         dh_clean
125 clean-python%: unpatch
126         set -e ;\
127          cd bindings/python ;\
128          python$* setup.py clean ;\
129          rm -f build-python$*
132 install: install-arch install-indep
134 install-indep: build-indep install-common-stamp
135         #nothing to do
137 install-common-stamp: build-arch-stamp
138         dh_testdir
139         dh_testroot
140         dh_clean -k
142         make install DESTDIR=$(CURDIR)/debian/tmp
143         # we don't want .txt and .pod documentation in the package
144         rm -rf debian/tmp/usr/share/doc/rrdtool/txt
145         dh_install --sourcedir=$(CURDIR)/debian/tmp --fail-missing
146         # remove duplicates
147         rm debian/rrdtool/usr/bin/rrdcached
148         rm debian/rrdtool/usr/share/man/man1/rrdcached.1
149         rm debian/rrdtool/usr/share/doc/rrdtool/html/rrdcached.html
151         touch $@
153 install-arch: install-common-stamp $(PY_VERS:%=install-python%)
154         #build and install ruby
155         set -e; \
156         cd bindings/ruby ;\
157         for rbv in $(RUBY_VERS); do \
158           ruby$$rbv extconf.rb ;\
159           make ;\
160           make install sitelibdir=$(CURDIR)/debian/librrd-ruby$$rbv`ruby$$rbv -r rbconfig -e 'print Config::CONFIG["rubylibdir"]'` \
161                        sitearchdir=$(CURDIR)/debian/librrd-ruby$$rbv`ruby$$rbv -r rbconfig -e 'print Config::CONFIG["archdir"]'` ;\
162           make distclean ;\
163         done
165         dh_installexamples -s
166         chmod 644 debian/rrdcached/usr/share/doc/rrdcached/examples/RRDCached.pm
168 install-python%: install-common-stamp
169         dh_testdir
170         dh_testroot
171         set -e ;\
172          cd bindings/python ;\
173          python$* setup.py install --root=$(CURDIR)/debian/python-rrdtool ;\
174          python$*-dbg setup.py install --root=$(CURDIR)/debian/rrdtool-dbg
175         find $(CURDIR)/debian/rrdtool-dbg -type f -name '*.egg-info' -print0 |\
176                  xargs -0r rm -f
179 binary-indep: build-indep install-indep
180         dh_testdir
181         dh_testroot
182         dh_link -plibrrd-ruby /usr/share/doc/librrd-ruby$(RUBY_DEFAULT_VERS) /usr/share/doc/librrd-ruby
183         dh_installchangelogs -i -Nlibrrd-ruby CHANGES
184         dh_installdocs -i -Nlibrrd-ruby -A CONTRIBUTORS NEWS
185         dh_link -i -Nlibrrd-ruby
186         echo 'rubydefault:Depends=librrd-ruby$(RUBY_DEFAULT_VERS)' >> debian/librrd-ruby.substvars
187         dh_perl -i
188         dh_compress -i
189         dh_fixperms -i
190         dh_installdeb -i
191         dh_gencontrol -i
192         dh_md5sums -i
193         dh_builddeb -i
194         
196 binary-arch: build-arch install-arch
197         dh_testdir
198         dh_testroot
199         dh_installchangelogs -a CHANGES
200         dh_installdocs -a -A CONTRIBUTORS NEWS
201         dh_installdocs -a
202         echo 'tcl:Depends=tcl$(TCL_VERS) | tclsh' >> debian/rrdtool-tcl.substvars
203         dh_pysupport -ppython-rrdtool
204         dh_pysupport -prrdtool-dbg
205         dh_perl -a
206         dh_installman -a
207         dh_link -a
208         dh_strip -a --dbg-package=rrdtool-dbg
209         dh_compress -a
210         dh_fixperms -a
211         dh_makeshlibs -a -Nliblua5.1-rrd0 -Nliblua5.1-rrd-dev
212         dh_makeshlibs -pliblua5.1-rrd0 -pliblua5.1-rrd-dev -n
213         dh_installdeb -a
214         dh_shlibdeps -a
215         dh_gencontrol -a
216         dh_md5sums -a
217         dh_builddeb -a
220 binary: binary-arch binary-indep
221 .PHONY: build clean configure \
222         binary-indep binary-arch binary \
223         install install-arch \
224         install-python% clean-python% unpatch