Imported Upstream version 2.6.0
[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.0
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 AMANDAUSER=amandabackup
28 AMANDAGROUP=disk
29 WITHOUT_SERVER="False"
30 WITHOUT_CLIENT="False"
31
32 r=$(shell pwd)/debian/amanda-common
33 server=$(shell pwd)/debian/amanda-backup-server
34 client=$(shell pwd)/debian/amanda-backup-client
35
36 log=$(shell pwd)/debian/dpkg.log
37
38 # These are used for cross-compiling and for saving the configure script
39 # from having to guess our platform (since we know it already)
40 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
41 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
42
43 build: build-stamp 
44 build-stamp: /sbin/dump /usr/bin/smbclient 
45         dh_testdir
46         ./configure \
47                 MAKEFLAGS="-j1 " \
48                 CFLAGS="-DIGNORE_TAR_ERRORS " \
49                 MAILER=/usr/bin/mail \
50                 --quiet \
51                 --host=$(DEB_HOST_GNU_TYPE) \
52                 --build=$(DEB_BUILD_GNU_TYPE) \
53                 --prefix=$(PREFIX) \
54                 --bindir=$(BINDIR) \
55                 --mandir=$(MANDIR) \
56                 --libexecdir=$(LIBEXECDIR) \
57                 --enable-shared \
58                 --sysconfdir=$(SYSCONFDIR) \
59                 --localstatedir=$(LOCALSTATEDIR)\
60                 --with-star=/bin/star \
61                 --with-gnutar=/bin/tar \
62                 --with-gnutar-listdir=$(AMHOMEDIR)/gnutar-lists \
63                 --with-index-server=localhost \
64                 --with-tape-server=localhost \
65                 --with-user=$(AMANDAUSER) \
66                 --with-group=$(AMANDAGROUP) \
67                 --with-fqdn \
68                 --with-bsd-security \
69                 --with-bsdtcp-security \
70                 --with-bsdudp-security \
71                 --with-amandahosts \
72                 --with-smbclient=$(BINDIR)/smbclient \
73                 --with-debugging=$(LOGDIR) \
74                 --with-tcpportrange=11000,11040 \
75                 --with-udpportrange=700,740 \
76                 --with-low-udpportrange=700,710 \
77                 --with-ssh-security \
78                 --with-assertions \
79                 --enable-s3-device \
80                 --disable-installperms
81         touch missing
82         make 
83         touch build-stamp
84
85 clean:
86         dh_testdir >> $(log) 2>&1
87         dh_testroot >> $(log) 2>&1
88         -make clean
89         -make distclean
90         -rm -f build-stamp missing config/config.h common-src/genversion
91         -find . -type d -name .deps -exec rm -rf {} \;
92         -test -r /usr/share/misc/config.sub && \
93                 cp -f /usr/share/misc/config.sub config/config.sub
94         -test -r /usr/share/misc/config.guess && \
95                 cp -f /usr/share/misc/config.guess config/config.guess
96         dh_clean >> $(log) 2>&1
97
98 # Build architecture-dependent files here.
99 binary-arch: build
100         echo "---->dh_testdir: " >> $(log)
101         dh_testdir >> $(log) 2>&1
102         echo "---->dh_testroot: " >> $(log)
103         dh_testroot >> $(log) 2>&1
104         echo "---->dh_clean: " >> $(log)
105         dh_clean -k >> $(log) 2>&1
106         echo "---->dh_installdirs: " >> $(log)
107         dh_installdirs -v >> $(log) 2>&1
108         make install DESTDIR=$(r)
109         echo "---->dh_installdocs: " >> $(log)
110         dh_installdocs -v >> $(log) 2>&1
111         install -d $(r)/$(DOCDIR)/amanda-common/examples
112         cp -a example/* $(r)/$(DOCDIR)/amanda-common/examples
113         cp ChangeLog $(r)/$(DOCDIR)/amanda-common/changelog
114         echo "---->dh_installmenu: " >> $(log)
115         dh_installmenu -v >> $(log) 2>&1
116         echo "---->dh_installcron: " >> $(log)
117         dh_installcron >> $(log) 2>&1
118         echo "---->dh_installchangelogs: " >> $(log)
119         dh_installchangelogs -v >> $(log) 2>&1
120         echo "---->dh_installdebconf: " >> $(log)
121         dh_installdebconf -v >> $(log) 2>&1
122         echo `pwd` >> $(log)
123         echo "---->dh_install -v: " >> $(log)
124         dh_install -v --sourcedir=debian/amanda-common >> $(log) 2>&1
125         echo "---->dh_strip: " >> $(log)
126         dh_strip >> $(log) 2>&1
127         echo "---->dh_compress: " >> $(log)
128         dh_compress >> $(log) 2>&1
129         echo "---->dh_movefiles: " >> $(log)
130         dh_movefiles --sourcedir=debian/amanda-common >> $(log) 2>&1
131         echo "---->dh_fixperms: " >> $(log)
132         dh_fixperms -v >> $(log) 2>&1
133         # fix perms manually
134         chown -R $(AMANDAUSER):$(AMANDAGROUP) debian/*/var/lib/*
135         #chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
136         chown -R $(AMANDAUSER):$(AMANDAGROUP) $(server)/$(LOGDIR)
137         #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(LOGDIR)
138         chown -R $(AMANDAUSER):$(AMANDAGROUP) $(server)/$(SYSCONFDIR)/amanda
139         #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(SYSCONFDIR)/amanda
140         chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(AMHOMEDIR)/gnutar-lists
141         chmod -R u=rwX,g=rwX,o-rwx $(client)/$(AMHOMEDIR)/gnutar-lists
142         # .. setuid
143         chown root:disk \
144                 $(client)/$(AMLIBEXECDIR)/killpgrp \
145                 $(client)/$(AMLIBEXECDIR)/rundump \
146                 $(client)/$(AMLIBEXECDIR)/runtar \
147                 $(client)/$(AMLIBEXECDIR)/calcsize \
148                 $(server)/$(AMLIBEXECDIR)/killpgrp \
149                 $(server)/$(AMLIBEXECDIR)/rundump \
150                 $(server)/$(AMLIBEXECDIR)/runtar \
151                 $(server)/$(AMLIBEXECDIR)/calcsize \
152                 $(server)/$(AMLIBEXECDIR)/dumper \
153                 $(server)/$(AMLIBEXECDIR)/planner \
154                 $(server)/usr/sbin/amcheck
155         chmod u=srwx,g=rx,o=r \
156                 $(client)$(AMLIBEXECDIR)/killpgrp \
157                 $(client)$(AMLIBEXECDIR)/rundump \
158                 $(client)$(AMLIBEXECDIR)/runtar \
159                 $(client)$(AMLIBEXECDIR)/calcsize \
160                 $(server)$(AMLIBEXECDIR)/killpgrp \
161                 $(server)$(AMLIBEXECDIR)/rundump \
162                 $(server)$(AMLIBEXECDIR)/runtar \
163                 $(server)$(AMLIBEXECDIR)/calcsize \
164                 $(server)$(AMLIBEXECDIR)/dumper \
165                 $(server)$(AMLIBEXECDIR)/planner \
166                 $(server)/usr/sbin/amcheck
167         echo "Amanda version $(AMVER)" >  $(server)/$(AMHOMEDIR)/amanda-release 
168         echo "Amanda version $(AMVER)" >  $(client)/$(AMHOMEDIR)/amanda-release 
169         install -o root -g root -m 0644 debian/amanda-backup-client.lintian \
170                 $(client)/usr/share/lintian/overrides/amanda-backup-client
171         #install -o root -g root -m 0644 debian/amanda-common.lintian \
172         #       $(r)/usr/share/lintian/overrides/amanda-common
173         install -o root -g root -m 0644 debian/amanda-backup-server.lintian \
174                 $(server)/usr/share/lintian/overrides/amanda-backup-server
175         dh_makeshlibs  >> $(log) 2>&1
176         dh_installdeb >> $(log) 2>&1
177         dh_shlibdeps -l"debian/$(r)/usr/lib:debian/$(client)/usr/lib:debian/$(server)/usr/lib" >> $(log) 2>&1
178         # strip out the non-versioned amanda-common references, we need
179         # the versioned ones in the control file and dupes are ugly...
180         sed -e 's/amanda-common, //' < debian/amanda-backup-server.substvars > debian/blah
181         mv debian/blah debian/amanda-backup-server.substvars
182         sed -e 's/amanda-common, //' < debian/amanda-backup-client.substvars > debian/blah
183         mv debian/blah debian/amanda-backup-client.substvars
184         dh_gencontrol >> $(log) 2>&1
185         dh_md5sums  >> $(log) 2>&1
186         dh_builddeb  >> $(log) 2>&1
187
188 source diff:                                                                  
189         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
190
191 binary: binary-arch
192 .PHONY: build clean binary-arch binary