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-kpasswd
44 # These are files that we know we don't want to install. List them so that we
45 # can use dh_install --fail-missing and catch anything new that shows up.
46 IGNORE = -XAuthLog -Xcompile_et -Xcopyauth -Xdlog -Xdpass -Xfms.log \
47 -Xfs_chgrp.1 -Xfs_chown.1 -Xfs_cscpolicy.1 -Xfs_flushall.1 \
48 -Xfs_memdump.1 -Xfs_minidump.1 -Xfs_trace.1 -Xkadb_check -Xkaserver \
49 -Xkdb -Xkdump -Xkpwvalid -Xlibafssetpag.so -Xlibafsrpc.so \
50 -Xlibafsauthent.so -Xpackage -Xpagsh.krb -Xsymlink -Xtokens.krb \
51 -Xuss -Xvldb_convert -Xvsys -Xxfs_size_check
53 # Installed via other means since we have to rename them.
56 # These variables are used by get-orig-source and to construct dkms.conf.
57 # You will need to change TAG to package stable releases instead of
58 # experimental releases.
59 DEBVERS := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2 \
61 VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
62 TAG := $(shell echo 'openafs-devel-$(VERSION)' | sed 's/\./_/g')
63 REPO := git://git.openafs.org/openafs.git
65 # Upstream does tarball releases for major releases, but not for point
66 # relesaes, and the tarball releases are split into src and doc and contain
67 # the WINNT directory. Dropping WINNT, which is not used on Debian, saves a
68 # substantial amount of space in the source package, and there's no reason
69 # to include the files generated by regen.sh when we're going to run it
70 # again ourselves anyway.
72 # This rule therefore generates an upstream tarball from the upstream Git
73 # tag, rather than the tarball release, without the generated files that are
74 # not in Git and without the WINNT directory. It assumes that git-core is
75 # installed and there's network connectivity to the upstream repository.
77 git archive --remote='$(REPO)' --prefix='openafs_$(DEBVERS).orig/' \
78 --format=tar '$(TAG)' | tar xf -
79 rm -r openafs_$(DEBVERS).orig/src/WINNT
80 tar cf openafs_$(DEBVERS).orig.tar openafs_$(DEBVERS).orig
81 rm -r openafs_$(DEBVERS).orig
82 gzip -9 openafs_$(DEBVERS).orig.tar
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 build: build-arch build-indep
87 build-arch: build-stamp
90 @if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
91 dh build --before configure
92 mv doc/man-pages/pod1/up.pod doc/man-pages/pod1/afs-up.pod
93 rm -f doc/man-pages/man1/up.1
95 afslogsdir=/var/log/openafs afslocaldir=/var/lib/openafs/local \
97 --with-afs-sysname=$(SYS_NAME) --disable-kernel-module \
98 --prefix=/usr --mandir=\$${prefix}/share/man \
99 --sysconfdir=/etc --libexecdir=/usr/lib \
100 --localstatedir=/var/lib --with-krb5-conf=/usr/bin/krb5-config \
101 --enable-supergroups --enable-demand-attach-fs \
102 --enable-disconnected \
103 --with-xslt-processor=xsltproc --with-html-xsl=$(HTML_XSL) \
104 --enable-debug --enable-debug-lwp $(DEBIAN_OPT_FLAGS) $(SYSTEM)
105 chmod a+x config.sub src/libafs/make_kbuild_makefile.pl \
106 src/config/make_vnode.pl
107 dh build --after configure
109 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
110 $(MAKE) -C doc/xml/$$d all ; \
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 ; \
122 install: install-stamp
123 install-stamp: build-stamp
124 dh install --until dh_prep
125 mkdir -p $(CURDIR)/debian/tmp
126 $(MAKE) install_nolibafs DESTDIR=$(CURDIR)/debian/tmp
127 rm -f debian/tmp/usr/bin/klog.krb
128 rm -f debian/tmp/usr/share/man/man1/klog.krb.1
129 chmod +x debian/afs-rootvol debian/afs-newcell
131 dh_install --fail-missing $(IGNORE)
132 dh_installinit -popenafs-client -r -- defaults 25 20
133 dh_installinit -popenafs-fileserver -r
135 mkdir -p $(DOCS)/html
136 cp doc/xml/*.gif doc/xml/*.html $(DOCS)/html/
137 set -e; for d in AdminGuide QuickStartUnix UserGuide ; do \
138 mkdir $(DOCS)/html/$$d ; \
139 cp doc/xml/$$d/*.html $(DOCS)/html/$$d/ ; \
140 cp doc/xml/$$d/*.pdf $(DOCS)/ ; \
142 cp doc/xml/AdminGuide/*.png $(DOCS)/html/AdminGuide/
143 mkdir $(DOCS)/html/arch-overview
144 cp doc/arch/arch-overview.h $(DOCS)/html/arch-overview
145 cd $(DOCS)/html/arch-overview && doxygen *.h && rm *.h && mv html/* . \
147 set -e; for h in doc/protocol/*.h ; do \
148 mkdir $(DOCS)/html/`basename $$h .h` ; \
149 cp $$h $(DOCS)/html/`basename $$h .h` ; \
150 cd $(DOCS)/html/`basename $$h .h` && doxygen *.h && rm *.h \
151 && mv html/* . && rm -r latex html && cd $(CURDIR) ; \
154 install -d debian/$(srcpkg)/usr/src/modules/$(package)
155 cd libafs_tree && find . -print | \
156 cpio -admp $(CURDIR)/debian/$(srcpkg)/usr/src/modules/$(package)
157 mkdir -p debian/$(srcpkg)/usr/src/modules/$(package)/debian
158 cp debian/copyright debian/module/* \
159 debian/$(srcpkg)/usr/src/modules/$(package)/debian/
160 sed 's/^openafs /openafs-modules /' debian/changelog \
161 > debian/$(srcpkg)/usr/src/modules/$(package)/debian/changelog
162 chmod 755 debian/$(srcpkg)/usr/src/modules/$(package)/debian/rules
163 chown -R root.src debian/$(srcpkg)
164 find debian/$(srcpkg) -type d | xargs chmod 755
165 find debian/$(srcpkg) -type f -perm -100 | xargs chmod 755
166 find debian/$(srcpkg) -type f -not -perm -100 | xargs chmod 644
167 chmod 775 debian/$(srcpkg)/usr/src/modules
168 cd debian/$(srcpkg)/usr/src && tar cf $(package).tar modules
169 bzip2 debian/$(srcpkg)/usr/src/$(package).tar
170 chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.bz2
171 install -d debian/$(dkmspkg)/usr/src
172 mv debian/$(srcpkg)/usr/src/modules/$(package) \
173 debian/$(dkmspkg)/usr/src/openafs-$(VERSION)
174 rm -rf debian/$(dkmspkg)/usr/src/openafs-$(VERSION)/debian
175 rmdir debian/$(srcpkg)/usr/src/modules
177 set -e; for pkg in $(DOC_PACKAGES) ; do \
178 ln -s openafs-client debian/$$pkg/usr/share/doc/$$pkg; \
181 mv debian/openafs-client/usr/bin/pagsh \
182 debian/openafs-client/usr/bin/pagsh.openafs
183 mv debian/openafs-client/usr/share/man/man1/pagsh.1 \
184 debian/openafs-client/usr/share/man/man1/pagsh.openafs.1
185 mv debian/openafs-client/usr/bin/klog \
186 debian/openafs-client/usr/bin/klog.afs
187 mv debian/openafs-client/usr/share/man/man1/klog.1 \
188 debian/openafs-client/usr/share/man/man1/klog.afs.1
189 mv debian/openafs-client/usr/bin/up \
190 debian/openafs-client/usr/bin/afs-up
192 install -m 644 -c debian/tmp/usr/lib/pam_afs.so.1 \
193 debian/libpam-openafs-kaserver/lib/security/pam_afs.so
194 install -m 644 -c debian/tmp/usr/lib/pam_afs.krb.so.1 \
195 debian/libpam-openafs-kaserver/lib/security/pam_afs.krb.so
197 install -d debian/openafs-dbserver/usr/share/man/man8
198 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
200 >debian/openafs-dbserver/usr/share/man/man8/afs-rootvol.8
201 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
203 >debian/openafs-dbserver/usr/share/man/man8/afs-newcell.8
205 install -d debian/$(srcpkg)/usr/share/doc/$(srcpkg)
206 install -m 644 debian/openafs-client.NEWS \
207 debian/$(srcpkg)/usr/share/doc/$(srcpkg)/NEWS.Debian
209 dh_dkms -V $(VERSION)
210 dh install --after dh_install
211 chmod 700 debian/openafs-client/var/cache/openafs
212 chmod 700 debian/openafs-dbserver/var/lib/openafs/db
213 chmod 700 debian/openafs-fileserver/var/lib/openafs/local
216 binary-indep: install-stamp
219 # Only include debugging information for the servers installed into
220 # /usr/lib/openafs rather than for all binaries. The servers are where
221 # debugging backtraces really matter, and a 10MB debugging package is
223 binary-arch: install-stamp
224 dh binary-arch --before dh_strip
225 dh_strip --dbg-package=openafs-dbg
226 rm -rf debian/openafs-dbg/usr/lib/debug/lib
227 rm -rf debian/openafs-dbg/usr/lib/debug/sbin
228 rm -rf debian/openafs-dbg/usr/lib/debug/usr/bin
229 rm -rf debian/openafs-dbg/usr/lib/debug/usr/sbin
230 dh binary-arch --remaining
232 binary: binary-indep binary-arch
234 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean