Import Debian changes 1.8.5-1
[hcoop/debian/openafs.git] / debian / rules
1 #!/usr/bin/make -f
2
3 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
4 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
5
6 # Determine whether we're building with optimization. This doesn't really
7 # work at the moment due to upstream problems.
8 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
9 DEBIAN_OPT_FLAGS = --disable-optimize --disable-optimize-lwp
10 DEBIAN_KERN_FLAGS = --disable-optimize-kernel
11 else ifneq (,$(findstring arm-linux-gnueabi,$(DEB_HOST_GNU_TYPE)))
12 DEBIAN_OPT_FLAGS = --disable-optimize --disable-optimize-lwp
13 DEBIAN_KERN_FLAGS = --disable-optimize-kernel
14 else
15 DEBIAN_OPT_FLAGS =
16 DEBIAN_KERN_FLAGS =
17 endif
18
19 # Skip lengthy parts of the doc build when requested
20 ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
21 DOCMAKE=echo --
22 DOXYCMD=
23 GENDOCS=
24 else
25 # pdfTeX refuses to fully obey SOURCE_DATE_EPOCH without
26 # FORCE_SOURCE_DATE=1.
27 DOCMAKE=FORCE_SOURCE_DATE=1 make
28 DOXYCMD=dh_doxygen -popenafs-doc
29 GENDOCS=AdminGuide QuickStartUnix UserGuide
30 endif
31
32 SYS_NAME := $(shell sh debian/sysname)
33
34 package = openafs
35 srcpkg = openafs-modules-source
36 dkmspkg = openafs-modules-dkms
37 DOCS = $(CURDIR)/debian/openafs-doc/usr/share/doc/openafs-doc
38
39 # The path to the XSLT used to generate HTML from the DocBook source files.
40 # This path is specific to different Linux distributions, so we have to pass
41 # it into configure.
42 HTML_XSL = /usr/share/xml/docbook/stylesheet/nwalsh/html/chunk.xsl
43
44 # The /usr/share/doc directory for these packages should be a symlink to
45 # /usr/share/doc/openafs-client. Any package on this list must depend on
46 # openafs-client. This variable is used as options to dh_installdocs with
47 # the --link-doc option.
48 DOC_PACKAGES = -popenafs-fuse
49
50 # These are files that we know we don't want to install. List them so that we
51 # can use dh_install --fail-missing and catch anything new that shows up.
52 IGNORE = -XAuthLog -Xaklog_dynamic_auth.8 -Xcopyauth -Xdlog -Xdpass \
53 -Xfms.log -Xfs_chgrp.1 -Xfs_chown.1 -Xfs_cscpolicy.1 \
54 -Xfs_flushall.1 -Xfs_memdump.1 -Xfs_minidump.1 -Xfs_trace.1 \
55 -Xkadb_check -Xkaserver -Xkdb -Xkdump -Xkpwvalid -Xpagsh.krb \
56 -Xsymlink -Xtokens.krb -Xuss -Xvldb_convert -Xvsys \
57 -Xxfs_size_check
58
59 # Installed via other means since we have to rename them.
60 IGNORE += -Xafsd.fuse.8
61
62 # These variables are used by get-orig-source, to construct dkms.conf, and
63 # to set the build version. You will need to change TAG to package stable
64 # releases instead of experimental releases.
65 DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)
66 DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
67 VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
68 TAG := $(shell echo 'openafs-stable-$(VERSION)' | sed 's/\./_/g')
69 REPO := git://git.openafs.org/openafs.git
70
71 # Upstream does tarball releases for major releases, but not for point
72 # relesaes, and the tarball releases are split into src and doc and contain
73 # the WINNT directory. Dropping WINNT, which is not used on Debian, saves a
74 # substantial amount of space in the source package, and there's no reason
75 # to include the files generated by regen.sh when we're going to run it
76 # again ourselves anyway.
77 #
78 # This rule therefore generates an upstream tarball from the upstream Git
79 # tag, rather than the tarball release, without the generated files that are
80 # not in Git and without the WINNT directory. It assumes that git-core is
81 # installed and there's network connectivity to the upstream repository.
82 get-orig-source:
83 git archive --remote='$(REPO)' --prefix='openafs_$(DEBVERS).orig/' \
84 --format=tar '$(TAG)' \
85 | tar --delete 'openafs_$(DEBVERS).orig/src/WINNT' \
86 | xz > 'openafs_$(DEBVERS).orig.tar.xz'
87
88 # Use dh for most actions, with overrides below.
89 %:
90 dh $@ --with-systemd
91
92 # Handle the renaming of the up man page to afs-up here since the man pages
93 # are generated from POD source by regen.sh.
94 override_dh_auto_configure:
95 @if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
96 echo '$(DEBIAN)'-debian > .version
97 mv doc/man-pages/pod1/up.pod doc/man-pages/pod1/afs-up.pod
98 rm -f doc/man-pages/man1/up.1
99 sh regen.sh
100 afslogsdir=/var/log/openafs afslocaldir=/var/lib/openafs/local \
101 dh_auto_configure -- \
102 --with-afs-sysname=$(SYS_NAME) --disable-kernel-module \
103 --libdir=\$${prefix}/lib --libexecdir=\$${prefix}/lib \
104 --localstatedir=/var/lib --enable-supergroups \
105 --enable-fuse-client --enable-debug --enable-debug-lwp \
106 --with-docbook2pdf=dblatex --with-xslt-processor=xsltproc \
107 --with-html-xsl=$(HTML_XSL) \
108 --with-krb5-include=/usr/include/mit-krb5 \
109 --with-krb5-lib=/usr/lib/$(DEB_HOST_MULTIARCH)/mit-krb5 \
110 --with-roken-include=/usr/include/heimdal \
111 --with-roken-lib=/usr/lib/$(DEB_HOST_MULTIARCH)/heimdal \
112 --with-hcrypto-include=/usr/include/heimdal \
113 --with-hcrypto-lib=/usr/lib/$(DEB_HOST_MULTIARCH)/heimdal \
114 --without-ctf-tools \
115 $(DEBIAN_OPT_FLAGS)
116
117 # Also build a libafs_tree and build the XML documentation if building
118 # architecture-independent packages.
119 override_dh_auto_build-indep:
120 dh_auto_build
121 $(MAKE) libafs_tree
122 set -e; for d in $(GENDOCS); do \
123 $(DOCMAKE) -C doc/xml/$$d all ; \
124 done
125
126 # The manipulation of debian/changelog here is unnecessary with a regular
127 # Debian build. It is provided solely so that upstream can share the Debian
128 # packaging files, working around problems caused by upstream's distclean
129 # removing packaging/Debian/changelog because it's Autoconf-generated.
130 override_dh_auto_clean:
131 [ ! -f doc/man-pages/pod1/afs-up.pod ] \
132 || mv doc/man-pages/pod1/afs-up.pod doc/man-pages/pod1/up.pod
133 set -e; for d in $(GENDOCS); do \
134 [ ! -f doc/xml/$$d/Makefile ] || $(DOCMAKE) -C doc/xml/$$d clean ; \
135 done
136 [ ! -f debian/changelog.in ] \
137 || cp debian/changelog debian/changelog.save
138 dh_auto_clean -- maintainer-clean
139 [ -f debian/changelog ] || mv debian/changelog.save debian/changelog
140
141 # We have to use a non-standard install target and then do some fiddling
142 # with the results.
143 override_dh_auto_install:
144 mkdir -p $(CURDIR)/debian/tmp
145 $(MAKE) install_nolibafs DESTDIR=$(CURDIR)/debian/tmp
146 rm -f debian/tmp/usr/bin/klog.krb
147 rm -f debian/tmp/usr/share/man/man1/klog.krb.1
148 rm -f debian/tmp/usr/share/man/man8/kas*.8
149 rm -f debian/tmp/usr/share/man/man1/kkpasswd.1
150
151 # Override dh_install for architecture-dependent builds to move some files
152 # around, do some manual installation of things like PAM modules, and ensure
153 # that scripts we install are executable
154 override_dh_install-arch:
155 chmod +x debian/afs-rootvol debian/afs-newcell
156 dh_install --fail-missing $(IGNORE)
157
158 mv debian/openafs-client/usr/bin/pagsh \
159 debian/openafs-client/usr/bin/pagsh.openafs
160 mv debian/openafs-client/usr/share/man/man1/pagsh.1 \
161 debian/openafs-client/usr/share/man/man1/pagsh.openafs.1
162 mv debian/openafs-client/usr/bin/up \
163 debian/openafs-client/usr/bin/afs-up
164
165 install -d debian/openafs-dbserver/usr/share/man/man8
166 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
167 afs-rootvol ) \
168 >debian/openafs-dbserver/usr/share/man/man8/afs-rootvol.8
169 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
170 afs-newcell ) \
171 >debian/openafs-dbserver/usr/share/man/man8/afs-newcell.8
172
173 # Override dh_install for architecture-independent builds to handle
174 # installation of all the extra documentation that upstream doesn't install
175 # by default and install the source required for the kernel source package
176 # and the DKMS package.
177 override_dh_install-indep:
178 mkdir -p $(DOCS)/html
179 -cp doc/xml/*.gif doc/xml/*.html $(DOCS)/html/
180 set -e; for d in $(GENDOCS); do \
181 mkdir $(DOCS)/html/$$d ; \
182 cp doc/xml/$$d/*.html $(DOCS)/html/$$d/ ; \
183 cp doc/xml/$$d/*.pdf $(DOCS)/ ; \
184 done
185 -cp doc/xml/AdminGuide/*.png $(DOCS)/html/AdminGuide/
186 mkdir $(DOCS)/html/arch-overview
187 cp doc/txt/arch-overview.h $(DOCS)/html/arch-overview
188 cd $(DOCS)/html/arch-overview && doxygen -g && doxygen \
189 && rm Doxyfile *.h && mv html/* . && rm -r latex html
190 set -e; for h in doc/protocol/*.h ; do \
191 mkdir $(DOCS)/html/`basename $$h .h` ; \
192 cp $$h $(DOCS)/html/`basename $$h .h` ; \
193 cd $(DOCS)/html/`basename $$h .h` && doxygen -g && doxygen \
194 && rm Doxyfile *.h && mv html/* . && rm -r latex html \
195 && cd $(CURDIR) ; \
196 done
197 $(DOXYCMD)
198
199 install -d debian/$(srcpkg)/usr/src/modules/$(package)
200 cd libafs_tree && find . -print \
201 | cpio -admp $(CURDIR)/debian/$(srcpkg)/usr/src/modules/$(package)
202 cp .version debian/$(srcpkg)/usr/src/modules/$(package)/
203 mkdir -p debian/$(srcpkg)/usr/src/modules/$(package)/debian
204 cp debian/copyright debian/module/* \
205 debian/$(srcpkg)/usr/src/modules/$(package)/debian/
206 sed 's/^openafs /openafs-modules /' debian/changelog \
207 > debian/$(srcpkg)/usr/src/modules/$(package)/debian/changelog
208 chmod 755 debian/$(srcpkg)/usr/src/modules/$(package)/debian/rules
209 chown -R root.src debian/$(srcpkg)
210 find debian/$(srcpkg) -type d | xargs chmod 755
211 find debian/$(srcpkg) -type f -perm -100 | xargs chmod 755
212 find debian/$(srcpkg) -type f -not -perm -100 | xargs chmod 644
213 chmod 775 debian/$(srcpkg)/usr/src/modules
214 cd debian/$(srcpkg)/usr/src && find modules -print0 | LC_ALL=C sort -z | tar --no-recursion --null -T - $(if $(SOURCE_DATE_EPOCH),--mtime=@$(SOURCE_DATE_EPOCH)) -cf $(package).tar
215 bzip2 debian/$(srcpkg)/usr/src/$(package).tar
216 chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.bz2
217 install -d debian/$(dkmspkg)/usr/src
218 mv debian/$(srcpkg)/usr/src/modules/$(package) \
219 debian/$(dkmspkg)/usr/src/openafs-$(VERSION)
220 rm -rf debian/$(dkmspkg)/usr/src/openafs-$(VERSION)/debian
221 rmdir debian/$(srcpkg)/usr/src/modules
222 dh_dkms -V $(VERSION)
223
224 install -d debian/$(srcpkg)/usr/share/doc/$(srcpkg)
225 install -m 644 debian/openafs-client.NEWS \
226 debian/$(srcpkg)/usr/share/doc/$(srcpkg)/NEWS.Debian
227
228 # We don't want to stop the init scripts on upgrade.
229 override_dh_installinit:
230 dh_systemd_enable
231 dh_installinit -popenafs-client -r
232 dh_installinit -popenafs-fileserver -r
233
234 # Symlink /usr/share/doc for some packages.
235 override_dh_installdocs:
236 dh_installdocs $(DOC_PACKAGES) --link-doc=openafs-client
237 dh_installdocs --remaining-packages
238
239 # Install the upstream NEWS file as the upstream changelog.
240 override_dh_installchangelogs:
241 dh_installchangelogs NEWS
242
243 # Override some of our permissions.
244 override_dh_fixperms-arch:
245 dh_fixperms
246 chmod 700 debian/openafs-client/var/cache/openafs
247 chmod 700 debian/openafs-dbserver/var/lib/openafs/db
248 chmod 700 debian/openafs-fileserver/var/lib/openafs/local
249
250 override_dh_strip:
251 dh_strip --dbgsym-migration='openafs-dbg (<< 1.6.18.3-3~)'