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