add make check to the rules file
[debian/amanda] / debian / rules
1 #!/usr/bin/make -f
2 # debian/rules for amanda using debhelper
3 # Copyright 1998-2009 by Bdale Garbee.  License GPL v2
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 r=$(shell pwd)/debian/amanda-common
9 s=$(shell pwd)/debian/amanda-server
10 c=$(shell pwd)/debian/amanda-client
11
12 configure: configure-stamp
13 configure-stamp:
14         dh_testdir
15         # pick up latest config files provided by autotools-dev
16         cp -f /usr/share/misc/config.sub config/config.sub
17         cp -f /usr/share/misc/config.guess config/config.guess
18         # do we need --{htmldir,dvidir,pdfdir,psdir} to force subdirectories?
19         # should we re-craft this to use --without-server and --without-client,
20         #       and lose the amanda-common package?
21         MAILER=/usr/bin/mail \
22         SSH=/usr/bin/ssh \
23         ./configure \
24                 --prefix=/usr \
25                 --bindir=/usr/sbin \
26                 --libexecdir=/usr/lib/amanda \
27                 --without-amlibexecdir \
28                 --without-amperldir \
29                 --sysconfdir=/etc \
30                 --sharedstatedir=/var/lib \
31                 --localstatedir=/var/lib \
32                 --with-user=backup \
33                 --with-group=backup  \
34                 --with-tcpportrange=50000,50100 \
35                 --with-udpportrange=840,860 \
36                 --with-debugging=/var/log/amanda \
37                 --with-gnutar-listdir=/var/lib/amanda/gnutar-lists \
38                 --with-index-server=localhost \
39                 --with-bsd-security \
40                 --with-smbclient=/usr/bin/smbclient \
41                 --with-amandahosts \
42                 --with-ssh-security \
43                 --with-bsdtcp-security \
44                 --with-bsdudp-security \
45                 --without-ipv6
46
47         touch missing
48         touch configure-stamp
49
50 build: build-stamp 
51 build-stamp: configure-stamp
52         dh_testdir
53         MAILER=/usr/bin/mail $(MAKE) CFLAGS="-O2 -g -Wall \
54                 -DAMANDATES_FILE='\"/var/lib/amanda/amandates\"' \
55                 -DIGNORE_TAR_ERRORS "
56 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
57 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
58         $(MAKE) check
59 endif
60 endif
61         touch build-stamp
62
63 clean:
64         dh_testdir
65         dh_testroot
66         [ ! -f Makefile ] || make clean
67         [ ! -f Makefile ] || make distclean
68         -rm -f build-stamp configure-stamp missing config/config.h common-src/genversion
69         -find . -type d -name .deps -exec rm -rf {} \;
70         dh_clean
71
72 # call this before packaging for upload when updating template English text
73 updatepo:
74         -rm -f debian/po/templates.pot
75         debconf-updatepo
76         
77 binary-indep: build
78
79 binary-arch: build
80         dh_testdir
81         dh_testroot
82         dh_clean -k
83         dh_installdirs -a
84         make install DESTDIR=$(r)
85         install -m 644 debian/amandahosts $(r)/etc/amandahosts
86         dh_installdocs -a
87         dh_installexamples -a
88         cp ChangeLog $(r)/usr/share/doc/amanda-common/changelog
89         cp debian/xinetd.d/amandaidx $(s)/etc/xinetd.d
90         cp debian/xinetd.d/amidxtape $(s)/etc/xinetd.d
91         cp debian/xinetd.d/amanda $(r)/etc/xinetd.d                     
92         dh_installmenu -a
93         dh_installcron -a
94         dh_installchangelogs -a
95         dh_installdebconf -a
96         dh_strip -a
97         dh_compress -a
98         dh_movefiles -a --sourcedir=debian/amanda-common
99         rm -r $(r)/usr/share/amanda
100         rm $(s)/usr/lib/amanda/chg-mtx
101         dh_fixperms -av
102         # fix perms manually
103         chown -R backup:backup debian/*/var/lib/*
104         chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
105         chown -R backup:backup $(s)/var/log/amanda
106         chmod -R u=rwX,g=rwX,o-rwx $(s)/var/log/amanda
107         chown -R backup:backup $(s)/etc/amanda
108         chmod -R u=rwX,g=rwX,o-rwx $(s)/etc/amanda
109         chown -R backup:backup $(c)/var/lib/amanda/gnutar-lists
110         chmod -R u=rwX,g=rwX,o-rwx $(c)/var/lib/amanda/gnutar-lists
111         # .. setuid
112         chown root:backup \
113                 $(c)/usr/lib/amanda/application/amgtar \
114                 $(c)/usr/lib/amanda/application/amstar \
115                 $(c)/usr/lib/amanda/calcsize \
116                 $(c)/usr/lib/amanda/killpgrp \
117                 $(c)/usr/lib/amanda/rundump \
118                 $(c)/usr/lib/amanda/runtar \
119                 $(s)/usr/lib/amanda/dumper \
120                 $(s)/usr/lib/amanda/planner \
121                 $(s)/usr/sbin/amcheck
122         chmod u=srwx,g=rx,o=r \
123                 $(c)/usr/lib/amanda/application/amgtar \
124                 $(c)/usr/lib/amanda/application/amstar \
125                 $(c)/usr/lib/amanda/calcsize \
126                 $(c)/usr/lib/amanda/killpgrp \
127                 $(c)/usr/lib/amanda/rundump \
128                 $(c)/usr/lib/amanda/runtar \
129                 $(s)/usr/lib/amanda/dumper \
130                 $(s)/usr/lib/amanda/planner \
131                 $(s)/usr/sbin/amcheck
132         install -o root -g root -m 0644 debian/amanda-client.lintian \
133                 $(c)/usr/share/lintian/overrides/amanda-client
134 #       install -o root -g root -m 0644 debian/amanda-common.lintian \
135 #               $(r)/usr/share/lintian/overrides/amanda-common
136         install -o root -g root -m 0644 debian/amanda-server.lintian \
137                 $(s)/usr/share/lintian/overrides/amanda-server
138         dh_makeshlibs -pamanda-common --noscripts
139         dh_installdeb -a
140         dh_perl -a
141         dh_shlibdeps -a -l"debian/amanda-common/usr/lib:debian/amanda-client/usr/lib:debian/amanda-server/usr/lib"
142         # strip out the non-versioned amanda-common references, we need
143         # the versioned ones in the control file and dupes are ugly...
144         sed -e 's/amanda-common, //' < debian/amanda-server.substvars > debian/blah
145         mv debian/blah debian/amanda-server.substvars
146         sed -e 's/amanda-common, //' < debian/amanda-client.substvars > debian/blah
147         mv debian/blah debian/amanda-client.substvars
148         dh_gencontrol -a
149         dh_md5sums -a
150         dh_builddeb -a
151
152 source diff:                                                                  
153         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
154
155 binary: binary-indep binary-arch
156 .PHONY: build clean binary-indep binary-arch binary