2 # Based on the sample debian/rules that uses debhelper.
3 # GNU copyright 1997 by Joey Hess.
5 # Uncomment this to turn on verbose mode.
8 # Tell Autoconf the correct system types.
9 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
11 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
12 SYSTEM = --build $(DEB_HOST_GNU_TYPE)
14 SYSTEM = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
17 # Determine whether we're building with optimization. This doesn't really
18 # work at the moment due to upstream problems.
19 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
20 DEBIAN_OPT_FLAGS = --disable-optimize --disable-optimize-lwp
21 DEBIAN_KERN_FLAGS = --disable-optimize-kernel
27 SYS_NAME := $(shell sh debian/sysname)
30 srcpkg = openafs-modules-source
31 dkmspkg = openafs-modules-dkms
32 DOCS = $(CURDIR)/debian/openafs-doc/usr/share/doc/openafs-doc
34 # The path to the XSLT used to generate HTML from the DocBook source files.
35 # This path is specific to different Linux distributions, so we have to pass
37 HTML_XSL = /usr/share/xml/docbook/stylesheet/nwalsh/html/chunk.xsl
39 # The /usr/share/doc directory for these packages should be a symlink to
40 # /usr/share/doc/openafs-client. Any package on this list must depend on
42 DOC_PACKAGES = libpam-openafs-kaserver openafs-dbserver openafs-fuse \
45 # These are files that we know we don't want to install. List them so that we
46 # can use dh_install --fail-missing and catch anything new that shows up.
47 IGNORE = -XAuthLog -Xcompile_et -Xcopyauth -Xdlog -Xdpass -Xfms.log \
48 -Xfs_chgrp.1 -Xfs_chown.1 -Xfs_cscpolicy.1 -Xfs_flushall.1 \
49 -Xfs_memdump.1 -Xfs_minidump.1 -Xfs_trace.1 -Xkadb_check -Xkaserver \
50 -Xkdb -Xkdump -Xkpwvalid -Xlibafssetpag.so -Xlibafsrpc.so \
51 -Xlibafsauthent.so -Xpackage -Xpagsh.krb -Xsymlink -Xtokens.krb \
52 -Xuss -Xvldb_convert -Xvsys -Xxfs_size_check
54 # Installed via other means since we have to rename them.
55 IGNORE += -Xafsd.fuse.8 -Xpam_afs
57 # These variables are used by get-orig-source and to construct dkms.conf.
58 # You will need to change TAG to package stable releases instead of
59 # experimental releases.
60 DEBVERS := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2 \
62 VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
63 TAG := $(shell echo 'openafs-devel-$(VERSION)' | sed 's/\./_/g')
64 REPO := git://git.openafs.org/openafs.git
66 # Upstream does tarball releases for major releases, but not for point
67 # relesaes, and the tarball releases are split into src and doc and contain
68 # the WINNT directory. Dropping WINNT, which is not used on Debian, saves a
69 # substantial amount of space in the source package, and there's no reason
70 # to include the files generated by regen.sh when we're going to run it
71 # again ourselves anyway.
73 # This rule therefore generates an upstream tarball from the upstream Git
74 # tag, rather than the tarball release, without the generated files that are
75 # not in Git and without the WINNT directory. It assumes that git-core is
76 # installed and there's network connectivity to the upstream repository.
78 git archive --remote='$(REPO)' --prefix='openafs_$(DEBVERS).orig/' \
79 --format=tar '$(TAG)' | tar xf -
80 rm -r openafs_$(DEBVERS).orig/src/WINNT
81 tar cf openafs_$(DEBVERS).orig.tar openafs_$(DEBVERS).orig
82 rm -r openafs_$(DEBVERS).orig
83 gzip -9 openafs_$(DEBVERS).orig.tar
85 # Handle the renaming of the up man page to afs-up here since the man pages
86 # are generated from POD source by regen.sh.
87 build: build-arch build-indep
88 build-arch: build-stamp
91 @if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
92 dh build --before configure
93 mv doc/man-pages/pod1/up.pod doc/man-pages/pod1/afs-up.pod
94 rm -f doc/man-pages/man1/up.1
96 afslogsdir=/var/log/openafs afslocaldir=/var/lib/openafs/local \
98 --with-afs-sysname=$(SYS_NAME) --disable-kernel-module \
99 --prefix=/usr --mandir=\$${prefix}/share/man \
100 --sysconfdir=/etc --libexecdir=/usr/lib \
101 --localstatedir=/var/lib --with-krb5-conf=/usr/bin/krb5-config \
102 --enable-supergroups --enable-demand-attach-fs \
103 --enable-disconnected --enable-fuse-client \
104 --with-xslt-processor=xsltproc --with-html-xsl=$(HTML_XSL) \
105 --enable-debug --enable-debug-lwp $(DEBIAN_OPT_FLAGS) $(SYSTEM)
106 chmod a+x config.sub src/libafs/make_kbuild_makefile.pl \
107 src/config/make_vnode.pl
108 dh build --after configure
110 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
111 $(MAKE) -C doc/xml/$$d all ; \
116 [ ! -f doc/man-pages/pod1/afs-up.pod ] \
117 || mv doc/man-pages/pod1/afs-up.pod doc/man-pages/pod1/up.pod
118 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
119 [ ! -f doc/xml/$$d/Makefile ] || $(MAKE) -C doc/xml/$$d clean ; \
123 install: install-stamp
124 install-stamp: build-stamp
125 dh install --until dh_prep
126 mkdir -p $(CURDIR)/debian/tmp
127 $(MAKE) install_nolibafs DESTDIR=$(CURDIR)/debian/tmp
128 rm -f debian/tmp/usr/bin/klog.krb
129 rm -f debian/tmp/usr/share/man/man1/klog.krb.1
130 chmod +x debian/afs-rootvol debian/afs-newcell
132 dh_install --fail-missing $(IGNORE)
133 dh_installinit -popenafs-client -r -- defaults 25 20
134 dh_installinit -popenafs-fileserver -r
136 mkdir -p $(DOCS)/html
137 cp doc/xml/*.gif doc/xml/*.html $(DOCS)/html/
138 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
139 mkdir $(DOCS)/html/$$d ; \
140 cp doc/xml/$$d/*.html $(DOCS)/html/$$d/ ; \
141 cp doc/xml/$$d/*.pdf $(DOCS)/ ; \
143 cp doc/xml/AdminGuide/*.png $(DOCS)/html/AdminGuide/
144 mkdir $(DOCS)/html/arch-overview
145 cp doc/arch/arch-overview.h $(DOCS)/html/arch-overview
146 cd $(DOCS)/html/arch-overview && doxygen *.h && rm *.h && mv html/* . \
148 set -e; for h in doc/protocol/*.h ; do \
149 mkdir $(DOCS)/html/`basename $$h .h` ; \
150 cp $$h $(DOCS)/html/`basename $$h .h` ; \
151 cd $(DOCS)/html/`basename $$h .h` && doxygen *.h && rm *.h \
152 && mv html/* . && rm -r latex html && cd $(CURDIR) ; \
155 install -d debian/$(srcpkg)/usr/src/modules/$(package)
156 cd libafs_tree && find . -print | \
157 cpio -admp $(CURDIR)/debian/$(srcpkg)/usr/src/modules/$(package)
158 mkdir -p debian/$(srcpkg)/usr/src/modules/$(package)/debian
159 cp debian/copyright debian/module/* \
160 debian/$(srcpkg)/usr/src/modules/$(package)/debian/
161 sed 's/^openafs /openafs-modules /' debian/changelog \
162 > debian/$(srcpkg)/usr/src/modules/$(package)/debian/changelog
163 chmod 755 debian/$(srcpkg)/usr/src/modules/$(package)/debian/rules
164 chown -R root.src debian/$(srcpkg)
165 find debian/$(srcpkg) -type d | xargs chmod 755
166 find debian/$(srcpkg) -type f -perm -100 | xargs chmod 755
167 find debian/$(srcpkg) -type f -not -perm -100 | xargs chmod 644
168 chmod 775 debian/$(srcpkg)/usr/src/modules
169 cd debian/$(srcpkg)/usr/src && tar cf $(package).tar modules
170 bzip2 debian/$(srcpkg)/usr/src/$(package).tar
171 chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.bz2
172 install -d debian/$(dkmspkg)/usr/src
173 mv debian/$(srcpkg)/usr/src/modules/$(package) \
174 debian/$(dkmspkg)/usr/src/openafs-$(VERSION)
175 rm -rf debian/$(dkmspkg)/usr/src/openafs-$(VERSION)/debian
176 rmdir debian/$(srcpkg)/usr/src/modules
178 set -e; for pkg in $(DOC_PACKAGES) ; do \
179 ln -s openafs-client debian/$$pkg/usr/share/doc/$$pkg; \
182 mv debian/openafs-client/usr/bin/pagsh \
183 debian/openafs-client/usr/bin/pagsh.openafs
184 mv debian/openafs-client/usr/share/man/man1/pagsh.1 \
185 debian/openafs-client/usr/share/man/man1/pagsh.openafs.1
186 mv debian/openafs-client/usr/bin/klog \
187 debian/openafs-client/usr/bin/klog.afs
188 mv debian/openafs-client/usr/share/man/man1/klog.1 \
189 debian/openafs-client/usr/share/man/man1/klog.afs.1
190 mv debian/openafs-client/usr/bin/up \
191 debian/openafs-client/usr/bin/afs-up
193 install -m 644 -c debian/tmp/usr/lib/pam_afs.so.1 \
194 debian/libpam-openafs-kaserver/lib/security/pam_afs.so
195 install -m 644 -c debian/tmp/usr/lib/pam_afs.krb.so.1 \
196 debian/libpam-openafs-kaserver/lib/security/pam_afs.krb.so
198 install -d debian/openafs-dbserver/usr/share/man/man8
199 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
201 >debian/openafs-dbserver/usr/share/man/man8/afs-rootvol.8
202 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
204 >debian/openafs-dbserver/usr/share/man/man8/afs-newcell.8
206 install -d debian/$(srcpkg)/usr/share/doc/$(srcpkg)
207 install -m 644 debian/openafs-client.NEWS \
208 debian/$(srcpkg)/usr/share/doc/$(srcpkg)/NEWS.Debian
210 dh_dkms -V $(VERSION)
211 dh install --after dh_install
212 chmod 700 debian/openafs-client/var/cache/openafs
213 chmod 700 debian/openafs-dbserver/var/lib/openafs/db
214 chmod 700 debian/openafs-fileserver/var/lib/openafs/local
217 binary-indep: install-stamp
220 # Only include debugging information for the servers installed into
221 # /usr/lib/openafs rather than for all binaries. The servers are where
222 # debugging backtraces really matter, and a 10MB debugging package is
224 binary-arch: install-stamp
225 dh binary-arch --before dh_strip
226 dh_strip --dbg-package=openafs-dbg
227 rm -rf debian/openafs-dbg/usr/lib/debug/lib
228 rm -rf debian/openafs-dbg/usr/lib/debug/sbin
229 rm -rf debian/openafs-dbg/usr/lib/debug/usr/bin
230 rm -rf debian/openafs-dbg/usr/lib/debug/usr/sbin
231 dh binary-arch --remaining
233 binary: binary-indep binary-arch
235 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean