2 # debian/rules for amanda using debhelper. GNU copyright 2008 by Dan Locks,
3 # based on work by Bdale Garbee.
4 # requires automake 1.2d (from experimental tree)
6 # Warning - do *not* use -j on an SMP machine, or the build gets
7 # confused... some sort of race condition in the makefiles?
9 # Uncomment this to turn on verbose mode.
13 # These are variables that the user can override. They get used in various
14 # places during configure, build, and install.
18 AMLIBDIR=$(LIBDIR)/amanda
19 LIBEXECDIR=$(PREFIX)/libexec
20 AMLIBEXECDIR=$(LIBEXECDIR)/amanda
21 MANDIR=$(PREFIX)/share/man
22 DOCDIR=$(PREFIX)/share/doc
25 AMANDAHOMEDIR=$(LOCALSTATEDIR)/lib/amanda
26 LOGDIR=$(LOCALSTATEDIR)/log/amanda
27 # Extract the perl site_lib directory. This is used to install amanda's perl
28 # libs. If configure finds a different install or you specify a different path using
29 # --with-amperldir= make sure you change this variable as well.
30 PERLSITELIB=$(shell perl -V:installsitelib|sed -e"s:installsitelib='/::;s:'\;::")
31 AMANDAUSER=amandabackup
33 WITHOUT_SERVER="False"
34 WITHOUT_CLIENT="False"
36 r=$(shell pwd)/debian/tmp
37 server=$(shell pwd)/debian/amanda-backup-server
38 client=$(shell pwd)/debian/amanda-backup-client
40 log=$(shell pwd)/debian/dpkg.log
42 # These are used for cross-compiling and for saving the configure script
43 # from having to guess our platform (since we know it already)
44 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
45 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
50 build-stamp: /sbin/dump /usr/bin/smbclient
55 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) \
79 --with-tcpportrange=11000,11040 \
80 --with-low-tcpportrange=700,710 \
81 --with-udpportrange=700,740 \
85 --disable-installperms
87 # There's probably a better way to do this. Preinst and postrm are the
88 # same for client and server, but we leave room for differences by just
90 cat $(WD)/debian/preinst >> $(WD)/debian/amanda-backup-client.preinst
91 cat $(WD)/debian/preinst >> $(WD)/debian/amanda-backup-server.preinst
92 cat $(WD)/debian/postrm >> $(WD)/debian/amanda-backup-client.postrm
93 cat $(WD)/debian/postrm >> $(WD)/debian/amanda-backup-server.postrm
94 make -s LIBTOOLFLAGS=--silent
98 dh_testdir >> $(log) 2>&1
99 dh_testroot >> $(log) 2>&1
100 -make -s LIBTOOLFLAGS=--silent clean
101 -make -s LIBTOOLFLAGS=--silent distclean
102 -rm -f build-stamp missing config/config.h common-src/genversion
103 -find . -type d -name .deps -exec rm -rf {} \;
104 -test -r /usr/share/misc/config.sub && \
105 cp -f /usr/share/misc/config.sub config/config.sub
106 -test -r /usr/share/misc/config.guess && \
107 cp -f /usr/share/misc/config.guess config/config.guess
108 dh_clean >> $(log) 2>&1
110 # Build architecture-dependent files here.
112 echo "---->dh_testdir: " >> $(log)
113 dh_testdir >> $(log) 2>&1
114 echo "---->dh_testroot: " >> $(log)
115 dh_testroot >> $(log) 2>&1
116 echo "---->dh_clean: " >> $(log)
117 dh_clean -k >> $(log) 2>&1
118 echo "---->dh_installdirs: " >> $(log)
119 dh_installdirs -v >> $(log) 2>&1
120 make -s LIBTOOLFLAGS=--silent install DESTDIR=$(r)
121 echo "---->dh_installdocs: " >> $(log)
122 dh_installdocs -v >> $(log) 2>&1
123 install -d $(r)/$(DOCDIR)/amanda-common/examples
124 cp -a example/* $(r)/$(DOCDIR)/amanda-common/examples
125 cp ChangeLog $(r)/$(DOCDIR)/amanda-common/changelog
126 echo "---->dh_installchangelogs: " >> $(log)
127 dh_installchangelogs -v >> $(log) 2>&1
128 # Here's how we get the perl modules installed into sitelib
129 echo $(PERLSITELIB)/* >> debian/amanda-backup-server.install
130 echo "---->dh_install -v --fail-missing: " >> $(log)
131 dh_install -v --sourcedir=$(r) >> $(log) 2>&1
132 echo "---->dh_strip: " >> $(log)
133 dh_strip >> $(log) 2>&1
134 echo "---->dh_compress: " >> $(log)
135 dh_compress >> $(log) 2>&1
136 echo "---->dh_fixperms: " >> $(log)
137 dh_fixperms -v >> $(log) 2>&1
139 chown -R $(AMANDAUSER):$(AMANDAGROUP) debian/*/var/lib/*
140 #chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
141 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(LOGDIR) $(server)/$(LOGDIR)
142 #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(LOGDIR)
143 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(SYSCONFDIR)/amanda $(server)/$(SYSCONFDIR)/amanda
144 chmod -R u=rwX,g=rwX,o-rwx $(client)/$(SYSCONFDIR)/amanda
145 chmod -R u=rwX,g=rwX,o-rwx $(server)/$(SYSCONFDIR)/amanda
146 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(AMANDAHOMEDIR)/gnutar-lists $(server)/$(AMANDAHOMEDIR)/gnutar-lists
147 chmod -R u=rwX,g=rwX,o-rwx $(client)/$(AMANDAHOMEDIR)/gnutar-lists $(server)/$(AMANDAHOMEDIR)/gnutar-lists
150 $(client)/$(AMLIBEXECDIR)/application/amgtar \
151 $(client)/$(AMLIBEXECDIR)/application/amstar \
152 $(client)/$(AMLIBEXECDIR)/killpgrp \
153 $(client)/$(AMLIBEXECDIR)/rundump \
154 $(client)/$(AMLIBEXECDIR)/runtar \
155 $(client)/$(AMLIBEXECDIR)/calcsize \
156 $(server)/$(AMLIBEXECDIR)/application/amgtar \
157 $(server)/$(AMLIBEXECDIR)/application/amstar \
158 $(server)/$(AMLIBEXECDIR)/killpgrp \
159 $(server)/$(AMLIBEXECDIR)/rundump \
160 $(server)/$(AMLIBEXECDIR)/runtar \
161 $(server)/$(AMLIBEXECDIR)/calcsize \
162 $(server)/$(AMLIBEXECDIR)/dumper \
163 $(server)/$(AMLIBEXECDIR)/planner \
164 $(server)/usr/sbin/amcheck
165 chmod u=srwx,g=rx,o=r \
166 $(client)/$(AMLIBEXECDIR)/application/amgtar \
167 $(client)/$(AMLIBEXECDIR)/application/amstar \
168 $(client)$(AMLIBEXECDIR)/killpgrp \
169 $(client)$(AMLIBEXECDIR)/rundump \
170 $(client)$(AMLIBEXECDIR)/runtar \
171 $(client)$(AMLIBEXECDIR)/calcsize \
172 $(server)/$(AMLIBEXECDIR)/application/amgtar \
173 $(server)/$(AMLIBEXECDIR)/application/amstar \
174 $(server)$(AMLIBEXECDIR)/killpgrp \
175 $(server)$(AMLIBEXECDIR)/rundump \
176 $(server)$(AMLIBEXECDIR)/runtar \
177 $(server)$(AMLIBEXECDIR)/calcsize \
178 $(server)$(AMLIBEXECDIR)/dumper \
179 $(server)$(AMLIBEXECDIR)/planner \
180 $(server)/usr/sbin/amcheck
181 echo "Amanda version $(AMVER)" > $(server)/$(AMANDAHOMEDIR)/amanda-release
182 echo "Amanda version $(AMVER)" > $(client)/$(AMANDAHOMEDIR)/amanda-release
183 install -o root -g root -m 0644 debian/amanda-backup-client.lintian \
184 $(client)/usr/share/lintian/overrides/amanda-backup-client
185 install -o root -g root -m 0644 debian/amanda-backup-server.lintian \
186 $(server)/usr/share/lintian/overrides/amanda-backup-server
187 dh_makeshlibs >> $(log) 2>&1
188 dh_perl >> $(log) 2>&1
189 dh_shlibdeps -l"$(r)/usr/lib:$(client)/usr/lib:$(server)/usr/lib" >> $(log) 2>&1
190 dh_installdeb >> $(log) 2>&1
191 dh_gencontrol >> $(log) 2>&1
192 dh_md5sums >> $(log) 2>&1
193 dh_builddeb >> $(log) 2>&1
196 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
199 .PHONY: build clean binary-arch binary