2 # debian/rules for amanda using debhelper. GNU copyright 2008 by Dan Locks,
3 # based on work by Bdale Garbee.
5 # Warning - do *not* use -j on an SMP machine, or the build gets
6 # confused... some sort of race condition in the makefiles?
8 # Uncomment this to turn on verbose mode.
12 # These are variables that the user can override. They get used in various
13 # places during configure, build, and install.
17 AMLIBDIR=$(LIBDIR)/amanda
18 LIBEXECDIR=$(PREFIX)/libexec
19 AMLIBEXECDIR=$(LIBEXECDIR)/amanda
20 MANDIR=$(PREFIX)/share/man
21 DOCDIR=$(PREFIX)/share/doc
24 AMANDAHOMEDIR=$(LOCALSTATEDIR)/lib/amanda
25 LOGDIR=$(LOCALSTATEDIR)/log/amanda
26 # Extract the perl site_lib directory. This is used to install amanda's perl
27 # libs. If configure finds a different install or you specify a different path using
28 # --with-amperldir= make sure you change this variable as well.
29 PERLSITELIB=$(shell perl -V:installsitelib|sed -e"s:installsitelib='/::;s:'\;::")
30 AMANDAUSER=amandabackup
32 WITHOUT_SERVER="False"
33 WITHOUT_CLIENT="False"
35 r=$(shell pwd)/debian/tmp
36 server=$(shell pwd)/debian/amanda-backup-server
37 client=$(shell pwd)/debian/amanda-backup-client
39 log=$(shell pwd)/debian/dpkg.log
41 # These are used for cross-compiling and for saving the configure script
42 # from having to guess our platform (since we know it already)
43 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
44 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
49 build-stamp: /sbin/dump /usr/bin/smbclient
54 MAILER=/usr/bin/mail \
57 --host=$(DEB_HOST_GNU_TYPE) \
58 --build=$(DEB_BUILD_GNU_TYPE) \
62 --libexecdir=$(LIBEXECDIR) \
64 --sysconfdir=$(SYSCONFDIR) \
65 --localstatedir=$(LOCALSTATEDIR) \
66 --with-amdatadir=$(AMANDAHOMEDIR) \
67 --with-gnutar-listdir=$(AMANDAHOMEDIR)/gnutar-lists \
68 --with-index-server=localhost \
69 --with-tape-server=localhost \
70 --with-user=$(AMANDAUSER) \
71 --with-group=$(AMANDAGROUP) \
74 --with-bsdtcp-security \
75 --with-bsdudp-security \
77 --with-smbclient=$(BINDIR)/smbclient \
78 --with-debugging=$(LOGDIR) \
82 --disable-installperms
84 # There's probably a better way to do this. Preinst and postrm are the
85 # same for client and server, but we leave room for differences by just
87 cat $(WD)/debian/preinst >> $(WD)/debian/amanda-backup-client.preinst
88 cat $(WD)/debian/preinst >> $(WD)/debian/amanda-backup-server.preinst
89 cat $(WD)/debian/postrm >> $(WD)/debian/amanda-backup-client.postrm
90 cat $(WD)/debian/postrm >> $(WD)/debian/amanda-backup-server.postrm
91 make -s LIBTOOLFLAGS=--silent
95 dh_testdir >> $(log) 2>&1
96 dh_testroot >> $(log) 2>&1
97 -make -s LIBTOOLFLAGS=--silent clean
98 -make -s LIBTOOLFLAGS=--silent distclean
99 -rm -f build-stamp missing config/config.h common-src/genversion
100 -find . -type d -name .deps -exec rm -rf {} \;
101 -test -r /usr/share/misc/config.sub && \
102 cp -f /usr/share/misc/config.sub config/config.sub
103 -test -r /usr/share/misc/config.guess && \
104 cp -f /usr/share/misc/config.guess config/config.guess
105 dh_clean >> $(log) 2>&1
107 # Build architecture-dependent files here.
109 echo "---->dh_testdir: " >> $(log)
110 dh_testdir >> $(log) 2>&1
111 echo "---->dh_testroot: " >> $(log)
112 dh_testroot >> $(log) 2>&1
113 echo "---->dh_clean: " >> $(log)
114 dh_clean -k >> $(log) 2>&1
115 echo "---->dh_installdirs: " >> $(log)
116 dh_installdirs -v >> $(log) 2>&1
117 make -s LIBTOOLFLAGS=--silent install DESTDIR=$(r)
118 echo "---->dh_installdocs: " >> $(log)
119 dh_installdocs -v >> $(log) 2>&1
120 install -d $(r)/$(DOCDIR)/amanda-common/examples
121 cp -a example/* $(r)/$(DOCDIR)/amanda-common/examples
122 cp ChangeLog $(r)/$(DOCDIR)/amanda-common/changelog
123 echo "---->dh_installchangelogs: " >> $(log)
124 dh_installchangelogs -v >> $(log) 2>&1
125 # Here's how we get the perl modules installed into sitelib
126 echo $(PERLSITELIB)/* >> debian/amanda-backup-server.install
127 echo "---->dh_install -v --fail-missing: " >> $(log)
128 dh_install -v --sourcedir=$(r) >> $(log) 2>&1
129 echo "---->dh_strip: " >> $(log)
130 dh_strip >> $(log) 2>&1
131 echo "---->dh_compress: " >> $(log)
132 dh_compress >> $(log) 2>&1
133 echo "---->dh_fixperms: " >> $(log)
134 dh_fixperms -v >> $(log) 2>&1
136 chown -R $(AMANDAUSER):$(AMANDAGROUP) debian/*/var/lib/*
137 #chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
138 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(LOGDIR) $(server)/$(LOGDIR)
139 #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(LOGDIR)
140 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(SYSCONFDIR)/amanda $(server)/$(SYSCONFDIR)/amanda
141 chmod -R u=rwX,g=rwX,o-rwx $(client)/$(SYSCONFDIR)/amanda
142 chmod -R u=rwX,g=rwX,o-rwx $(server)/$(SYSCONFDIR)/amanda
143 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(AMANDAHOMEDIR)/gnutar-lists $(server)/$(AMANDAHOMEDIR)/gnutar-lists
144 chmod -R u=rwX,g=rwX,o-rwx $(client)/$(AMANDAHOMEDIR)/gnutar-lists $(server)/$(AMANDAHOMEDIR)/gnutar-lists
147 $(client)/$(AMLIBEXECDIR)/application/amgtar \
148 $(client)/$(AMLIBEXECDIR)/application/amstar \
149 $(client)/$(AMLIBEXECDIR)/killpgrp \
150 $(client)/$(AMLIBEXECDIR)/rundump \
151 $(client)/$(AMLIBEXECDIR)/runtar \
152 $(client)/$(AMLIBEXECDIR)/calcsize \
153 $(server)/$(AMLIBEXECDIR)/application/amgtar \
154 $(server)/$(AMLIBEXECDIR)/application/amstar \
155 $(server)/$(AMLIBEXECDIR)/killpgrp \
156 $(server)/$(AMLIBEXECDIR)/rundump \
157 $(server)/$(AMLIBEXECDIR)/runtar \
158 $(server)/$(AMLIBEXECDIR)/calcsize \
159 $(server)/$(AMLIBEXECDIR)/dumper \
160 $(server)/$(AMLIBEXECDIR)/planner \
161 $(server)/usr/sbin/amcheck \
162 $(server)/usr/sbin/amservice
163 chmod u=srwx,g=rx,o=r \
164 $(client)/$(AMLIBEXECDIR)/application/amgtar \
165 $(client)/$(AMLIBEXECDIR)/application/amstar \
166 $(client)$(AMLIBEXECDIR)/killpgrp \
167 $(client)$(AMLIBEXECDIR)/rundump \
168 $(client)$(AMLIBEXECDIR)/runtar \
169 $(client)$(AMLIBEXECDIR)/calcsize \
170 $(server)/$(AMLIBEXECDIR)/application/amgtar \
171 $(server)/$(AMLIBEXECDIR)/application/amstar \
172 $(server)$(AMLIBEXECDIR)/killpgrp \
173 $(server)$(AMLIBEXECDIR)/rundump \
174 $(server)$(AMLIBEXECDIR)/runtar \
175 $(server)$(AMLIBEXECDIR)/calcsize \
176 $(server)$(AMLIBEXECDIR)/dumper \
177 $(server)$(AMLIBEXECDIR)/planner \
178 $(server)/usr/sbin/amcheck \
179 $(server)/usr/sbin/amservice
180 echo "Amanda version $(AMVER)" > $(server)/$(AMANDAHOMEDIR)/amanda-release
181 echo "Amanda version $(AMVER)" > $(client)/$(AMANDAHOMEDIR)/amanda-release
182 install -o root -g root -m 0644 debian/amanda-backup-client.lintian \
183 $(client)/usr/share/lintian/overrides/amanda-backup-client
184 install -o root -g root -m 0644 debian/amanda-backup-server.lintian \
185 $(server)/usr/share/lintian/overrides/amanda-backup-server
186 dh_makeshlibs >> $(log) 2>&1
187 dh_perl >> $(log) 2>&1
188 dh_shlibdeps -l"$(r)/usr/lib:$(client)/usr/lib:$(server)/usr/lib" >> $(log) 2>&1
189 dh_installdeb >> $(log) 2>&1
190 dh_gencontrol >> $(log) 2>&1
191 dh_md5sums >> $(log) 2>&1
192 dh_builddeb >> $(log) 2>&1
195 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
198 .PHONY: build clean binary-arch binary