Imported Upstream version 2.6.0p2
[debian/amanda] / packaging / deb / rules
1 #!/usr/bin/make -f
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)
5
6 #       Warning - do *not* use -j on an SMP machine, or the build gets
7 #               confused... some sort of race condition in the makefiles?
8
9 # Uncomment this to turn on verbose mode.
10 #export DH_VERBOSE=1
11 AMVER=2.6.0p2
12
13 # These are variables that the user can override.  They get used in various
14 # places during configure, build, and install.
15 PREFIX=/usr
16 BINDIR=$(PREFIX)/bin
17 LIBDIR=$(PREFIX)/lib
18 AMLIBDIR=$(LIBDIR)/amanda
19 LIBEXECDIR=$(PREFIX)/libexec
20 AMLIBEXECDIR=$(LIBEXECDIR)/amanda
21 MANDIR=$(PREFIX)/share/man
22 DOCDIR=$(PREFIX)/share/doc
23 SYSCONFDIR=/etc
24 LOCALSTATEDIR=/var
25 AMHOMEDIR=$(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
32 AMANDAGROUP=disk
33 WITHOUT_SERVER="False"
34 WITHOUT_CLIENT="False"
35
36 r=$(shell pwd)/debian/amanda-common
37 server=$(shell pwd)/debian/amanda-backup-server
38 client=$(shell pwd)/debian/amanda-backup-client
39
40 log=$(shell pwd)/debian/dpkg.log
41
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)
46
47 build: build-stamp 
48 build-stamp: /sbin/dump /usr/bin/smbclient 
49         dh_testdir
50         ./configure \
51                 MAKEFLAGS="-j1 " \
52                 CFLAGS="-DIGNORE_TAR_ERRORS " \
53                 MAILER=/usr/bin/mail \
54                 --quiet \
55                 --host=$(DEB_HOST_GNU_TYPE) \
56                 --build=$(DEB_BUILD_GNU_TYPE) \
57                 --prefix=$(PREFIX) \
58                 --bindir=$(BINDIR) \
59                 --mandir=$(MANDIR) \
60                 --libexecdir=$(LIBEXECDIR) \
61                 --enable-shared \
62                 --sysconfdir=$(SYSCONFDIR) \
63                 --localstatedir=$(LOCALSTATEDIR)\
64                 --with-gnutar-listdir=$(AMHOMEDIR)/gnutar-lists \
65                 --with-index-server=localhost \
66                 --with-tape-server=localhost \
67                 --with-user=$(AMANDAUSER) \
68                 --with-group=$(AMANDAGROUP) \
69                 --with-fqdn \
70                 --with-bsd-security \
71                 --with-bsdtcp-security \
72                 --with-bsdudp-security \
73                 --with-amandahosts \
74                 --with-smbclient=$(BINDIR)/smbclient \
75                 --with-debugging=$(LOGDIR) \
76                 --with-tcpportrange=11000,11040 \
77                 --with-udpportrange=700,740 \
78                 --with-low-udpportrange=700,710 \
79                 --with-ssh-security \
80                 --with-assertions \
81                 --enable-s3-device \
82                 --disable-installperms
83         touch missing
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
86         # appending here.
87         cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-client.preinst
88         cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-server.preinst
89         cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-client.postrm
90         cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-server.postrm
91         make 
92         touch build-stamp
93
94 clean:
95         dh_testdir >> $(log) 2>&1
96         dh_testroot >> $(log) 2>&1
97         -make clean
98         -make 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
106
107 # Build architecture-dependent files here.
108 binary-arch: build
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 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_installmenu: " >> $(log)
124         dh_installmenu -v >> $(log) 2>&1
125         echo "---->dh_installcron: " >> $(log)
126         dh_installcron >> $(log) 2>&1
127         echo "---->dh_installchangelogs: " >> $(log)
128         dh_installchangelogs -v >> $(log) 2>&1
129         echo "---->dh_installdebconf: " >> $(log)
130         dh_installdebconf -v >> $(log) 2>&1
131         # Here's how we get the perl modules installed into sitelib
132         echo $(PERLSITELIB)/* >> debian/amanda-backup-server.install
133         echo "---->dh_install -v --fail-missing: " >> $(log)
134         dh_install -v --sourcedir=debian/amanda-common >> $(log) 2>&1
135         echo "---->dh_strip: " >> $(log)
136         dh_strip >> $(log) 2>&1
137         echo "---->dh_compress: " >> $(log)
138         dh_compress >> $(log) 2>&1
139         echo "---->dh_fixperms: " >> $(log)
140         dh_fixperms -v >> $(log) 2>&1
141         # fix perms manually
142         chown -R $(AMANDAUSER):$(AMANDAGROUP) debian/*/var/lib/*
143         #chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
144         chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(LOGDIR) $(server)/$(LOGDIR)
145         #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(LOGDIR)
146         chown -R $(AMANDAUSER):$(AMANDAGROUP)  $(client)/$(SYSCONFDIR)/amanda $(server)/$(SYSCONFDIR)/amanda
147         #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(SYSCONFDIR)/amanda
148         chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(AMHOMEDIR)/gnutar-lists $(server)/$(AMHOMEDIR)/gnutar-lists
149         chmod -R u=rwX,g=rwX,o-rwx  $(client)/$(AMHOMEDIR)/gnutar-lists $(server)/$(AMHOMEDIR)/gnutar-lists
150         # .. setuid
151         chown root:disk \
152                 $(client)/$(AMLIBEXECDIR)/killpgrp \
153                 $(client)/$(AMLIBEXECDIR)/rundump \
154                 $(client)/$(AMLIBEXECDIR)/runtar \
155                 $(client)/$(AMLIBEXECDIR)/calcsize \
156                 $(server)/$(AMLIBEXECDIR)/killpgrp \
157                 $(server)/$(AMLIBEXECDIR)/rundump \
158                 $(server)/$(AMLIBEXECDIR)/runtar \
159                 $(server)/$(AMLIBEXECDIR)/calcsize \
160                 $(server)/$(AMLIBEXECDIR)/dumper \
161                 $(server)/$(AMLIBEXECDIR)/planner \
162                 $(server)/usr/sbin/amcheck
163         chmod u=srwx,g=rx,o=r \
164                 $(client)$(AMLIBEXECDIR)/killpgrp \
165                 $(client)$(AMLIBEXECDIR)/rundump \
166                 $(client)$(AMLIBEXECDIR)/runtar \
167                 $(client)$(AMLIBEXECDIR)/calcsize \
168                 $(server)$(AMLIBEXECDIR)/killpgrp \
169                 $(server)$(AMLIBEXECDIR)/rundump \
170                 $(server)$(AMLIBEXECDIR)/runtar \
171                 $(server)$(AMLIBEXECDIR)/calcsize \
172                 $(server)$(AMLIBEXECDIR)/dumper \
173                 $(server)$(AMLIBEXECDIR)/planner \
174                 $(server)/usr/sbin/amcheck
175         echo "Amanda version $(AMVER)" >  $(server)/$(AMHOMEDIR)/amanda-release 
176         echo "Amanda version $(AMVER)" >  $(client)/$(AMHOMEDIR)/amanda-release 
177         install -o root -g root -m 0644 debian/amanda-backup-client.lintian \
178                 $(client)/usr/share/lintian/overrides/amanda-backup-client
179         #install -o root -g root -m 0644 debian/amanda-common.lintian \
180         #       $(r)/usr/share/lintian/overrides/amanda-common
181         install -o root -g root -m 0644 debian/amanda-backup-server.lintian \
182                 $(server)/usr/share/lintian/overrides/amanda-backup-server
183         dh_makeshlibs  >> $(log) 2>&1
184         dh_installdeb >> $(log) 2>&1
185         dh_perl >> $(log) 2>&1
186         dh_shlibdeps -l"debian/$(r)/usr/lib:debian/$(client)/usr/lib:debian/$(server)/usr/lib" >> $(log) 2>&1
187         # strip out the non-versioned amanda-common references, we need
188         # the versioned ones in the control file and dupes are ugly...
189         sed -e 's/amanda-common, //' < debian/amanda-backup-server.substvars > debian/blah
190         mv debian/blah debian/amanda-backup-server.substvars
191         sed -e 's/amanda-common, //' < debian/amanda-backup-client.substvars > debian/blah
192         mv debian/blah debian/amanda-backup-client.substvars
193         dh_gencontrol >> $(log) 2>&1
194         dh_md5sums  >> $(log) 2>&1
195         dh_builddeb  >> $(log) 2>&1
196
197 source diff:                                                                  
198         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
199
200 binary: binary-arch
201 .PHONY: build clean binary-arch binary