3 # Tell Autoconf the correct system types.
4 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
5 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
6 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
7 SYSTEM = --build $(DEB_HOST_GNU_TYPE)
9 SYSTEM = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
12 # Determine whether we're building with optimization. This doesn't really
13 # work at the moment due to upstream problems.
14 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
15 DEBIAN_OPT_FLAGS = --disable-optimize --disable-optimize-lwp
16 DEBIAN_KERN_FLAGS = --disable-optimize-kernel
22 SYS_NAME := $(shell sh debian/sysname)
25 srcpkg = openafs-modules-source
26 dkmspkg = openafs-modules-dkms
27 DOCS = $(CURDIR)/debian/openafs-doc/usr/share/doc/openafs-doc
29 # The path to the XSLT used to generate HTML from the DocBook source files.
30 # This path is specific to different Linux distributions, so we have to pass
32 HTML_XSL = /usr/share/xml/docbook/stylesheet/nwalsh/html/chunk.xsl
34 # The /usr/share/doc directory for these packages should be a symlink to
35 # /usr/share/doc/openafs-client. Any package on this list must depend on
36 # openafs-client. This variable is used as options to dh_installdocs with
37 # the --link-doc option.
38 DOC_PACKAGES = -plibpam-openafs-kaserver -popenafs-dbserver -popenafs-fuse \
41 # These are files that we know we don't want to install. List them so that we
42 # can use dh_install --fail-missing and catch anything new that shows up.
43 IGNORE = -XAuthLog -Xcompile_et -Xcopyauth -Xdlog -Xdpass -Xfms.log \
44 -Xfs_chgrp.1 -Xfs_chown.1 -Xfs_cscpolicy.1 -Xfs_flushall.1 \
45 -Xfs_memdump.1 -Xfs_minidump.1 -Xfs_trace.1 -Xkadb_check -Xkaserver \
46 -Xkdb -Xkdump -Xkpwvalid -Xpagsh.krb -Xsymlink -Xtokens.krb -Xuss \
47 -Xvldb_convert -Xvsys -Xxfs_size_check
49 # Installed via other means since we have to rename them.
50 IGNORE += -Xafsd.fuse.8 -Xpam_afs
52 # These variables are used by get-orig-source, to construct dkms.conf, and
53 # to set the build version. You will need to change TAG to package stable
54 # releases instead of experimental releases.
55 DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)
56 DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
57 VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
58 TAG := $(shell echo 'openafs-devel-$(VERSION)' | sed 's/\./_/g')
59 REPO := git://git.openafs.org/openafs.git
61 # Upstream does tarball releases for major releases, but not for point
62 # relesaes, and the tarball releases are split into src and doc and contain
63 # the WINNT directory. Dropping WINNT, which is not used on Debian, saves a
64 # substantial amount of space in the source package, and there's no reason
65 # to include the files generated by regen.sh when we're going to run it
66 # again ourselves anyway.
68 # This rule therefore generates an upstream tarball from the upstream Git
69 # tag, rather than the tarball release, without the generated files that are
70 # not in Git and without the WINNT directory. It assumes that git-core is
71 # installed and there's network connectivity to the upstream repository.
73 git archive --remote='$(REPO)' --prefix='openafs_$(DEBVERS).orig/' \
74 --format=tar '$(TAG)' | tar xf -
75 rm -r openafs_$(DEBVERS).orig/src/WINNT
76 tar cf openafs_$(DEBVERS).orig.tar openafs_$(DEBVERS).orig
77 rm -r openafs_$(DEBVERS).orig
78 gzip -9 openafs_$(DEBVERS).orig.tar
80 # Use dh for most actions, with overrides below.
84 # Handle the renaming of the up man page to afs-up here since the man pages
85 # are generated from POD source by regen.sh.
86 override_dh_auto_configure:
87 @if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
88 echo '$(DEBIAN)'-debian > .version
89 mv doc/man-pages/pod1/up.pod doc/man-pages/pod1/afs-up.pod
90 rm -f doc/man-pages/man1/up.1
92 afslogsdir=/var/log/openafs afslocaldir=/var/lib/openafs/local \
94 --with-afs-sysname=$(SYS_NAME) --disable-kernel-module \
95 --prefix=/usr --mandir=\$${prefix}/share/man \
96 --sysconfdir=/etc --libexecdir=/usr/lib --with-krb5 \
97 --localstatedir=/var/lib --enable-supergroups \
98 --enable-fuse-client --enable-debug --enable-debug-lwp \
99 --with-xslt-processor=xsltproc --with-html-xsl=$(HTML_XSL) \
100 --enable-reduced-depends $(DEBIAN_OPT_FLAGS) $(SYSTEM)
102 # Also build a libafs_tree and build the XML documentation.
103 override_dh_auto_build:
106 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
107 $(MAKE) -C doc/xml/$$d all ; \
110 # The manipulation of debian/changelog here is unnecessary with a regular
111 # Debian build. It is provided solely so that upstream can share the Debian
112 # packaging files, working around problems caused by upstream's distclean
113 # removing packaging/Debian/changelog because it's Autoconf-generated.
114 override_dh_auto_clean:
115 [ ! -f doc/man-pages/pod1/afs-up.pod ] \
116 || mv doc/man-pages/pod1/afs-up.pod doc/man-pages/pod1/up.pod
117 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
118 [ ! -f doc/xml/$$d/Makefile ] || $(MAKE) -C doc/xml/$$d clean ; \
120 [ ! -f debian/changelog.in ] \
121 || cp debian/changelog debian/changelog.save
123 [ -f debian/changelog ] || mv debian/changelog.save debian/changelog
125 # We have to use a non-standard install target and then do some fiddling
127 override_dh_auto_install:
128 mkdir -p $(CURDIR)/debian/tmp
129 $(MAKE) install_nolibafs DESTDIR=$(CURDIR)/debian/tmp
130 rm -f debian/tmp/usr/bin/klog.krb
131 rm -f debian/tmp/usr/share/man/man1/klog.krb.1
133 # Override dh_install to handle installation of all the extra documentation
134 # that upstream doesn't install by default, install the source required for
135 # the kernel source package and the DKMS package, move some files about and
136 # do some manually installation of additional things like PAM modules, and
137 # to ensure that the extra scripts we install are executable.
139 chmod +x debian/afs-rootvol debian/afs-newcell
140 dh_install --fail-missing $(IGNORE)
142 mkdir -p $(DOCS)/html
143 cp doc/xml/*.gif doc/xml/*.html $(DOCS)/html/
144 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
145 mkdir $(DOCS)/html/$$d ; \
146 cp doc/xml/$$d/*.html $(DOCS)/html/$$d/ ; \
147 cp doc/xml/$$d/*.pdf $(DOCS)/ ; \
149 cp doc/xml/AdminGuide/*.png $(DOCS)/html/AdminGuide/
150 mkdir $(DOCS)/html/arch-overview
151 cp doc/arch/arch-overview.h $(DOCS)/html/arch-overview
152 cd $(DOCS)/html/arch-overview && doxygen *.h && rm *.h && mv html/* . \
154 set -e; for h in doc/protocol/*.h ; do \
155 mkdir $(DOCS)/html/`basename $$h .h` ; \
156 cp $$h $(DOCS)/html/`basename $$h .h` ; \
157 cd $(DOCS)/html/`basename $$h .h` && doxygen *.h && rm *.h \
158 && mv html/* . && rm -r latex html && cd $(CURDIR) ; \
161 install -d debian/$(srcpkg)/usr/src/modules/$(package)
162 cd libafs_tree && find . -print | \
163 cpio -admp $(CURDIR)/debian/$(srcpkg)/usr/src/modules/$(package)
164 cp .version debian/$(srcpkg)/usr/src/modules/$(package)/
165 mkdir -p debian/$(srcpkg)/usr/src/modules/$(package)/debian
166 cp debian/copyright debian/module/* \
167 debian/$(srcpkg)/usr/src/modules/$(package)/debian/
168 sed 's/^openafs /openafs-modules /' debian/changelog \
169 > debian/$(srcpkg)/usr/src/modules/$(package)/debian/changelog
170 chmod 755 debian/$(srcpkg)/usr/src/modules/$(package)/debian/rules
171 chown -R root.src debian/$(srcpkg)
172 find debian/$(srcpkg) -type d | xargs chmod 755
173 find debian/$(srcpkg) -type f -perm -100 | xargs chmod 755
174 find debian/$(srcpkg) -type f -not -perm -100 | xargs chmod 644
175 chmod 775 debian/$(srcpkg)/usr/src/modules
176 cd debian/$(srcpkg)/usr/src && tar cf $(package).tar modules
177 bzip2 debian/$(srcpkg)/usr/src/$(package).tar
178 chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.bz2
179 install -d debian/$(dkmspkg)/usr/src
180 mv debian/$(srcpkg)/usr/src/modules/$(package) \
181 debian/$(dkmspkg)/usr/src/openafs-$(VERSION)
182 rm -rf debian/$(dkmspkg)/usr/src/openafs-$(VERSION)/debian
183 rmdir debian/$(srcpkg)/usr/src/modules
184 dh_dkms -V $(VERSION)
186 mv debian/openafs-client/usr/bin/pagsh \
187 debian/openafs-client/usr/bin/pagsh.openafs
188 mv debian/openafs-client/usr/share/man/man1/pagsh.1 \
189 debian/openafs-client/usr/share/man/man1/pagsh.openafs.1
190 mv debian/openafs-client/usr/bin/klog \
191 debian/openafs-client/usr/bin/klog.afs
192 mv debian/openafs-client/usr/share/man/man1/klog.1 \
193 debian/openafs-client/usr/share/man/man1/klog.afs.1
194 mv debian/openafs-client/usr/bin/up \
195 debian/openafs-client/usr/bin/afs-up
197 install -m 644 -c debian/tmp/usr/lib/pam_afs.so.1 \
198 debian/libpam-openafs-kaserver/lib/security/pam_afs.so
199 install -m 644 -c debian/tmp/usr/lib/pam_afs.krb.so.1 \
200 debian/libpam-openafs-kaserver/lib/security/pam_afs.krb.so
202 install -d debian/openafs-dbserver/usr/share/man/man8
203 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
205 >debian/openafs-dbserver/usr/share/man/man8/afs-rootvol.8
206 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
208 >debian/openafs-dbserver/usr/share/man/man8/afs-newcell.8
210 install -d debian/$(srcpkg)/usr/share/doc/$(srcpkg)
211 install -m 644 debian/openafs-client.NEWS \
212 debian/$(srcpkg)/usr/share/doc/$(srcpkg)/NEWS.Debian
214 # We have multiple init scripts with some non-standard defaults.
215 override_dh_installinit:
216 dh_installinit -popenafs-client -r -- defaults 25 20
217 dh_installinit -popenafs-fileserver -r
219 # Create the documentation symlinks.
220 override_dh_installdocs:
221 dh_installdocs $(DOC_PACKAGES) --link-doc=openafs-client
222 dh_installdocs --remaining-packages
224 # Install the upstream NEWS file as the upstream changelog.
225 override_dh_installchangelogs:
226 dh_installchangelogs NEWS
228 # Override some of our permissions.
229 override_dh_fixperms:
231 chmod 700 debian/openafs-client/var/cache/openafs
232 chmod 700 debian/openafs-dbserver/var/lib/openafs/db
233 chmod 700 debian/openafs-fileserver/var/lib/openafs/local
235 # Only include debugging information for the servers installed into
236 # /usr/lib/openafs rather than for all binaries. The servers are where
237 # debugging backtraces really matter, and a 10MB debugging package is
240 dh_strip --dbg-package=openafs-dbg
241 rm -rf debian/openafs-dbg/usr/lib/debug/lib
242 rm -rf debian/openafs-dbg/usr/lib/debug/sbin
243 rm -rf debian/openafs-dbg/usr/lib/debug/usr/bin
244 rm -rf debian/openafs-dbg/usr/lib/debug/usr/sbin