initial debian build system added -- Mike Slifcak <slif@bellsouth.net>
[rrdtool.git] / debian / rules
1 #!/usr/bin/make -f
2 #-*- makefile -*-
3 # Made with the aid of dh_make, by Craig Small
4 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
5 # This version is for a hypothetical package that builds an
6 # architecture-dependant package, as well as an architecture-independant
7 # package.
8
9 package:=rrdtool
10
11 top_srcdir:=$(shell pwd)
12 tmp:=$(top_srcdir)/debian/tmp
13
14 # TCL installation stuff (must match tcl/Makefile.am)
15 tclconfigdir = /usr/lib/tcl8.4
16
17 # Uncomment this to turn on verbose mode. 
18 #export DH_VERBOSE=1
19
20 # This is the debhelper compatability version to use.
21 export DH_COMPAT=2
22
23 # Defaults
24 CFLAGS := -O2
25
26 # Handle DEB_BUILD_OPTIONS
27 ifneq "$(findstring debug,$(DEB_BUILD_OPTIONS))" ""
28 CFLAGS += -g
29 endif
30
31 # Whack the flags to compile additional dependent pieces
32 CFLAGS += -I/usr/include/libart-2.0 -I/usr/local/include/freetype2
33
34 ##NO_TCL CFLAGS += -I/usr/include/tcl8.4
35
36 configure: configure-stamp
37 configure-stamp:
38         dh_testdir
39         # Make sure we can find tcl stuff (configure won't fail)
40         test -f $(tclconfigdir)/tclConfig.sh
41
42         # Configure C and Tcl stuff
43 ##NO_TCL        CFLAGS="$(CFLAGS)" ./configure --prefix=/usr --enable-shared=yes --enable-static=yes --with-tcllib=$(tclconfigdir) --enable-local-libpng=yes --enable-local-zlib=yes
44         CFLAGS="$(CFLAGS)" ./configure --prefix=/usr --enable-shared=yes --enable-static=yes --enable-local-libpng=yes --enable-local-zlib=yes
45
46         # Configure Perl stuff
47         cd bindings/perl-piped && \
48                 rm -f Makefile && \
49                 perl Makefile.PL INSTALLDIRS=vendor
50
51         cd bindings/perl-shared && \
52                 rm -f Makefile && \
53                 perl Makefile.PL INSTALLDIRS=vendor
54
55         touch configure-stamp
56
57 build: build-stamp
58 build-stamp: configure-stamp
59         dh_testdir
60
61         # Build most stuff
62         $(MAKE)
63
64         # We now build perl-piped and perl-shared separately
65         cd bindings/perl-piped && make OPTIMIZE="$(CFLAGS)"
66         cd bindings/perl-shared && make OPTIMIZE="$(CFLAGS)"
67
68         touch build-stamp
69
70 clean:
71         dh_testdir
72         dh_testroot
73         rm -f build-stamp configure-stamp
74
75         # Add here commands to clean up after the build process.
76         -$(MAKE) distclean
77
78         -rm bindings/perl*/Makefile.old bindings/perl*/Makefile
79
80         dh_clean
81
82 install: build-stamp
83         dh_testdir
84         dh_testroot
85         dh_clean -k
86         dh_installdirs
87
88         # Add here commands to install the package into debian/tmp.
89 ##NO_TCL        $(MAKE) install site-tcl-install DESTDIR=$(tmp)
90         $(MAKE) install DESTDIR=$(tmp)
91
92         mkdir -p $(tmp)/usr/share/doc
93         mv $(tmp)/usr/doc $(tmp)/usr/share/doc/rrdtool
94         mkdir -p $(tmp)/usr/share/rrdtool
95         mv $(tmp)/usr/examples $(tmp)/usr/share/rrdtool
96         mv $(tmp)/usr/html $(tmp)/usr/share/rrdtool
97
98         ## touch-up perl docs
99         mv $(tmp)/usr/man $(tmp)/usr/share
100         mkdir -p $(tmp)/usr/share/man/man3
101         mv $(tmp)/usr/share/man/man1/RRDs.1 $(tmp)/usr/share/man/man3/RRDs.3pm
102         mv $(tmp)/usr/share/man/man1/RRDp.1 $(tmp)/usr/share/man/man3/RRDp.3pm
103         mv $(tmp)/usr/lib/perl $(tmp)/usr/lib/perl5
104
105         dh_movefiles
106
107 # Build architecture-independent files here.
108 binary-indep: build install
109 #       dh_testversion
110         dh_testdir -i
111         dh_testroot -i
112         dh_installdocs -i
113 #       dh_installexamples -i
114 #       dh_installmenu -i
115 #       dh_installemacsen -i
116 #       dh_installpam -i
117 #       dh_installinit -i
118 #       dh_installcron -i
119 #       dh_installmanpages -i
120 #       dh_installinfo -i
121 #       dh_undocumented
122 #LATER  dh_installchangelogs -i ChangeLog
123         dh_link -i
124         dh_compress -i
125         dh_fixperms -i
126         # You may want to make some executables suid here.
127 #       dh_suidregister -i
128         dh_installdeb -i
129         dh_perl -i
130         dh_gencontrol -i
131         dh_md5sums -i
132         dh_builddeb -i
133
134 # Build architecture-dependent files here.
135 binary-arch: build install
136 #       dh_testversion
137         dh_testdir -a
138         dh_testroot -a
139         dh_installdocs -a
140 #       dh_installexamples -a
141 #       dh_installmenu -a
142 #       dh_installemacsen -a
143 #       dh_installpam -a
144 #       dh_installinit -a
145 #       dh_installcron -a
146 #       dh_installmanpages -a
147 #       dh_installinfo -a
148 #       dh_undocumented
149 #LATER  dh_installchangelogs -a ChangeLog
150 ifeq "$(findstring nostrip,$(DEB_BUILD_OPTIONS))" ""
151         dh_strip -a
152 endif
153         dh_link -a
154         dh_compress -a -Xexamples/
155         dh_fixperms -a
156         # You may want to make some executables suid here.
157 #       dh_suidregister -a
158 #       dh_makeshlibs -a
159         dh_installdeb -a
160         dh_perl -a
161         dh_shlibdeps -a -ldebian/librrd0/usr/lib
162         dh_gencontrol -a
163         dh_md5sums -a
164         dh_builddeb -a
165
166 source diff:                                                                  
167         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
168
169 binary: binary-indep binary-arch
170 .PHONY: build clean binary-indep binary-arch binary install