un-do make check since there's no useful content .. fooled by INSTALL!
[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         touch build-stamp
57
58 clean:
59         dh_testdir
60         dh_testroot
61         [ ! -f Makefile ] || make clean
62         [ ! -f Makefile ] || make distclean
63         -rm -f build-stamp configure-stamp missing config/config.h common-src/genversion
64         -find . -type d -name .deps -exec rm -rf {} \;
65         dh_clean
66
67 # call this before packaging for upload when updating template English text
68 updatepo:
69         -rm -f debian/po/templates.pot
70         debconf-updatepo
71         
72 binary-indep: build
73
74 binary-arch: build
75         dh_testdir
76         dh_testroot
77         dh_clean -k
78         dh_installdirs -a
79         make install DESTDIR=$(r)
80         install -m 644 debian/amandahosts $(r)/etc/amandahosts
81         dh_installdocs -a
82         dh_installexamples -a
83         cp ChangeLog $(r)/usr/share/doc/amanda-common/changelog
84         cp debian/xinetd.d/amandaidx $(s)/etc/xinetd.d
85         cp debian/xinetd.d/amidxtape $(s)/etc/xinetd.d
86         cp debian/xinetd.d/amanda $(r)/etc/xinetd.d                     
87         dh_installmenu -a
88         dh_installcron -a
89         dh_installchangelogs -a
90         dh_installdebconf -a
91         dh_strip -a
92         dh_compress -a
93         dh_movefiles -a --sourcedir=debian/amanda-common
94         rm -r $(r)/usr/share/amanda
95         rm $(s)/usr/lib/amanda/chg-mtx
96         dh_fixperms -av
97         # fix perms manually
98         chown -R backup:backup debian/*/var/lib/*
99         chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
100         chown -R backup:backup $(s)/var/log/amanda
101         chmod -R u=rwX,g=rwX,o-rwx $(s)/var/log/amanda
102         chown -R backup:backup $(s)/etc/amanda
103         chmod -R u=rwX,g=rwX,o-rwx $(s)/etc/amanda
104         chown -R backup:backup $(c)/var/lib/amanda/gnutar-lists
105         chmod -R u=rwX,g=rwX,o-rwx $(c)/var/lib/amanda/gnutar-lists
106         # .. setuid
107         chown root:backup \
108                 $(c)/usr/lib/amanda/application/amgtar \
109                 $(c)/usr/lib/amanda/application/amstar \
110                 $(c)/usr/lib/amanda/calcsize \
111                 $(c)/usr/lib/amanda/killpgrp \
112                 $(c)/usr/lib/amanda/rundump \
113                 $(c)/usr/lib/amanda/runtar \
114                 $(s)/usr/lib/amanda/dumper \
115                 $(s)/usr/lib/amanda/planner \
116                 $(s)/usr/sbin/amcheck
117         chmod u=srwx,g=rx,o=r \
118                 $(c)/usr/lib/amanda/application/amgtar \
119                 $(c)/usr/lib/amanda/application/amstar \
120                 $(c)/usr/lib/amanda/calcsize \
121                 $(c)/usr/lib/amanda/killpgrp \
122                 $(c)/usr/lib/amanda/rundump \
123                 $(c)/usr/lib/amanda/runtar \
124                 $(s)/usr/lib/amanda/dumper \
125                 $(s)/usr/lib/amanda/planner \
126                 $(s)/usr/sbin/amcheck
127         install -o root -g root -m 0644 debian/amanda-client.lintian \
128                 $(c)/usr/share/lintian/overrides/amanda-client
129 #       install -o root -g root -m 0644 debian/amanda-common.lintian \
130 #               $(r)/usr/share/lintian/overrides/amanda-common
131         install -o root -g root -m 0644 debian/amanda-server.lintian \
132                 $(s)/usr/share/lintian/overrides/amanda-server
133         dh_makeshlibs -pamanda-common --noscripts
134         dh_installdeb -a
135         dh_perl -a
136         dh_shlibdeps -a -l"debian/amanda-common/usr/lib:debian/amanda-client/usr/lib:debian/amanda-server/usr/lib"
137         # strip out the non-versioned amanda-common references, we need
138         # the versioned ones in the control file and dupes are ugly...
139         sed -e 's/amanda-common, //' < debian/amanda-server.substvars > debian/blah
140         mv debian/blah debian/amanda-server.substvars
141         sed -e 's/amanda-common, //' < debian/amanda-client.substvars > debian/blah
142         mv debian/blah debian/amanda-client.substvars
143         dh_gencontrol -a
144         dh_md5sums -a
145         dh_builddeb -a
146
147 source diff:                                                                  
148         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
149
150 binary: binary-indep binary-arch
151 .PHONY: build clean binary-indep binary-arch binary